diff --git a/src/app/zap-templates/partials/cluster-objects-struct.zapt b/src/app/zap-templates/partials/cluster-objects-struct.zapt index 5bf7e67beb3293..ad39d631a515cb 100644 --- a/src/app/zap-templates/partials/cluster-objects-struct.zapt +++ b/src/app/zap-templates/partials/cluster-objects-struct.zapt @@ -113,32 +113,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const {{/if}} CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) { - if (!TLV::IsContextTag(reader.GetTag())) + detail::StructDecodeIterator __iterator(reader); + while (true) { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { + return std::get(__element); + } + + {{#zcl_struct_items}} + {{#first}} + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + {{/first~}} + {{! NOTE: using if/else instead of switch because it seems to generate smaller code. ~}} + if (__context_tag == to_underlying(Fields::k{{asUpperCamelCase label}})) { - continue; + err = DataModel::Decode(reader, {{asLowerCamelCase label}}); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else + {{#last}} { - {{#zcl_struct_items}} - case to_underlying(Fields::k{{asUpperCamelCase label}}): - ReturnErrorOnFailure(DataModel::Decode(reader, {{asLowerCamelCase label}})); - break; - {{/zcl_struct_items}} - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + {{/last}} + {{/zcl_struct_items}} + } } } // namespace {{asUpperCamelCase name}} diff --git a/src/app/zap-templates/templates/app/cluster-objects-src.zapt b/src/app/zap-templates/templates/app/cluster-objects-src.zapt index 1f4c7d6f8c50cd..6bdbf3cb4f8674 100644 --- a/src/app/zap-templates/templates/app/cluster-objects-src.zapt +++ b/src/app/zap-templates/templates/app/cluster-objects-src.zapt @@ -1,6 +1,7 @@ {{> header}} #include +#include namespace chip { namespace app { @@ -8,39 +9,48 @@ namespace Clusters { namespace detail { -CHIP_ERROR FlightCheckDecodeAndEnterStruct(TLV::TLVReader & reader, TLV::TLVType & outer) -{ - TLV::TLVReader temp_reader; - - // Make a copy of the struct reader to do pre-checks. - temp_reader.Init(reader); +class StructDecodeIterator { + public: + // may return a context tag, a CHIP_ERROR (end iteration) + using EntryElement = std::variant; + + StructDecodeIterator(TLV::TLVReader &reader) : mReader(reader){} + + // Iterate through structure elements. Returns one of: + // - uint8_t CONTEXT TAG (keep iterating) + // - CHIP_ERROR (including CHIP_NO_ERROR) which should be a final + // return value (stop iterating) + EntryElement Next() { + if (!mEntered) { + VerifyOrReturnError(TLV::kTLVType_Structure == mReader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(mReader.EnterContainer(mOuter)); + mEntered = true; + } + + while (true) { + CHIP_ERROR err = mReader.Next(); + if (err != CHIP_NO_ERROR) { + VerifyOrReturnError(err == CHIP_ERROR_END_OF_TLV, err); + break; + } - // Ensure we have a single struct and that it's properly bounded. - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturnError(TLV::kTLVType_Structure == temp_reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(temp_reader.EnterContainer(outer)); - while ((err = temp_reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(temp_reader.GetTag())) - { + const TLV::Tag tag = mReader.GetTag(); + if (!TLV::IsContextTag(tag)) { continue; - } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(temp_reader.ExitContainer(outer)); + } - // Guaranteed to work due to prior checks. - VerifyOrDie(reader.EnterContainer(outer) == CHIP_NO_ERROR); - return CHIP_NO_ERROR; -} + // we know context tags are 8-bit + return static_cast(TLV::TagNumFromTag(tag)); + } -void ExitStructAfterDecode(TLV::TLVReader & reader, TLV::TLVType & outer) -{ - // Ensure we exit the container. Will be OK since FlightCheckDecodeAndEnterStruct will have - // already been called, and generated code properly iterates over entire container. - VerifyOrDie(reader.Next() == CHIP_END_OF_TLV); - VerifyOrDie(reader.ExitContainer(outer) == CHIP_NO_ERROR); -} + return mReader.ExitContainer(mOuter); + } + + private: + bool mEntered = false; + TLV::TLVType mOuter; + TLV::TLVReader &mReader; +}; // Structs shared across multiple clusters. namespace Structs { @@ -75,34 +85,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const{ {{#zcl_command_arguments}} ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}})); {{/zcl_command_arguments}} - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); + detail::StructDecodeIterator __iterator(reader); + while (true) { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { + return std::get(__element); + } + + {{#zcl_command_arguments~}} + {{#first}} + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) { - if (!TLV::IsContextTag(reader.GetTag())) + {{/first~}} + {{! NOTE: using if/else instead of switch because it seems to generate smaller code. ~}} + if (__context_tag == to_underlying(Fields::k{{asUpperCamelCase label}})) { - continue; + err = DataModel::Decode(reader, {{asLowerCamelCase label}}); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else + {{#last}} { - {{#zcl_command_arguments}} - case to_underlying(Fields::k{{asUpperCamelCase label}}): - ReturnErrorOnFailure(DataModel::Decode(reader, {{asLowerCamelCase label}})); - break; - {{/zcl_command_arguments}} - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + {{/last}} + {{/zcl_command_arguments}} + } } } // namespace {{asUpperCamelCase name}}. {{/zcl_commands}} @@ -114,14 +127,11 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader &reader, const Concret { {{#zcl_attributes_server}} case Attributes::{{asUpperCamelCase label}}::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, {{asLowerCamelCase label}})); - break; + return DataModel::Decode(reader, {{asLowerCamelCase label}}); {{/zcl_attributes_server}} default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -138,34 +148,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const{ ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase name}}), {{asLowerCamelCase name}})); {{/if_is_fabric_scoped_struct}} {{/zcl_event_fields}} - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader &reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); + detail::StructDecodeIterator __iterator(reader); + while (true) { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { + return std::get(__element); + } + + {{#zcl_event_fields}} + {{#first}} + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) { - if (!TLV::IsContextTag(reader.GetTag())) + {{/first~}} + {{! NOTE: using if/else instead of switch because it seems to generate smaller code. ~}} + if (__context_tag == to_underlying(Fields::k{{asUpperCamelCase name}})) { - continue; + err = DataModel::Decode(reader, {{asLowerCamelCase name}}); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else + {{#last}} { - {{#zcl_event_fields}} - case to_underlying(Fields::k{{asUpperCamelCase name}}): - ReturnErrorOnFailure(DataModel::Decode(reader, {{asLowerCamelCase name}})); - break; - {{/zcl_event_fields}} - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + {{/last}} + {{/zcl_event_fields}} + } } } // namespace {{asUpperCamelCase name}}. {{/zcl_events}} diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 1168a0a5b6953c..5f8a0c555c4c68 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -18,6 +18,7 @@ // THIS FILE IS GENERATED BY ZAP #include +#include namespace chip { namespace app { @@ -25,39 +26,54 @@ namespace Clusters { namespace detail { -CHIP_ERROR FlightCheckDecodeAndEnterStruct(TLV::TLVReader & reader, TLV::TLVType & outer) +class StructDecodeIterator { - TLV::TLVReader temp_reader; +public: + // may return a context tag, a CHIP_ERROR (end iteration) + using EntryElement = std::variant; - // Make a copy of the struct reader to do pre-checks. - temp_reader.Init(reader); + StructDecodeIterator(TLV::TLVReader & reader) : mReader(reader) {} - // Ensure we have a single struct and that it's properly bounded. - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturnError(TLV::kTLVType_Structure == temp_reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - ReturnErrorOnFailure(temp_reader.EnterContainer(outer)); - while ((err = temp_reader.Next()) == CHIP_NO_ERROR) + // Iterate through structure elements. Returns one of: + // - uint8_t CONTEXT TAG (keep iterating) + // - CHIP_ERROR (including CHIP_NO_ERROR) which should be a final + // return value (stop iterating) + EntryElement Next() { - if (!TLV::IsContextTag(temp_reader.GetTag())) + if (!mEntered) { - continue; + VerifyOrReturnError(TLV::kTLVType_Structure == mReader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(mReader.EnterContainer(mOuter)); + mEntered = true; } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(temp_reader.ExitContainer(outer)); - // Guaranteed to work due to prior checks. - VerifyOrDie(reader.EnterContainer(outer) == CHIP_NO_ERROR); - return CHIP_NO_ERROR; -} + while (true) + { + CHIP_ERROR err = mReader.Next(); + if (err != CHIP_NO_ERROR) + { + VerifyOrReturnError(err == CHIP_ERROR_END_OF_TLV, err); + break; + } -void ExitStructAfterDecode(TLV::TLVReader & reader, TLV::TLVType & outer) -{ - // Ensure we exit the container. Will be OK since FlightCheckDecodeAndEnterStruct will have - // already been called, and generated code properly iterates over entire container. - VerifyOrDie(reader.Next() == CHIP_END_OF_TLV); - VerifyOrDie(reader.ExitContainer(outer) == CHIP_NO_ERROR); -} + const TLV::Tag tag = mReader.GetTag(); + if (!TLV::IsContextTag(tag)) + { + continue; + } + + // we know context tags are 8-bit + return static_cast(TLV::TagNumFromTag(tag)); + } + + return mReader.ExitContainer(mOuter); + } + +private: + bool mEntered = false; + TLV::TLVType mOuter; + TLV::TLVReader & mReader; +}; // Structs shared across multiple clusters. namespace Structs { @@ -74,34 +90,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMfgCode)) + { + err = DataModel::Decode(reader, mfgCode); + } + else if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kMfgCode): - ReturnErrorOnFailure(DataModel::Decode(reader, mfgCode)); - break; - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ModeTagStruct @@ -119,37 +133,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else if (__context_tag == to_underlying(Fields::kMode)) + { + err = DataModel::Decode(reader, mode); + } + else if (__context_tag == to_underlying(Fields::kModeTags)) + { + err = DataModel::Decode(reader, modeTags); + } + else { - case to_underlying(Fields::kLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, label)); - break; - case to_underlying(Fields::kMode): - ReturnErrorOnFailure(DataModel::Decode(reader, mode)); - break; - case to_underlying(Fields::kModeTags): - ReturnErrorOnFailure(DataModel::Decode(reader, modeTags)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ModeOptionStruct @@ -166,34 +179,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCatalogVendorID)) { - continue; + err = DataModel::Decode(reader, catalogVendorID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kApplicationID)) + { + err = DataModel::Decode(reader, applicationID); + } + else { - case to_underlying(Fields::kCatalogVendorID): - ReturnErrorOnFailure(DataModel::Decode(reader, catalogVendorID)); - break; - case to_underlying(Fields::kApplicationID): - ReturnErrorOnFailure(DataModel::Decode(reader, applicationID)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ApplicationStruct @@ -211,37 +222,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kErrorStateID)) + { + err = DataModel::Decode(reader, errorStateID); + } + else if (__context_tag == to_underlying(Fields::kErrorStateLabel)) + { + err = DataModel::Decode(reader, errorStateLabel); + } + else if (__context_tag == to_underlying(Fields::kErrorStateDetails)) + { + err = DataModel::Decode(reader, errorStateDetails); + } + else { - case to_underlying(Fields::kErrorStateID): - ReturnErrorOnFailure(DataModel::Decode(reader, errorStateID)); - break; - case to_underlying(Fields::kErrorStateLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, errorStateLabel)); - break; - case to_underlying(Fields::kErrorStateDetails): - ReturnErrorOnFailure(DataModel::Decode(reader, errorStateDetails)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ErrorStateStruct @@ -258,34 +268,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, label)); - break; - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LabelStruct @@ -302,34 +310,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperationalStateID)) + { + err = DataModel::Decode(reader, operationalStateID); + } + else if (__context_tag == to_underlying(Fields::kOperationalStateLabel)) + { + err = DataModel::Decode(reader, operationalStateLabel); + } + else { - case to_underlying(Fields::kOperationalStateID): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalStateID)); - break; - case to_underlying(Fields::kOperationalStateLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalStateLabel)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationalStateStruct @@ -345,34 +351,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIdentifyTime), identifyTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIdentifyTime)) + { + err = DataModel::Decode(reader, identifyTime); + } + else { - case to_underlying(Fields::kIdentifyTime): - ReturnErrorOnFailure(DataModel::Decode(reader, identifyTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Identify. namespace TriggerEffect { @@ -382,37 +387,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEffectIdentifier), effectIdentifier)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEffectVariant), effectVariant)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEffectIdentifier)) { - continue; + err = DataModel::Decode(reader, effectIdentifier); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kEffectVariant)) + { + err = DataModel::Decode(reader, effectVariant); + } + else { - case to_underlying(Fields::kEffectIdentifier): - ReturnErrorOnFailure(DataModel::Decode(reader, effectIdentifier)); - break; - case to_underlying(Fields::kEffectVariant): - ReturnErrorOnFailure(DataModel::Decode(reader, effectVariant)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TriggerEffect. } // namespace Commands @@ -423,34 +428,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::IdentifyTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, identifyTime)); - break; + return DataModel::Decode(reader, identifyTime); case Attributes::IdentifyType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, identifyType)); - break; + return DataModel::Decode(reader, identifyType); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -467,37 +462,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupName), groupName)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kGroupName)) + { + err = DataModel::Decode(reader, groupName); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kGroupName): - ReturnErrorOnFailure(DataModel::Decode(reader, groupName)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddGroup. namespace AddGroupResponse { @@ -507,37 +502,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddGroupResponse. namespace ViewGroup { @@ -546,34 +541,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ViewGroup. namespace ViewGroupResponse { @@ -584,40 +578,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupName), groupName)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kGroupName)) + { + err = DataModel::Decode(reader, groupName); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kGroupName): - ReturnErrorOnFailure(DataModel::Decode(reader, groupName)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ViewGroupResponse. namespace GetGroupMembership { @@ -626,34 +621,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupList), groupList)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupList)) + { + err = DataModel::Decode(reader, groupList); + } + else { - case to_underlying(Fields::kGroupList): - ReturnErrorOnFailure(DataModel::Decode(reader, groupList)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetGroupMembership. namespace GetGroupMembershipResponse { @@ -663,37 +657,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCapacity), capacity)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupList), groupList)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCapacity)) + { + err = DataModel::Decode(reader, capacity); + } + else if (__context_tag == to_underlying(Fields::kGroupList)) + { + err = DataModel::Decode(reader, groupList); + } + else { - case to_underlying(Fields::kCapacity): - ReturnErrorOnFailure(DataModel::Decode(reader, capacity)); - break; - case to_underlying(Fields::kGroupList): - ReturnErrorOnFailure(DataModel::Decode(reader, groupList)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetGroupMembershipResponse. namespace RemoveGroup { @@ -702,34 +696,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) { - continue; + err = DataModel::Decode(reader, groupID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveGroup. namespace RemoveGroupResponse { @@ -739,37 +732,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveGroupResponse. namespace RemoveAllGroups { @@ -777,31 +770,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace RemoveAllGroups. namespace AddGroupIfIdentifying { @@ -811,37 +793,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupName), groupName)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kGroupName)) + { + err = DataModel::Decode(reader, groupName); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kGroupName): - ReturnErrorOnFailure(DataModel::Decode(reader, groupName)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddGroupIfIdentifying. } // namespace Commands @@ -852,31 +834,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::NameSupport::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nameSupport)); - break; + return DataModel::Decode(reader, nameSupport); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -898,34 +871,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAttributeID)) + { + err = DataModel::Decode(reader, attributeID); + } + else if (__context_tag == to_underlying(Fields::kAttributeValue)) + { + err = DataModel::Decode(reader, attributeValue); + } + else { - case to_underlying(Fields::kAttributeID): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeID)); - break; - case to_underlying(Fields::kAttributeValue): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeValue)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AttributeValuePair @@ -942,34 +913,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kClusterID)) { - continue; + err = DataModel::Decode(reader, clusterID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kAttributeValueList)) + { + err = DataModel::Decode(reader, attributeValueList); + } + else { - case to_underlying(Fields::kClusterID): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterID)); - break; - case to_underlying(Fields::kAttributeValueList): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeValueList)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ExtensionFieldSet @@ -986,46 +955,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneName), sceneName)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExtensionFieldSets), extensionFieldSets)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kSceneName)) + { + err = DataModel::Decode(reader, sceneName); + } + else if (__context_tag == to_underlying(Fields::kExtensionFieldSets)) + { + err = DataModel::Decode(reader, extensionFieldSets); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kSceneName): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneName)); - break; - case to_underlying(Fields::kExtensionFieldSets): - ReturnErrorOnFailure(DataModel::Decode(reader, extensionFieldSets)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddScene. namespace AddSceneResponse { @@ -1036,40 +1008,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddSceneResponse. namespace ViewScene { @@ -1079,37 +1052,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ViewScene. namespace ViewSceneResponse { @@ -1123,49 +1096,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneName), sceneName)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExtensionFieldSets), extensionFieldSets)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kSceneName)) + { + err = DataModel::Decode(reader, sceneName); + } + else if (__context_tag == to_underlying(Fields::kExtensionFieldSets)) + { + err = DataModel::Decode(reader, extensionFieldSets); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kSceneName): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneName)); - break; - case to_underlying(Fields::kExtensionFieldSets): - ReturnErrorOnFailure(DataModel::Decode(reader, extensionFieldSets)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ViewSceneResponse. namespace RemoveScene { @@ -1175,37 +1152,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveScene. namespace RemoveSceneResponse { @@ -1216,40 +1193,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveSceneResponse. namespace RemoveAllScenes { @@ -1258,34 +1236,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveAllScenes. namespace RemoveAllScenesResponse { @@ -1295,37 +1272,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveAllScenesResponse. namespace StoreScene { @@ -1335,37 +1312,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StoreScene. namespace StoreSceneResponse { @@ -1376,40 +1353,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StoreSceneResponse. namespace RecallScene { @@ -1420,40 +1398,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RecallScene. namespace GetSceneMembership { @@ -1462,34 +1441,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetSceneMembership. namespace GetSceneMembershipResponse { @@ -1501,43 +1479,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCapacity), capacity)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneList), sceneList)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kCapacity)) + { + err = DataModel::Decode(reader, capacity); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneList)) + { + err = DataModel::Decode(reader, sceneList); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kCapacity): - ReturnErrorOnFailure(DataModel::Decode(reader, capacity)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneList): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneList)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetSceneMembershipResponse. namespace EnhancedAddScene { @@ -1550,46 +1530,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneName), sceneName)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExtensionFieldSets), extensionFieldSets)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kSceneName)) + { + err = DataModel::Decode(reader, sceneName); + } + else if (__context_tag == to_underlying(Fields::kExtensionFieldSets)) + { + err = DataModel::Decode(reader, extensionFieldSets); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kSceneName): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneName)); - break; - case to_underlying(Fields::kExtensionFieldSets): - ReturnErrorOnFailure(DataModel::Decode(reader, extensionFieldSets)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedAddScene. namespace EnhancedAddSceneResponse { @@ -1600,40 +1583,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedAddSceneResponse. namespace EnhancedViewScene { @@ -1643,37 +1627,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupID), groupID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneID), sceneID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else { - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedViewScene. namespace EnhancedViewSceneResponse { @@ -1687,49 +1671,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneName), sceneName)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExtensionFieldSets), extensionFieldSets)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupID)) + { + err = DataModel::Decode(reader, groupID); + } + else if (__context_tag == to_underlying(Fields::kSceneID)) + { + err = DataModel::Decode(reader, sceneID); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kSceneName)) + { + err = DataModel::Decode(reader, sceneName); + } + else if (__context_tag == to_underlying(Fields::kExtensionFieldSets)) + { + err = DataModel::Decode(reader, extensionFieldSets); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupID)); - break; - case to_underlying(Fields::kSceneID): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneID)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kSceneName): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneName)); - break; - case to_underlying(Fields::kExtensionFieldSets): - ReturnErrorOnFailure(DataModel::Decode(reader, extensionFieldSets)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedViewSceneResponse. namespace CopyScene { @@ -1742,46 +1730,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneIdentifierFrom), sceneIdentifierFrom)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupIdentifierTo), groupIdentifierTo)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneIdentifierTo), sceneIdentifierTo)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMode)) + { + err = DataModel::Decode(reader, mode); + } + else if (__context_tag == to_underlying(Fields::kGroupIdentifierFrom)) + { + err = DataModel::Decode(reader, groupIdentifierFrom); + } + else if (__context_tag == to_underlying(Fields::kSceneIdentifierFrom)) + { + err = DataModel::Decode(reader, sceneIdentifierFrom); + } + else if (__context_tag == to_underlying(Fields::kGroupIdentifierTo)) + { + err = DataModel::Decode(reader, groupIdentifierTo); + } + else if (__context_tag == to_underlying(Fields::kSceneIdentifierTo)) + { + err = DataModel::Decode(reader, sceneIdentifierTo); + } + else { - case to_underlying(Fields::kMode): - ReturnErrorOnFailure(DataModel::Decode(reader, mode)); - break; - case to_underlying(Fields::kGroupIdentifierFrom): - ReturnErrorOnFailure(DataModel::Decode(reader, groupIdentifierFrom)); - break; - case to_underlying(Fields::kSceneIdentifierFrom): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneIdentifierFrom)); - break; - case to_underlying(Fields::kGroupIdentifierTo): - ReturnErrorOnFailure(DataModel::Decode(reader, groupIdentifierTo)); - break; - case to_underlying(Fields::kSceneIdentifierTo): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneIdentifierTo)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CopyScene. namespace CopySceneResponse { @@ -1792,40 +1783,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupIdentifierFrom), groupIdentifierFrom)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSceneIdentifierFrom), sceneIdentifierFrom)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kGroupIdentifierFrom)) + { + err = DataModel::Decode(reader, groupIdentifierFrom); + } + else if (__context_tag == to_underlying(Fields::kSceneIdentifierFrom)) + { + err = DataModel::Decode(reader, sceneIdentifierFrom); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kGroupIdentifierFrom): - ReturnErrorOnFailure(DataModel::Decode(reader, groupIdentifierFrom)); - break; - case to_underlying(Fields::kSceneIdentifierFrom): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneIdentifierFrom)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CopySceneResponse. } // namespace Commands @@ -1836,52 +1828,36 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SceneCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneCount)); - break; + return DataModel::Decode(reader, sceneCount); case Attributes::CurrentScene::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentScene)); - break; + return DataModel::Decode(reader, currentScene); case Attributes::CurrentGroup::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentGroup)); - break; + return DataModel::Decode(reader, currentGroup); case Attributes::SceneValid::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneValid)); - break; + return DataModel::Decode(reader, sceneValid); case Attributes::NameSupport::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nameSupport)); - break; + return DataModel::Decode(reader, nameSupport); case Attributes::LastConfiguredBy::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lastConfiguredBy)); - break; + return DataModel::Decode(reader, lastConfiguredBy); case Attributes::SceneTableSize::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, sceneTableSize)); - break; + return DataModel::Decode(reader, sceneTableSize); case Attributes::RemainingCapacity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, remainingCapacity)); - break; + return DataModel::Decode(reader, remainingCapacity); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -1896,31 +1872,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Off. namespace On { @@ -1928,31 +1893,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace On. namespace Toggle { @@ -1960,31 +1914,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Toggle. namespace OffWithEffect { @@ -1994,37 +1937,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEffectIdentifier), effectIdentifier)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEffectVariant), effectVariant)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEffectIdentifier)) + { + err = DataModel::Decode(reader, effectIdentifier); + } + else if (__context_tag == to_underlying(Fields::kEffectVariant)) + { + err = DataModel::Decode(reader, effectVariant); + } + else { - case to_underlying(Fields::kEffectIdentifier): - ReturnErrorOnFailure(DataModel::Decode(reader, effectIdentifier)); - break; - case to_underlying(Fields::kEffectVariant): - ReturnErrorOnFailure(DataModel::Decode(reader, effectVariant)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OffWithEffect. namespace OnWithRecallGlobalScene { @@ -2032,31 +1975,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace OnWithRecallGlobalScene. namespace OnWithTimedOff { @@ -2067,40 +1999,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOnOffControl), onOffControl)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOnTime), onTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOffWaitTime), offWaitTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOnOffControl)) + { + err = DataModel::Decode(reader, onOffControl); + } + else if (__context_tag == to_underlying(Fields::kOnTime)) + { + err = DataModel::Decode(reader, onTime); + } + else if (__context_tag == to_underlying(Fields::kOffWaitTime)) + { + err = DataModel::Decode(reader, offWaitTime); + } + else { - case to_underlying(Fields::kOnOffControl): - ReturnErrorOnFailure(DataModel::Decode(reader, onOffControl)); - break; - case to_underlying(Fields::kOnTime): - ReturnErrorOnFailure(DataModel::Decode(reader, onTime)); - break; - case to_underlying(Fields::kOffWaitTime): - ReturnErrorOnFailure(DataModel::Decode(reader, offWaitTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OnWithTimedOff. } // namespace Commands @@ -2111,43 +2044,30 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::OnOff::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onOff)); - break; + return DataModel::Decode(reader, onOff); case Attributes::GlobalSceneControl::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, globalSceneControl)); - break; + return DataModel::Decode(reader, globalSceneControl); case Attributes::OnTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onTime)); - break; + return DataModel::Decode(reader, onTime); case Attributes::OffWaitTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, offWaitTime)); - break; + return DataModel::Decode(reader, offWaitTime); case Attributes::StartUpOnOff::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpOnOff)); - break; + return DataModel::Decode(reader, startUpOnOff); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -2164,34 +2084,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SwitchType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, switchType)); - break; + return DataModel::Decode(reader, switchType); case Attributes::SwitchActions::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, switchActions)); - break; + return DataModel::Decode(reader, switchActions); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -2210,43 +2120,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLevel)) + { + err = DataModel::Decode(reader, level); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, level)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToLevel. namespace Move { @@ -2258,43 +2170,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRate), rate)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMoveMode)) + { + err = DataModel::Decode(reader, moveMode); + } + else if (__context_tag == to_underlying(Fields::kRate)) + { + err = DataModel::Decode(reader, rate); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kMoveMode): - ReturnErrorOnFailure(DataModel::Decode(reader, moveMode)); - break; - case to_underlying(Fields::kRate): - ReturnErrorOnFailure(DataModel::Decode(reader, rate)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Move. namespace Step { @@ -2307,46 +2221,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepMode)) + { + err = DataModel::Decode(reader, stepMode); + } + else if (__context_tag == to_underlying(Fields::kStepSize)) + { + err = DataModel::Decode(reader, stepSize); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepMode): - ReturnErrorOnFailure(DataModel::Decode(reader, stepMode)); - break; - case to_underlying(Fields::kStepSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stepSize)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Step. namespace Stop { @@ -2356,37 +2273,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Stop. namespace MoveToLevelWithOnOff { @@ -2398,43 +2315,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLevel)) { - continue; + err = DataModel::Decode(reader, level); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, level)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToLevelWithOnOff. namespace MoveWithOnOff { @@ -2446,43 +2365,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRate), rate)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMoveMode)) + { + err = DataModel::Decode(reader, moveMode); + } + else if (__context_tag == to_underlying(Fields::kRate)) + { + err = DataModel::Decode(reader, rate); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kMoveMode): - ReturnErrorOnFailure(DataModel::Decode(reader, moveMode)); - break; - case to_underlying(Fields::kRate): - ReturnErrorOnFailure(DataModel::Decode(reader, rate)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveWithOnOff. namespace StepWithOnOff { @@ -2495,46 +2416,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepMode)) + { + err = DataModel::Decode(reader, stepMode); + } + else if (__context_tag == to_underlying(Fields::kStepSize)) + { + err = DataModel::Decode(reader, stepSize); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepMode): - ReturnErrorOnFailure(DataModel::Decode(reader, stepMode)); - break; - case to_underlying(Fields::kStepSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stepSize)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StepWithOnOff. namespace StopWithOnOff { @@ -2544,37 +2468,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOptionsMask)) { - continue; + err = DataModel::Decode(reader, optionsMask); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StopWithOnOff. namespace MoveToClosestFrequency { @@ -2583,34 +2507,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFrequency), frequency)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFrequency)) + { + err = DataModel::Decode(reader, frequency); + } + else { - case to_underlying(Fields::kFrequency): - ReturnErrorOnFailure(DataModel::Decode(reader, frequency)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToClosestFrequency. } // namespace Commands @@ -2621,70 +2544,48 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::CurrentLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentLevel)); - break; + return DataModel::Decode(reader, currentLevel); case Attributes::RemainingTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, remainingTime)); - break; + return DataModel::Decode(reader, remainingTime); case Attributes::MinLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minLevel)); - break; + return DataModel::Decode(reader, minLevel); case Attributes::MaxLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxLevel)); - break; + return DataModel::Decode(reader, maxLevel); case Attributes::CurrentFrequency::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentFrequency)); - break; + return DataModel::Decode(reader, currentFrequency); case Attributes::MinFrequency::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minFrequency)); - break; + return DataModel::Decode(reader, minFrequency); case Attributes::MaxFrequency::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxFrequency)); - break; + return DataModel::Decode(reader, maxFrequency); case Attributes::Options::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, options)); - break; + return DataModel::Decode(reader, options); case Attributes::OnOffTransitionTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onOffTransitionTime)); - break; + return DataModel::Decode(reader, onOffTransitionTime); case Attributes::OnLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onLevel)); - break; + return DataModel::Decode(reader, onLevel); case Attributes::OnTransitionTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onTransitionTime)); - break; + return DataModel::Decode(reader, onTransitionTime); case Attributes::OffTransitionTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, offTransitionTime)); - break; + return DataModel::Decode(reader, offTransitionTime); case Attributes::DefaultMoveRate::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, defaultMoveRate)); - break; + return DataModel::Decode(reader, defaultMoveRate); case Attributes::StartUpCurrentLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpCurrentLevel)); - break; + return DataModel::Decode(reader, startUpCurrentLevel); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -2701,55 +2602,38 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::ActiveText::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeText)); - break; + return DataModel::Decode(reader, activeText); case Attributes::Description::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, description)); - break; + return DataModel::Decode(reader, description); case Attributes::InactiveText::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, inactiveText)); - break; + return DataModel::Decode(reader, inactiveText); case Attributes::OutOfService::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, outOfService)); - break; + return DataModel::Decode(reader, outOfService); case Attributes::Polarity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, polarity)); - break; + return DataModel::Decode(reader, polarity); case Attributes::PresentValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, presentValue)); - break; + return DataModel::Decode(reader, presentValue); case Attributes::Reliability::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reliability)); - break; + return DataModel::Decode(reader, reliability); case Attributes::StatusFlags::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, statusFlags)); - break; + return DataModel::Decode(reader, statusFlags); case Attributes::ApplicationType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, applicationType)); - break; + return DataModel::Decode(reader, applicationType); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -2766,28 +2650,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -2809,34 +2685,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDeviceType)) + { + err = DataModel::Decode(reader, deviceType); + } + else if (__context_tag == to_underlying(Fields::kRevision)) + { + err = DataModel::Decode(reader, revision); + } + else { - case to_underlying(Fields::kDeviceType): - ReturnErrorOnFailure(DataModel::Decode(reader, deviceType)); - break; - case to_underlying(Fields::kRevision): - ReturnErrorOnFailure(DataModel::Decode(reader, revision)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DeviceTypeStruct @@ -2855,40 +2729,40 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMfgCode)) + { + err = DataModel::Decode(reader, mfgCode); + } + else if (__context_tag == to_underlying(Fields::kNamespaceID)) + { + err = DataModel::Decode(reader, namespaceID); + } + else if (__context_tag == to_underlying(Fields::kTag)) + { + err = DataModel::Decode(reader, tag); + } + else if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else { - case to_underlying(Fields::kMfgCode): - ReturnErrorOnFailure(DataModel::Decode(reader, mfgCode)); - break; - case to_underlying(Fields::kNamespaceID): - ReturnErrorOnFailure(DataModel::Decode(reader, namespaceID)); - break; - case to_underlying(Fields::kTag): - ReturnErrorOnFailure(DataModel::Decode(reader, tag)); - break; - case to_underlying(Fields::kLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, label)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SemanticTagStruct @@ -2902,43 +2776,30 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::DeviceTypeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, deviceTypeList)); - break; + return DataModel::Decode(reader, deviceTypeList); case Attributes::ServerList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, serverList)); - break; + return DataModel::Decode(reader, serverList); case Attributes::ClientList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clientList)); - break; + return DataModel::Decode(reader, clientList); case Attributes::PartsList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, partsList)); - break; + return DataModel::Decode(reader, partsList); case Attributes::TagList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, tagList)); - break; + return DataModel::Decode(reader, tagList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -2976,43 +2837,44 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNode)) + { + err = DataModel::Decode(reader, node); + } + else if (__context_tag == to_underlying(Fields::kGroup)) + { + err = DataModel::Decode(reader, group); + } + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else if (__context_tag == to_underlying(Fields::kCluster)) + { + err = DataModel::Decode(reader, cluster); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kNode): - ReturnErrorOnFailure(DataModel::Decode(reader, node)); - break; - case to_underlying(Fields::kGroup): - ReturnErrorOnFailure(DataModel::Decode(reader, group)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - case to_underlying(Fields::kCluster): - ReturnErrorOnFailure(DataModel::Decode(reader, cluster)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TargetStruct @@ -3026,31 +2888,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Binding::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, binding)); - break; + return DataModel::Decode(reader, binding); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -3073,37 +2926,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCluster)) { - continue; + err = DataModel::Decode(reader, cluster); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else if (__context_tag == to_underlying(Fields::kDeviceType)) + { + err = DataModel::Decode(reader, deviceType); + } + else { - case to_underlying(Fields::kCluster): - ReturnErrorOnFailure(DataModel::Decode(reader, cluster)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - case to_underlying(Fields::kDeviceType): - ReturnErrorOnFailure(DataModel::Decode(reader, deviceType)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AccessControlTargetStruct @@ -3149,43 +3001,44 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPrivilege)) + { + err = DataModel::Decode(reader, privilege); + } + else if (__context_tag == to_underlying(Fields::kAuthMode)) + { + err = DataModel::Decode(reader, authMode); + } + else if (__context_tag == to_underlying(Fields::kSubjects)) + { + err = DataModel::Decode(reader, subjects); + } + else if (__context_tag == to_underlying(Fields::kTargets)) + { + err = DataModel::Decode(reader, targets); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kPrivilege): - ReturnErrorOnFailure(DataModel::Decode(reader, privilege)); - break; - case to_underlying(Fields::kAuthMode): - ReturnErrorOnFailure(DataModel::Decode(reader, authMode)); - break; - case to_underlying(Fields::kSubjects): - ReturnErrorOnFailure(DataModel::Decode(reader, subjects)); - break; - case to_underlying(Fields::kTargets): - ReturnErrorOnFailure(DataModel::Decode(reader, targets)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AccessControlEntryStruct @@ -3219,35 +3072,33 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kData)) { - continue; + err = DataModel::Decode(reader, data); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; -} + ReturnErrorOnFailure(err); + } +} } // namespace AccessControlExtensionStruct } // namespace Structs @@ -3260,43 +3111,30 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Acl::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acl)); - break; + return DataModel::Decode(reader, acl); case Attributes::Extension::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, extension)); - break; + return DataModel::Decode(reader, extension); case Attributes::SubjectsPerAccessControlEntry::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, subjectsPerAccessControlEntry)); - break; + return DataModel::Decode(reader, subjectsPerAccessControlEntry); case Attributes::TargetsPerAccessControlEntry::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, targetsPerAccessControlEntry)); - break; + return DataModel::Decode(reader, targetsPerAccessControlEntry); case Attributes::AccessControlEntriesPerFabric::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, accessControlEntriesPerFabric)); - break; + return DataModel::Decode(reader, accessControlEntriesPerFabric); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -3311,46 +3149,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kChangeType), changeType)); ReturnErrorOnFailure(DataModel::EncodeForRead(aWriter, TLV::ContextTag(Fields::kLatestValue), GetFabricIndex(), latestValue)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAdminNodeID)) + { + err = DataModel::Decode(reader, adminNodeID); + } + else if (__context_tag == to_underlying(Fields::kAdminPasscodeID)) + { + err = DataModel::Decode(reader, adminPasscodeID); + } + else if (__context_tag == to_underlying(Fields::kChangeType)) + { + err = DataModel::Decode(reader, changeType); + } + else if (__context_tag == to_underlying(Fields::kLatestValue)) + { + err = DataModel::Decode(reader, latestValue); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kAdminNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, adminNodeID)); - break; - case to_underlying(Fields::kAdminPasscodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, adminPasscodeID)); - break; - case to_underlying(Fields::kChangeType): - ReturnErrorOnFailure(DataModel::Decode(reader, changeType)); - break; - case to_underlying(Fields::kLatestValue): - ReturnErrorOnFailure(DataModel::Decode(reader, latestValue)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AccessControlEntryChanged. namespace AccessControlExtensionChanged { @@ -3363,46 +3204,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kChangeType), changeType)); ReturnErrorOnFailure(DataModel::EncodeForRead(aWriter, TLV::ContextTag(Fields::kLatestValue), GetFabricIndex(), latestValue)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAdminNodeID)) + { + err = DataModel::Decode(reader, adminNodeID); + } + else if (__context_tag == to_underlying(Fields::kAdminPasscodeID)) + { + err = DataModel::Decode(reader, adminPasscodeID); + } + else if (__context_tag == to_underlying(Fields::kChangeType)) + { + err = DataModel::Decode(reader, changeType); + } + else if (__context_tag == to_underlying(Fields::kLatestValue)) + { + err = DataModel::Decode(reader, latestValue); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kAdminNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, adminNodeID)); - break; - case to_underlying(Fields::kAdminPasscodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, adminPasscodeID)); - break; - case to_underlying(Fields::kChangeType): - ReturnErrorOnFailure(DataModel::Decode(reader, changeType)); - break; - case to_underlying(Fields::kLatestValue): - ReturnErrorOnFailure(DataModel::Decode(reader, latestValue)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AccessControlExtensionChanged. } // namespace Events @@ -3427,46 +3271,48 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kType)) + { + err = DataModel::Decode(reader, type); + } + else if (__context_tag == to_underlying(Fields::kEndpointListID)) + { + err = DataModel::Decode(reader, endpointListID); + } + else if (__context_tag == to_underlying(Fields::kSupportedCommands)) + { + err = DataModel::Decode(reader, supportedCommands); + } + else if (__context_tag == to_underlying(Fields::kState)) + { + err = DataModel::Decode(reader, state); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kType): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; - case to_underlying(Fields::kEndpointListID): - ReturnErrorOnFailure(DataModel::Decode(reader, endpointListID)); - break; - case to_underlying(Fields::kSupportedCommands): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedCommands)); - break; - case to_underlying(Fields::kState): - ReturnErrorOnFailure(DataModel::Decode(reader, state)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ActionStruct @@ -3485,40 +3331,40 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEndpointListID)) { - continue; + err = DataModel::Decode(reader, endpointListID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kType)) + { + err = DataModel::Decode(reader, type); + } + else if (__context_tag == to_underlying(Fields::kEndpoints)) + { + err = DataModel::Decode(reader, endpoints); + } + else { - case to_underlying(Fields::kEndpointListID): - ReturnErrorOnFailure(DataModel::Decode(reader, endpointListID)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kType): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; - case to_underlying(Fields::kEndpoints): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoints)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EndpointListStruct @@ -3532,37 +3378,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace InstantAction. namespace InstantActionWithTransition { @@ -3573,40 +3419,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) { - continue; + err = DataModel::Decode(reader, actionID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace InstantActionWithTransition. namespace StartAction { @@ -3616,37 +3463,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) { - continue; + err = DataModel::Decode(reader, actionID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StartAction. namespace StartActionWithDuration { @@ -3657,40 +3504,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDuration), duration)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kDuration)) + { + err = DataModel::Decode(reader, duration); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kDuration): - ReturnErrorOnFailure(DataModel::Decode(reader, duration)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StartActionWithDuration. namespace StopAction { @@ -3700,37 +3548,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StopAction. namespace PauseAction { @@ -3740,37 +3588,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace PauseAction. namespace PauseActionWithDuration { @@ -3781,40 +3629,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDuration), duration)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kDuration)) + { + err = DataModel::Decode(reader, duration); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kDuration): - ReturnErrorOnFailure(DataModel::Decode(reader, duration)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace PauseActionWithDuration. namespace ResumeAction { @@ -3824,37 +3673,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ResumeAction. namespace EnableAction { @@ -3864,37 +3713,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) { - continue; + err = DataModel::Decode(reader, actionID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnableAction. namespace EnableActionWithDuration { @@ -3905,40 +3754,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDuration), duration)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kDuration)) + { + err = DataModel::Decode(reader, duration); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kDuration): - ReturnErrorOnFailure(DataModel::Decode(reader, duration)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnableActionWithDuration. namespace DisableAction { @@ -3948,37 +3798,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DisableAction. namespace DisableActionWithDuration { @@ -3989,40 +3839,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDuration), duration)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) + { + err = DataModel::Decode(reader, actionID); + } + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kDuration)) + { + err = DataModel::Decode(reader, duration); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kDuration): - ReturnErrorOnFailure(DataModel::Decode(reader, duration)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DisableActionWithDuration. } // namespace Commands @@ -4033,37 +3884,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::ActionList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, actionList)); - break; + return DataModel::Decode(reader, actionList); case Attributes::EndpointLists::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, endpointLists)); - break; + return DataModel::Decode(reader, endpointLists); case Attributes::SetupURL::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, setupURL)); - break; + return DataModel::Decode(reader, setupURL); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -4076,40 +3916,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kActionID), actionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewState), newState)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) { - continue; + err = DataModel::Decode(reader, actionID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kNewState)) + { + err = DataModel::Decode(reader, newState); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kNewState): - ReturnErrorOnFailure(DataModel::Decode(reader, newState)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StateChanged. namespace ActionFailed { @@ -4121,43 +3962,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInvokeID), invokeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewState), newState)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kError), error)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActionID)) { - continue; + err = DataModel::Decode(reader, actionID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kInvokeID)) + { + err = DataModel::Decode(reader, invokeID); + } + else if (__context_tag == to_underlying(Fields::kNewState)) + { + err = DataModel::Decode(reader, newState); + } + else if (__context_tag == to_underlying(Fields::kError)) + { + err = DataModel::Decode(reader, error); + } + else { - case to_underlying(Fields::kActionID): - ReturnErrorOnFailure(DataModel::Decode(reader, actionID)); - break; - case to_underlying(Fields::kInvokeID): - ReturnErrorOnFailure(DataModel::Decode(reader, invokeID)); - break; - case to_underlying(Fields::kNewState): - ReturnErrorOnFailure(DataModel::Decode(reader, newState)); - break; - case to_underlying(Fields::kError): - ReturnErrorOnFailure(DataModel::Decode(reader, error)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ActionFailed. } // namespace Events @@ -4178,34 +4021,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCaseSessionsPerFabric)) { - continue; + err = DataModel::Decode(reader, caseSessionsPerFabric); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kSubscriptionsPerFabric)) + { + err = DataModel::Decode(reader, subscriptionsPerFabric); + } + else { - case to_underlying(Fields::kCaseSessionsPerFabric): - ReturnErrorOnFailure(DataModel::Decode(reader, caseSessionsPerFabric)); - break; - case to_underlying(Fields::kSubscriptionsPerFabric): - ReturnErrorOnFailure(DataModel::Decode(reader, subscriptionsPerFabric)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CapabilityMinimaStruct @@ -4222,34 +4063,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFinish)) + { + err = DataModel::Decode(reader, finish); + } + else if (__context_tag == to_underlying(Fields::kPrimaryColor)) + { + err = DataModel::Decode(reader, primaryColor); + } + else { - case to_underlying(Fields::kFinish): - ReturnErrorOnFailure(DataModel::Decode(reader, finish)); - break; - case to_underlying(Fields::kPrimaryColor): - ReturnErrorOnFailure(DataModel::Decode(reader, primaryColor)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ProductAppearanceStruct @@ -4261,31 +4100,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace MfgSpecificPing. } // namespace Commands @@ -4296,91 +4124,62 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::DataModelRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dataModelRevision)); - break; + return DataModel::Decode(reader, dataModelRevision); case Attributes::VendorName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorName)); - break; + return DataModel::Decode(reader, vendorName); case Attributes::VendorID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorID)); - break; + return DataModel::Decode(reader, vendorID); case Attributes::ProductName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productName)); - break; + return DataModel::Decode(reader, productName); case Attributes::ProductID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productID)); - break; + return DataModel::Decode(reader, productID); case Attributes::NodeLabel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nodeLabel)); - break; + return DataModel::Decode(reader, nodeLabel); case Attributes::Location::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, location)); - break; + return DataModel::Decode(reader, location); case Attributes::HardwareVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersion)); - break; + return DataModel::Decode(reader, hardwareVersion); case Attributes::HardwareVersionString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersionString)); - break; + return DataModel::Decode(reader, hardwareVersionString); case Attributes::SoftwareVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; + return DataModel::Decode(reader, softwareVersion); case Attributes::SoftwareVersionString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersionString)); - break; + return DataModel::Decode(reader, softwareVersionString); case Attributes::ManufacturingDate::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, manufacturingDate)); - break; + return DataModel::Decode(reader, manufacturingDate); case Attributes::PartNumber::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, partNumber)); - break; + return DataModel::Decode(reader, partNumber); case Attributes::ProductURL::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productURL)); - break; + return DataModel::Decode(reader, productURL); case Attributes::ProductLabel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productLabel)); - break; + return DataModel::Decode(reader, productLabel); case Attributes::SerialNumber::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, serialNumber)); - break; + return DataModel::Decode(reader, serialNumber); case Attributes::LocalConfigDisabled::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, localConfigDisabled)); - break; + return DataModel::Decode(reader, localConfigDisabled); case Attributes::Reachable::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reachable)); - break; + return DataModel::Decode(reader, reachable); case Attributes::UniqueID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uniqueID)); - break; + return DataModel::Decode(reader, uniqueID); case Attributes::CapabilityMinima::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, capabilityMinima)); - break; + return DataModel::Decode(reader, capabilityMinima); case Attributes::ProductAppearance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productAppearance)); - break; + return DataModel::Decode(reader, productAppearance); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -4391,34 +4190,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSoftwareVersion), softwareVersion)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else { - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StartUp. namespace ShutDown { @@ -4426,31 +4224,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ShutDown. namespace Leave { @@ -4459,34 +4246,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Leave. namespace ReachableChanged { @@ -4495,34 +4281,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReachableNewValue), reachableNewValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReachableNewValue)) + { + err = DataModel::Decode(reader, reachableNewValue); + } + else { - case to_underlying(Fields::kReachableNewValue): - ReturnErrorOnFailure(DataModel::Decode(reader, reachableNewValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ReachableChanged. } // namespace Events @@ -4544,55 +4329,61 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocation), location)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRequestorCanConsent), requestorCanConsent)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMetadataForProvider), metadataForProvider)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kVendorID)) + { + err = DataModel::Decode(reader, vendorID); + } + else if (__context_tag == to_underlying(Fields::kProductID)) + { + err = DataModel::Decode(reader, productID); + } + else if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else if (__context_tag == to_underlying(Fields::kProtocolsSupported)) + { + err = DataModel::Decode(reader, protocolsSupported); + } + else if (__context_tag == to_underlying(Fields::kHardwareVersion)) + { + err = DataModel::Decode(reader, hardwareVersion); + } + else if (__context_tag == to_underlying(Fields::kLocation)) + { + err = DataModel::Decode(reader, location); + } + else if (__context_tag == to_underlying(Fields::kRequestorCanConsent)) + { + err = DataModel::Decode(reader, requestorCanConsent); + } + else if (__context_tag == to_underlying(Fields::kMetadataForProvider)) + { + err = DataModel::Decode(reader, metadataForProvider); + } + else { - case to_underlying(Fields::kVendorID): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorID)); - break; - case to_underlying(Fields::kProductID): - ReturnErrorOnFailure(DataModel::Decode(reader, productID)); - break; - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - case to_underlying(Fields::kProtocolsSupported): - ReturnErrorOnFailure(DataModel::Decode(reader, protocolsSupported)); - break; - case to_underlying(Fields::kHardwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersion)); - break; - case to_underlying(Fields::kLocation): - ReturnErrorOnFailure(DataModel::Decode(reader, location)); - break; - case to_underlying(Fields::kRequestorCanConsent): - ReturnErrorOnFailure(DataModel::Decode(reader, requestorCanConsent)); - break; - case to_underlying(Fields::kMetadataForProvider): - ReturnErrorOnFailure(DataModel::Decode(reader, metadataForProvider)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace QueryImage. namespace QueryImageResponse { @@ -4608,55 +4399,61 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUpdateToken), updateToken)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserConsentNeeded), userConsentNeeded)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMetadataForRequestor), metadataForRequestor)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kDelayedActionTime)) + { + err = DataModel::Decode(reader, delayedActionTime); + } + else if (__context_tag == to_underlying(Fields::kImageURI)) + { + err = DataModel::Decode(reader, imageURI); + } + else if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else if (__context_tag == to_underlying(Fields::kSoftwareVersionString)) + { + err = DataModel::Decode(reader, softwareVersionString); + } + else if (__context_tag == to_underlying(Fields::kUpdateToken)) + { + err = DataModel::Decode(reader, updateToken); + } + else if (__context_tag == to_underlying(Fields::kUserConsentNeeded)) + { + err = DataModel::Decode(reader, userConsentNeeded); + } + else if (__context_tag == to_underlying(Fields::kMetadataForRequestor)) + { + err = DataModel::Decode(reader, metadataForRequestor); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kDelayedActionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, delayedActionTime)); - break; - case to_underlying(Fields::kImageURI): - ReturnErrorOnFailure(DataModel::Decode(reader, imageURI)); - break; - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - case to_underlying(Fields::kSoftwareVersionString): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersionString)); - break; - case to_underlying(Fields::kUpdateToken): - ReturnErrorOnFailure(DataModel::Decode(reader, updateToken)); - break; - case to_underlying(Fields::kUserConsentNeeded): - ReturnErrorOnFailure(DataModel::Decode(reader, userConsentNeeded)); - break; - case to_underlying(Fields::kMetadataForRequestor): - ReturnErrorOnFailure(DataModel::Decode(reader, metadataForRequestor)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace QueryImageResponse. namespace ApplyUpdateRequest { @@ -4666,37 +4463,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUpdateToken), updateToken)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewVersion), newVersion)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUpdateToken)) + { + err = DataModel::Decode(reader, updateToken); + } + else if (__context_tag == to_underlying(Fields::kNewVersion)) + { + err = DataModel::Decode(reader, newVersion); + } + else { - case to_underlying(Fields::kUpdateToken): - ReturnErrorOnFailure(DataModel::Decode(reader, updateToken)); - break; - case to_underlying(Fields::kNewVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, newVersion)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ApplyUpdateRequest. namespace ApplyUpdateResponse { @@ -4706,37 +4503,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAction), action)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDelayedActionTime), delayedActionTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAction)) { - continue; + err = DataModel::Decode(reader, action); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kDelayedActionTime)) + { + err = DataModel::Decode(reader, delayedActionTime); + } + else { - case to_underlying(Fields::kAction): - ReturnErrorOnFailure(DataModel::Decode(reader, action)); - break; - case to_underlying(Fields::kDelayedActionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, delayedActionTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ApplyUpdateResponse. namespace NotifyUpdateApplied { @@ -4746,37 +4543,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUpdateToken), updateToken)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSoftwareVersion), softwareVersion)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUpdateToken)) + { + err = DataModel::Decode(reader, updateToken); + } + else if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else { - case to_underlying(Fields::kUpdateToken): - ReturnErrorOnFailure(DataModel::Decode(reader, updateToken)); - break; - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NotifyUpdateApplied. } // namespace Commands @@ -4787,28 +4584,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -4844,37 +4633,36 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kProviderNodeID)) + { + err = DataModel::Decode(reader, providerNodeID); + } + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kProviderNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, providerNodeID)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ProviderLocation @@ -4891,46 +4679,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAnnouncementReason), announcementReason)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMetadataForNode), metadataForNode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEndpoint), endpoint)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kProviderNodeID)) { - continue; + err = DataModel::Decode(reader, providerNodeID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kVendorID)) + { + err = DataModel::Decode(reader, vendorID); + } + else if (__context_tag == to_underlying(Fields::kAnnouncementReason)) + { + err = DataModel::Decode(reader, announcementReason); + } + else if (__context_tag == to_underlying(Fields::kMetadataForNode)) + { + err = DataModel::Decode(reader, metadataForNode); + } + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else { - case to_underlying(Fields::kProviderNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, providerNodeID)); - break; - case to_underlying(Fields::kVendorID): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorID)); - break; - case to_underlying(Fields::kAnnouncementReason): - ReturnErrorOnFailure(DataModel::Decode(reader, announcementReason)); - break; - case to_underlying(Fields::kMetadataForNode): - ReturnErrorOnFailure(DataModel::Decode(reader, metadataForNode)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AnnounceOTAProvider. } // namespace Commands @@ -4941,40 +4732,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::DefaultOTAProviders::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, defaultOTAProviders)); - break; + return DataModel::Decode(reader, defaultOTAProviders); case Attributes::UpdatePossible::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, updatePossible)); - break; + return DataModel::Decode(reader, updatePossible); case Attributes::UpdateState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, updateState)); - break; + return DataModel::Decode(reader, updateState); case Attributes::UpdateStateProgress::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, updateStateProgress)); - break; + return DataModel::Decode(reader, updateStateProgress); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -4988,43 +4767,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewState), newState)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReason), reason)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTargetSoftwareVersion), targetSoftwareVersion)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPreviousState)) + { + err = DataModel::Decode(reader, previousState); + } + else if (__context_tag == to_underlying(Fields::kNewState)) + { + err = DataModel::Decode(reader, newState); + } + else if (__context_tag == to_underlying(Fields::kReason)) + { + err = DataModel::Decode(reader, reason); + } + else if (__context_tag == to_underlying(Fields::kTargetSoftwareVersion)) + { + err = DataModel::Decode(reader, targetSoftwareVersion); + } + else { - case to_underlying(Fields::kPreviousState): - ReturnErrorOnFailure(DataModel::Decode(reader, previousState)); - break; - case to_underlying(Fields::kNewState): - ReturnErrorOnFailure(DataModel::Decode(reader, newState)); - break; - case to_underlying(Fields::kReason): - ReturnErrorOnFailure(DataModel::Decode(reader, reason)); - break; - case to_underlying(Fields::kTargetSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, targetSoftwareVersion)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StateTransition. namespace VersionApplied { @@ -5034,37 +4815,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSoftwareVersion), softwareVersion)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kProductID), productID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else if (__context_tag == to_underlying(Fields::kProductID)) + { + err = DataModel::Decode(reader, productID); + } + else { - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - case to_underlying(Fields::kProductID): - ReturnErrorOnFailure(DataModel::Decode(reader, productID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace VersionApplied. namespace DownloadError { @@ -5076,43 +4857,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBytesDownloaded), bytesDownloaded)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kProgressPercent), progressPercent)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPlatformCode), platformCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else if (__context_tag == to_underlying(Fields::kBytesDownloaded)) + { + err = DataModel::Decode(reader, bytesDownloaded); + } + else if (__context_tag == to_underlying(Fields::kProgressPercent)) + { + err = DataModel::Decode(reader, progressPercent); + } + else if (__context_tag == to_underlying(Fields::kPlatformCode)) + { + err = DataModel::Decode(reader, platformCode); + } + else { - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - case to_underlying(Fields::kBytesDownloaded): - ReturnErrorOnFailure(DataModel::Decode(reader, bytesDownloaded)); - break; - case to_underlying(Fields::kProgressPercent): - ReturnErrorOnFailure(DataModel::Decode(reader, progressPercent)); - break; - case to_underlying(Fields::kPlatformCode): - ReturnErrorOnFailure(DataModel::Decode(reader, platformCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DownloadError. } // namespace Events @@ -5128,34 +4911,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::ActiveLocale::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeLocale)); - break; + return DataModel::Decode(reader, activeLocale); case Attributes::SupportedLocales::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedLocales)); - break; + return DataModel::Decode(reader, supportedLocales); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -5172,37 +4945,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::HourFormat::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, hourFormat)); - break; + return DataModel::Decode(reader, hourFormat); case Attributes::ActiveCalendarType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeCalendarType)); - break; + return DataModel::Decode(reader, activeCalendarType); case Attributes::SupportedCalendarTypes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedCalendarTypes)); - break; + return DataModel::Decode(reader, supportedCalendarTypes); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -5219,31 +4981,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::TemperatureUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, temperatureUnit)); - break; + return DataModel::Decode(reader, temperatureUnit); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -5260,31 +5013,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Sources::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, sources)); - break; + return DataModel::Decode(reader, sources); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -5306,34 +5050,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BatChargeFaultChangeType @@ -5350,34 +5092,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BatFaultChangeType @@ -5394,34 +5134,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace WiredFaultChangeType @@ -5435,124 +5173,84 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Status::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; + return DataModel::Decode(reader, status); case Attributes::Order::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, order)); - break; + return DataModel::Decode(reader, order); case Attributes::Description::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, description)); - break; + return DataModel::Decode(reader, description); case Attributes::WiredAssessedInputVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredAssessedInputVoltage)); - break; + return DataModel::Decode(reader, wiredAssessedInputVoltage); case Attributes::WiredAssessedInputFrequency::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredAssessedInputFrequency)); - break; + return DataModel::Decode(reader, wiredAssessedInputFrequency); case Attributes::WiredCurrentType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredCurrentType)); - break; + return DataModel::Decode(reader, wiredCurrentType); case Attributes::WiredAssessedCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredAssessedCurrent)); - break; + return DataModel::Decode(reader, wiredAssessedCurrent); case Attributes::WiredNominalVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredNominalVoltage)); - break; + return DataModel::Decode(reader, wiredNominalVoltage); case Attributes::WiredMaximumCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredMaximumCurrent)); - break; + return DataModel::Decode(reader, wiredMaximumCurrent); case Attributes::WiredPresent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiredPresent)); - break; + return DataModel::Decode(reader, wiredPresent); case Attributes::ActiveWiredFaults::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeWiredFaults)); - break; + return DataModel::Decode(reader, activeWiredFaults); case Attributes::BatVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batVoltage)); - break; + return DataModel::Decode(reader, batVoltage); case Attributes::BatPercentRemaining::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batPercentRemaining)); - break; + return DataModel::Decode(reader, batPercentRemaining); case Attributes::BatTimeRemaining::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batTimeRemaining)); - break; + return DataModel::Decode(reader, batTimeRemaining); case Attributes::BatChargeLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batChargeLevel)); - break; + return DataModel::Decode(reader, batChargeLevel); case Attributes::BatReplacementNeeded::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batReplacementNeeded)); - break; + return DataModel::Decode(reader, batReplacementNeeded); case Attributes::BatReplaceability::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batReplaceability)); - break; + return DataModel::Decode(reader, batReplaceability); case Attributes::BatPresent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batPresent)); - break; + return DataModel::Decode(reader, batPresent); case Attributes::ActiveBatFaults::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeBatFaults)); - break; + return DataModel::Decode(reader, activeBatFaults); case Attributes::BatReplacementDescription::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batReplacementDescription)); - break; + return DataModel::Decode(reader, batReplacementDescription); case Attributes::BatCommonDesignation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batCommonDesignation)); - break; + return DataModel::Decode(reader, batCommonDesignation); case Attributes::BatANSIDesignation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batANSIDesignation)); - break; + return DataModel::Decode(reader, batANSIDesignation); case Attributes::BatIECDesignation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batIECDesignation)); - break; + return DataModel::Decode(reader, batIECDesignation); case Attributes::BatApprovedChemistry::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batApprovedChemistry)); - break; + return DataModel::Decode(reader, batApprovedChemistry); case Attributes::BatCapacity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batCapacity)); - break; + return DataModel::Decode(reader, batCapacity); case Attributes::BatQuantity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batQuantity)); - break; + return DataModel::Decode(reader, batQuantity); case Attributes::BatChargeState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batChargeState)); - break; + return DataModel::Decode(reader, batChargeState); case Attributes::BatTimeToFullCharge::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batTimeToFullCharge)); - break; + return DataModel::Decode(reader, batTimeToFullCharge); case Attributes::BatFunctionalWhileCharging::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batFunctionalWhileCharging)); - break; + return DataModel::Decode(reader, batFunctionalWhileCharging); case Attributes::BatChargingCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batChargingCurrent)); - break; + return DataModel::Decode(reader, batChargingCurrent); case Attributes::ActiveBatChargeFaults::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeBatChargeFaults)); - break; + return DataModel::Decode(reader, activeBatChargeFaults); case Attributes::EndpointList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, endpointList)); - break; + return DataModel::Decode(reader, endpointList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -5564,37 +5262,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace WiredFaultChange. namespace BatFaultChange { @@ -5604,37 +5302,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; + err = DataModel::Decode(reader, current); } - } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace BatFaultChange. namespace BatChargeFaultChange { @@ -5644,37 +5342,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BatChargeFaultChange. } // namespace Events @@ -5697,34 +5395,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFailSafeExpiryLengthSeconds)) { - continue; + err = DataModel::Decode(reader, failSafeExpiryLengthSeconds); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kMaxCumulativeFailsafeSeconds)) + { + err = DataModel::Decode(reader, maxCumulativeFailsafeSeconds); + } + else { - case to_underlying(Fields::kFailSafeExpiryLengthSeconds): - ReturnErrorOnFailure(DataModel::Decode(reader, failSafeExpiryLengthSeconds)); - break; - case to_underlying(Fields::kMaxCumulativeFailsafeSeconds): - ReturnErrorOnFailure(DataModel::Decode(reader, maxCumulativeFailsafeSeconds)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BasicCommissioningInfo @@ -5738,37 +5434,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExpiryLengthSeconds), expiryLengthSeconds)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kExpiryLengthSeconds)) + { + err = DataModel::Decode(reader, expiryLengthSeconds); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kExpiryLengthSeconds): - ReturnErrorOnFailure(DataModel::Decode(reader, expiryLengthSeconds)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ArmFailSafe. namespace ArmFailSafeResponse { @@ -5778,37 +5474,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kErrorCode), errorCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kErrorCode)) + { + err = DataModel::Decode(reader, errorCode); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else { - case to_underlying(Fields::kErrorCode): - ReturnErrorOnFailure(DataModel::Decode(reader, errorCode)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ArmFailSafeResponse. namespace SetRegulatoryConfig { @@ -5819,40 +5515,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewRegulatoryConfig), newRegulatoryConfig)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCountryCode), countryCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewRegulatoryConfig)) + { + err = DataModel::Decode(reader, newRegulatoryConfig); + } + else if (__context_tag == to_underlying(Fields::kCountryCode)) + { + err = DataModel::Decode(reader, countryCode); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kNewRegulatoryConfig): - ReturnErrorOnFailure(DataModel::Decode(reader, newRegulatoryConfig)); - break; - case to_underlying(Fields::kCountryCode): - ReturnErrorOnFailure(DataModel::Decode(reader, countryCode)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetRegulatoryConfig. namespace SetRegulatoryConfigResponse { @@ -5862,37 +5559,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kErrorCode), errorCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kErrorCode)) + { + err = DataModel::Decode(reader, errorCode); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else { - case to_underlying(Fields::kErrorCode): - ReturnErrorOnFailure(DataModel::Decode(reader, errorCode)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetRegulatoryConfigResponse. namespace CommissioningComplete { @@ -5900,31 +5597,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace CommissioningComplete. namespace CommissioningCompleteResponse { @@ -5934,37 +5620,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kErrorCode), errorCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kErrorCode)) + { + err = DataModel::Decode(reader, errorCode); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else { - case to_underlying(Fields::kErrorCode): - ReturnErrorOnFailure(DataModel::Decode(reader, errorCode)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CommissioningCompleteResponse. } // namespace Commands @@ -5975,43 +5661,30 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Breadcrumb::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; + return DataModel::Decode(reader, breadcrumb); case Attributes::BasicCommissioningInfo::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, basicCommissioningInfo)); - break; + return DataModel::Decode(reader, basicCommissioningInfo); case Attributes::RegulatoryConfig::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, regulatoryConfig)); - break; + return DataModel::Decode(reader, regulatoryConfig); case Attributes::LocationCapability::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, locationCapability)); - break; + return DataModel::Decode(reader, locationCapability); case Attributes::SupportsConcurrentConnection::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportsConcurrentConnection)); - break; + return DataModel::Decode(reader, supportsConcurrentConnection); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -6033,34 +5706,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkID)) + { + err = DataModel::Decode(reader, networkID); + } + else if (__context_tag == to_underlying(Fields::kConnected)) + { + err = DataModel::Decode(reader, connected); + } + else { - case to_underlying(Fields::kNetworkID): - ReturnErrorOnFailure(DataModel::Decode(reader, networkID)); - break; - case to_underlying(Fields::kConnected): - ReturnErrorOnFailure(DataModel::Decode(reader, connected)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NetworkInfoStruct @@ -6083,52 +5754,56 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kPanId): - ReturnErrorOnFailure(DataModel::Decode(reader, panId)); - break; - case to_underlying(Fields::kExtendedPanId): - ReturnErrorOnFailure(DataModel::Decode(reader, extendedPanId)); - break; - case to_underlying(Fields::kNetworkName): - ReturnErrorOnFailure(DataModel::Decode(reader, networkName)); - break; - case to_underlying(Fields::kChannel): - ReturnErrorOnFailure(DataModel::Decode(reader, channel)); - break; - case to_underlying(Fields::kVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, version)); - break; - case to_underlying(Fields::kExtendedAddress): - ReturnErrorOnFailure(DataModel::Decode(reader, extendedAddress)); - break; - case to_underlying(Fields::kRssi): - ReturnErrorOnFailure(DataModel::Decode(reader, rssi)); - break; - case to_underlying(Fields::kLqi): - ReturnErrorOnFailure(DataModel::Decode(reader, lqi)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kPanId)) + { + err = DataModel::Decode(reader, panId); + } + else if (__context_tag == to_underlying(Fields::kExtendedPanId)) + { + err = DataModel::Decode(reader, extendedPanId); + } + else if (__context_tag == to_underlying(Fields::kNetworkName)) + { + err = DataModel::Decode(reader, networkName); + } + else if (__context_tag == to_underlying(Fields::kChannel)) + { + err = DataModel::Decode(reader, channel); + } + else if (__context_tag == to_underlying(Fields::kVersion)) + { + err = DataModel::Decode(reader, version); + } + else if (__context_tag == to_underlying(Fields::kExtendedAddress)) + { + err = DataModel::Decode(reader, extendedAddress); + } + else if (__context_tag == to_underlying(Fields::kRssi)) + { + err = DataModel::Decode(reader, rssi); + } + else if (__context_tag == to_underlying(Fields::kLqi)) + { + err = DataModel::Decode(reader, lqi); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace ThreadInterfaceScanResultStruct @@ -6149,46 +5824,48 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSecurity)) { - continue; + err = DataModel::Decode(reader, security); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kSsid)) + { + err = DataModel::Decode(reader, ssid); + } + else if (__context_tag == to_underlying(Fields::kBssid)) + { + err = DataModel::Decode(reader, bssid); + } + else if (__context_tag == to_underlying(Fields::kChannel)) + { + err = DataModel::Decode(reader, channel); + } + else if (__context_tag == to_underlying(Fields::kWiFiBand)) + { + err = DataModel::Decode(reader, wiFiBand); + } + else if (__context_tag == to_underlying(Fields::kRssi)) + { + err = DataModel::Decode(reader, rssi); + } + else { - case to_underlying(Fields::kSecurity): - ReturnErrorOnFailure(DataModel::Decode(reader, security)); - break; - case to_underlying(Fields::kSsid): - ReturnErrorOnFailure(DataModel::Decode(reader, ssid)); - break; - case to_underlying(Fields::kBssid): - ReturnErrorOnFailure(DataModel::Decode(reader, bssid)); - break; - case to_underlying(Fields::kChannel): - ReturnErrorOnFailure(DataModel::Decode(reader, channel)); - break; - case to_underlying(Fields::kWiFiBand): - ReturnErrorOnFailure(DataModel::Decode(reader, wiFiBand)); - break; - case to_underlying(Fields::kRssi): - ReturnErrorOnFailure(DataModel::Decode(reader, rssi)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace WiFiInterfaceScanResultStruct @@ -6202,37 +5879,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSsid), ssid)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSsid)) + { + err = DataModel::Decode(reader, ssid); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kSsid): - ReturnErrorOnFailure(DataModel::Decode(reader, ssid)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ScanNetworks. namespace ScanNetworksResponse { @@ -6244,43 +5921,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kWiFiScanResults), wiFiScanResults)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kThreadScanResults), threadScanResults)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkingStatus)) + { + err = DataModel::Decode(reader, networkingStatus); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else if (__context_tag == to_underlying(Fields::kWiFiScanResults)) + { + err = DataModel::Decode(reader, wiFiScanResults); + } + else if (__context_tag == to_underlying(Fields::kThreadScanResults)) + { + err = DataModel::Decode(reader, threadScanResults); + } + else { - case to_underlying(Fields::kNetworkingStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, networkingStatus)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - case to_underlying(Fields::kWiFiScanResults): - ReturnErrorOnFailure(DataModel::Decode(reader, wiFiScanResults)); - break; - case to_underlying(Fields::kThreadScanResults): - ReturnErrorOnFailure(DataModel::Decode(reader, threadScanResults)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ScanNetworksResponse. namespace AddOrUpdateWiFiNetwork { @@ -6291,40 +5970,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSsid), ssid)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCredentials), credentials)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSsid)) + { + err = DataModel::Decode(reader, ssid); + } + else if (__context_tag == to_underlying(Fields::kCredentials)) + { + err = DataModel::Decode(reader, credentials); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kSsid): - ReturnErrorOnFailure(DataModel::Decode(reader, ssid)); - break; - case to_underlying(Fields::kCredentials): - ReturnErrorOnFailure(DataModel::Decode(reader, credentials)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddOrUpdateWiFiNetwork. namespace AddOrUpdateThreadNetwork { @@ -6334,37 +6014,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOperationalDataset), operationalDataset)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperationalDataset)) + { + err = DataModel::Decode(reader, operationalDataset); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kOperationalDataset): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalDataset)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddOrUpdateThreadNetwork. namespace RemoveNetwork { @@ -6374,37 +6054,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkID), networkID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkID)) { - case to_underlying(Fields::kNetworkID): - ReturnErrorOnFailure(DataModel::Decode(reader, networkID)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; + err = DataModel::Decode(reader, networkID); } - } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace RemoveNetwork. namespace NetworkConfigResponse { @@ -6415,40 +6095,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkingStatus), networkingStatus)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkIndex), networkIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkingStatus)) + { + err = DataModel::Decode(reader, networkingStatus); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else if (__context_tag == to_underlying(Fields::kNetworkIndex)) + { + err = DataModel::Decode(reader, networkIndex); + } + else { - case to_underlying(Fields::kNetworkingStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, networkingStatus)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - case to_underlying(Fields::kNetworkIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, networkIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NetworkConfigResponse. namespace ConnectNetwork { @@ -6458,37 +6139,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkID), networkID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkID)) + { + err = DataModel::Decode(reader, networkID); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kNetworkID): - ReturnErrorOnFailure(DataModel::Decode(reader, networkID)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ConnectNetwork. namespace ConnectNetworkResponse { @@ -6499,40 +6180,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkingStatus), networkingStatus)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kErrorValue), errorValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkingStatus)) + { + err = DataModel::Decode(reader, networkingStatus); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else if (__context_tag == to_underlying(Fields::kErrorValue)) + { + err = DataModel::Decode(reader, errorValue); + } + else { - case to_underlying(Fields::kNetworkingStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, networkingStatus)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - case to_underlying(Fields::kErrorValue): - ReturnErrorOnFailure(DataModel::Decode(reader, errorValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ConnectNetworkResponse. namespace ReorderNetwork { @@ -6543,40 +6225,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkID), networkID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNetworkIndex), networkIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBreadcrumb), breadcrumb)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNetworkID)) + { + err = DataModel::Decode(reader, networkID); + } + else if (__context_tag == to_underlying(Fields::kNetworkIndex)) + { + err = DataModel::Decode(reader, networkIndex); + } + else if (__context_tag == to_underlying(Fields::kBreadcrumb)) + { + err = DataModel::Decode(reader, breadcrumb); + } + else { - case to_underlying(Fields::kNetworkID): - ReturnErrorOnFailure(DataModel::Decode(reader, networkID)); - break; - case to_underlying(Fields::kNetworkIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, networkIndex)); - break; - case to_underlying(Fields::kBreadcrumb): - ReturnErrorOnFailure(DataModel::Decode(reader, breadcrumb)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ReorderNetwork. } // namespace Commands @@ -6587,52 +6270,36 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MaxNetworks::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxNetworks)); - break; + return DataModel::Decode(reader, maxNetworks); case Attributes::Networks::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, networks)); - break; + return DataModel::Decode(reader, networks); case Attributes::ScanMaxTimeSeconds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, scanMaxTimeSeconds)); - break; + return DataModel::Decode(reader, scanMaxTimeSeconds); case Attributes::ConnectMaxTimeSeconds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, connectMaxTimeSeconds)); - break; + return DataModel::Decode(reader, connectMaxTimeSeconds); case Attributes::InterfaceEnabled::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, interfaceEnabled)); - break; + return DataModel::Decode(reader, interfaceEnabled); case Attributes::LastNetworkingStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lastNetworkingStatus)); - break; + return DataModel::Decode(reader, lastNetworkingStatus); case Attributes::LastNetworkID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lastNetworkID)); - break; + return DataModel::Decode(reader, lastNetworkID); case Attributes::LastConnectErrorValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lastConnectErrorValue)); - break; + return DataModel::Decode(reader, lastConnectErrorValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -6650,40 +6317,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIntent), intent)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRequestedProtocol), requestedProtocol)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransferFileDesignator), transferFileDesignator)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIntent)) { - continue; + err = DataModel::Decode(reader, intent); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kRequestedProtocol)) + { + err = DataModel::Decode(reader, requestedProtocol); + } + else if (__context_tag == to_underlying(Fields::kTransferFileDesignator)) + { + err = DataModel::Decode(reader, transferFileDesignator); + } + else { - case to_underlying(Fields::kIntent): - ReturnErrorOnFailure(DataModel::Decode(reader, intent)); - break; - case to_underlying(Fields::kRequestedProtocol): - ReturnErrorOnFailure(DataModel::Decode(reader, requestedProtocol)); - break; - case to_underlying(Fields::kTransferFileDesignator): - ReturnErrorOnFailure(DataModel::Decode(reader, transferFileDesignator)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RetrieveLogsRequest. namespace RetrieveLogsResponse { @@ -6695,43 +6363,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLogContent), logContent)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUTCTimeStamp), UTCTimeStamp)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTimeSinceBoot), timeSinceBoot)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kLogContent)) + { + err = DataModel::Decode(reader, logContent); + } + else if (__context_tag == to_underlying(Fields::kUTCTimeStamp)) + { + err = DataModel::Decode(reader, UTCTimeStamp); + } + else if (__context_tag == to_underlying(Fields::kTimeSinceBoot)) + { + err = DataModel::Decode(reader, timeSinceBoot); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kLogContent): - ReturnErrorOnFailure(DataModel::Decode(reader, logContent)); - break; - case to_underlying(Fields::kUTCTimeStamp): - ReturnErrorOnFailure(DataModel::Decode(reader, UTCTimeStamp)); - break; - case to_underlying(Fields::kTimeSinceBoot): - ReturnErrorOnFailure(DataModel::Decode(reader, timeSinceBoot)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RetrieveLogsResponse. } // namespace Commands @@ -6742,28 +6412,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -6793,52 +6455,56 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kIsOperational): - ReturnErrorOnFailure(DataModel::Decode(reader, isOperational)); - break; - case to_underlying(Fields::kOffPremiseServicesReachableIPv4): - ReturnErrorOnFailure(DataModel::Decode(reader, offPremiseServicesReachableIPv4)); - break; - case to_underlying(Fields::kOffPremiseServicesReachableIPv6): - ReturnErrorOnFailure(DataModel::Decode(reader, offPremiseServicesReachableIPv6)); - break; - case to_underlying(Fields::kHardwareAddress): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareAddress)); - break; - case to_underlying(Fields::kIPv4Addresses): - ReturnErrorOnFailure(DataModel::Decode(reader, IPv4Addresses)); - break; - case to_underlying(Fields::kIPv6Addresses): - ReturnErrorOnFailure(DataModel::Decode(reader, IPv6Addresses)); - break; - case to_underlying(Fields::kType): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kIsOperational)) + { + err = DataModel::Decode(reader, isOperational); + } + else if (__context_tag == to_underlying(Fields::kOffPremiseServicesReachableIPv4)) + { + err = DataModel::Decode(reader, offPremiseServicesReachableIPv4); + } + else if (__context_tag == to_underlying(Fields::kOffPremiseServicesReachableIPv6)) + { + err = DataModel::Decode(reader, offPremiseServicesReachableIPv6); + } + else if (__context_tag == to_underlying(Fields::kHardwareAddress)) + { + err = DataModel::Decode(reader, hardwareAddress); + } + else if (__context_tag == to_underlying(Fields::kIPv4Addresses)) + { + err = DataModel::Decode(reader, IPv4Addresses); + } + else if (__context_tag == to_underlying(Fields::kIPv6Addresses)) + { + err = DataModel::Decode(reader, IPv6Addresses); + } + else if (__context_tag == to_underlying(Fields::kType)) + { + err = DataModel::Decode(reader, type); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace NetworkInterface @@ -6852,37 +6518,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnableKey), enableKey)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEventTrigger), eventTrigger)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEnableKey)) { - continue; + err = DataModel::Decode(reader, enableKey); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kEventTrigger)) + { + err = DataModel::Decode(reader, eventTrigger); + } + else { - case to_underlying(Fields::kEnableKey): - ReturnErrorOnFailure(DataModel::Decode(reader, enableKey)); - break; - case to_underlying(Fields::kEventTrigger): - ReturnErrorOnFailure(DataModel::Decode(reader, eventTrigger)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEventTrigger. } // namespace Commands @@ -6893,58 +6559,40 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::NetworkInterfaces::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, networkInterfaces)); - break; + return DataModel::Decode(reader, networkInterfaces); case Attributes::RebootCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rebootCount)); - break; + return DataModel::Decode(reader, rebootCount); case Attributes::UpTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, upTime)); - break; + return DataModel::Decode(reader, upTime); case Attributes::TotalOperationalHours::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, totalOperationalHours)); - break; + return DataModel::Decode(reader, totalOperationalHours); case Attributes::BootReason::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, bootReason)); - break; + return DataModel::Decode(reader, bootReason); case Attributes::ActiveHardwareFaults::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeHardwareFaults)); - break; + return DataModel::Decode(reader, activeHardwareFaults); case Attributes::ActiveRadioFaults::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeRadioFaults)); - break; + return DataModel::Decode(reader, activeRadioFaults); case Attributes::ActiveNetworkFaults::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeNetworkFaults)); - break; + return DataModel::Decode(reader, activeNetworkFaults); case Attributes::TestEventTriggersEnabled::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, testEventTriggersEnabled)); - break; + return DataModel::Decode(reader, testEventTriggersEnabled); case Attributes::AverageWearCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageWearCount)); - break; + return DataModel::Decode(reader, averageWearCount); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -6956,37 +6604,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) { - continue; + err = DataModel::Decode(reader, current); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace HardwareFaultChange. namespace RadioFaultChange { @@ -6996,37 +6644,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RadioFaultChange. namespace NetworkFaultChange { @@ -7036,37 +6684,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) + { + err = DataModel::Decode(reader, current); + } + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NetworkFaultChange. namespace BootReason { @@ -7075,34 +6723,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBootReason), bootReason)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kBootReason)) + { + err = DataModel::Decode(reader, bootReason); + } + else { - case to_underlying(Fields::kBootReason): - ReturnErrorOnFailure(DataModel::Decode(reader, bootReason)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BootReason. } // namespace Events @@ -7126,43 +6773,44 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kId)) { - continue; + err = DataModel::Decode(reader, id); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kStackFreeCurrent)) + { + err = DataModel::Decode(reader, stackFreeCurrent); + } + else if (__context_tag == to_underlying(Fields::kStackFreeMinimum)) + { + err = DataModel::Decode(reader, stackFreeMinimum); + } + else if (__context_tag == to_underlying(Fields::kStackSize)) + { + err = DataModel::Decode(reader, stackSize); + } + else { - case to_underlying(Fields::kId): - ReturnErrorOnFailure(DataModel::Decode(reader, id)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kStackFreeCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, stackFreeCurrent)); - break; - case to_underlying(Fields::kStackFreeMinimum): - ReturnErrorOnFailure(DataModel::Decode(reader, stackFreeMinimum)); - break; - case to_underlying(Fields::kStackSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stackSize)); - break; - default: - break; } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ThreadMetricsStruct @@ -7174,31 +6822,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ResetWatermarks. } // namespace Commands @@ -7209,40 +6846,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::ThreadMetrics::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, threadMetrics)); - break; + return DataModel::Decode(reader, threadMetrics); case Attributes::CurrentHeapFree::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentHeapFree)); - break; + return DataModel::Decode(reader, currentHeapFree); case Attributes::CurrentHeapUsed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentHeapUsed)); - break; + return DataModel::Decode(reader, currentHeapUsed); case Attributes::CurrentHeapHighWatermark::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentHeapHighWatermark)); - break; + return DataModel::Decode(reader, currentHeapHighWatermark); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -7255,40 +6880,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kId), id)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kName), name)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFaultRecording), faultRecording)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kId)) + { + err = DataModel::Decode(reader, id); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kFaultRecording)) + { + err = DataModel::Decode(reader, faultRecording); + } + else { - case to_underlying(Fields::kId): - ReturnErrorOnFailure(DataModel::Decode(reader, id)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kFaultRecording): - ReturnErrorOnFailure(DataModel::Decode(reader, faultRecording)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SoftwareFault. } // namespace Events @@ -7321,70 +6947,80 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kExtAddress): - ReturnErrorOnFailure(DataModel::Decode(reader, extAddress)); - break; - case to_underlying(Fields::kAge): - ReturnErrorOnFailure(DataModel::Decode(reader, age)); - break; - case to_underlying(Fields::kRloc16): - ReturnErrorOnFailure(DataModel::Decode(reader, rloc16)); - break; - case to_underlying(Fields::kLinkFrameCounter): - ReturnErrorOnFailure(DataModel::Decode(reader, linkFrameCounter)); - break; - case to_underlying(Fields::kMleFrameCounter): - ReturnErrorOnFailure(DataModel::Decode(reader, mleFrameCounter)); - break; - case to_underlying(Fields::kLqi): - ReturnErrorOnFailure(DataModel::Decode(reader, lqi)); - break; - case to_underlying(Fields::kAverageRssi): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRssi)); - break; - case to_underlying(Fields::kLastRssi): - ReturnErrorOnFailure(DataModel::Decode(reader, lastRssi)); - break; - case to_underlying(Fields::kFrameErrorRate): - ReturnErrorOnFailure(DataModel::Decode(reader, frameErrorRate)); - break; - case to_underlying(Fields::kMessageErrorRate): - ReturnErrorOnFailure(DataModel::Decode(reader, messageErrorRate)); - break; - case to_underlying(Fields::kRxOnWhenIdle): - ReturnErrorOnFailure(DataModel::Decode(reader, rxOnWhenIdle)); - break; - case to_underlying(Fields::kFullThreadDevice): - ReturnErrorOnFailure(DataModel::Decode(reader, fullThreadDevice)); - break; - case to_underlying(Fields::kFullNetworkData): - ReturnErrorOnFailure(DataModel::Decode(reader, fullNetworkData)); - break; - case to_underlying(Fields::kIsChild): - ReturnErrorOnFailure(DataModel::Decode(reader, isChild)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kExtAddress)) + { + err = DataModel::Decode(reader, extAddress); + } + else if (__context_tag == to_underlying(Fields::kAge)) + { + err = DataModel::Decode(reader, age); + } + else if (__context_tag == to_underlying(Fields::kRloc16)) + { + err = DataModel::Decode(reader, rloc16); + } + else if (__context_tag == to_underlying(Fields::kLinkFrameCounter)) + { + err = DataModel::Decode(reader, linkFrameCounter); + } + else if (__context_tag == to_underlying(Fields::kMleFrameCounter)) + { + err = DataModel::Decode(reader, mleFrameCounter); + } + else if (__context_tag == to_underlying(Fields::kLqi)) + { + err = DataModel::Decode(reader, lqi); + } + else if (__context_tag == to_underlying(Fields::kAverageRssi)) + { + err = DataModel::Decode(reader, averageRssi); + } + else if (__context_tag == to_underlying(Fields::kLastRssi)) + { + err = DataModel::Decode(reader, lastRssi); + } + else if (__context_tag == to_underlying(Fields::kFrameErrorRate)) + { + err = DataModel::Decode(reader, frameErrorRate); + } + else if (__context_tag == to_underlying(Fields::kMessageErrorRate)) + { + err = DataModel::Decode(reader, messageErrorRate); + } + else if (__context_tag == to_underlying(Fields::kRxOnWhenIdle)) + { + err = DataModel::Decode(reader, rxOnWhenIdle); + } + else if (__context_tag == to_underlying(Fields::kFullThreadDevice)) + { + err = DataModel::Decode(reader, fullThreadDevice); + } + else if (__context_tag == to_underlying(Fields::kFullNetworkData)) + { + err = DataModel::Decode(reader, fullNetworkData); + } + else if (__context_tag == to_underlying(Fields::kIsChild)) + { + err = DataModel::Decode(reader, isChild); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace NeighborTableStruct @@ -7411,64 +7047,72 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kActiveTimestampPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, activeTimestampPresent)); - break; - case to_underlying(Fields::kPendingTimestampPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, pendingTimestampPresent)); - break; - case to_underlying(Fields::kMasterKeyPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, masterKeyPresent)); - break; - case to_underlying(Fields::kNetworkNamePresent): - ReturnErrorOnFailure(DataModel::Decode(reader, networkNamePresent)); - break; - case to_underlying(Fields::kExtendedPanIdPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, extendedPanIdPresent)); - break; - case to_underlying(Fields::kMeshLocalPrefixPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, meshLocalPrefixPresent)); - break; - case to_underlying(Fields::kDelayPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, delayPresent)); - break; - case to_underlying(Fields::kPanIdPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, panIdPresent)); - break; - case to_underlying(Fields::kChannelPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, channelPresent)); - break; - case to_underlying(Fields::kPskcPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, pskcPresent)); - break; - case to_underlying(Fields::kSecurityPolicyPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, securityPolicyPresent)); - break; - case to_underlying(Fields::kChannelMaskPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, channelMaskPresent)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kActiveTimestampPresent)) + { + err = DataModel::Decode(reader, activeTimestampPresent); + } + else if (__context_tag == to_underlying(Fields::kPendingTimestampPresent)) + { + err = DataModel::Decode(reader, pendingTimestampPresent); + } + else if (__context_tag == to_underlying(Fields::kMasterKeyPresent)) + { + err = DataModel::Decode(reader, masterKeyPresent); + } + else if (__context_tag == to_underlying(Fields::kNetworkNamePresent)) + { + err = DataModel::Decode(reader, networkNamePresent); + } + else if (__context_tag == to_underlying(Fields::kExtendedPanIdPresent)) + { + err = DataModel::Decode(reader, extendedPanIdPresent); + } + else if (__context_tag == to_underlying(Fields::kMeshLocalPrefixPresent)) + { + err = DataModel::Decode(reader, meshLocalPrefixPresent); + } + else if (__context_tag == to_underlying(Fields::kDelayPresent)) + { + err = DataModel::Decode(reader, delayPresent); + } + else if (__context_tag == to_underlying(Fields::kPanIdPresent)) + { + err = DataModel::Decode(reader, panIdPresent); + } + else if (__context_tag == to_underlying(Fields::kChannelPresent)) + { + err = DataModel::Decode(reader, channelPresent); + } + else if (__context_tag == to_underlying(Fields::kPskcPresent)) + { + err = DataModel::Decode(reader, pskcPresent); + } + else if (__context_tag == to_underlying(Fields::kSecurityPolicyPresent)) + { + err = DataModel::Decode(reader, securityPolicyPresent); + } + else if (__context_tag == to_underlying(Fields::kChannelMaskPresent)) + { + err = DataModel::Decode(reader, channelMaskPresent); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace OperationalDatasetComponents @@ -7493,58 +7137,64 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kExtAddress): - ReturnErrorOnFailure(DataModel::Decode(reader, extAddress)); - break; - case to_underlying(Fields::kRloc16): - ReturnErrorOnFailure(DataModel::Decode(reader, rloc16)); - break; - case to_underlying(Fields::kRouterId): - ReturnErrorOnFailure(DataModel::Decode(reader, routerId)); - break; - case to_underlying(Fields::kNextHop): - ReturnErrorOnFailure(DataModel::Decode(reader, nextHop)); - break; - case to_underlying(Fields::kPathCost): - ReturnErrorOnFailure(DataModel::Decode(reader, pathCost)); - break; - case to_underlying(Fields::kLQIIn): - ReturnErrorOnFailure(DataModel::Decode(reader, LQIIn)); - break; - case to_underlying(Fields::kLQIOut): - ReturnErrorOnFailure(DataModel::Decode(reader, LQIOut)); - break; - case to_underlying(Fields::kAge): - ReturnErrorOnFailure(DataModel::Decode(reader, age)); - break; - case to_underlying(Fields::kAllocated): - ReturnErrorOnFailure(DataModel::Decode(reader, allocated)); - break; - case to_underlying(Fields::kLinkEstablished): - ReturnErrorOnFailure(DataModel::Decode(reader, linkEstablished)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kExtAddress)) + { + err = DataModel::Decode(reader, extAddress); + } + else if (__context_tag == to_underlying(Fields::kRloc16)) + { + err = DataModel::Decode(reader, rloc16); + } + else if (__context_tag == to_underlying(Fields::kRouterId)) + { + err = DataModel::Decode(reader, routerId); + } + else if (__context_tag == to_underlying(Fields::kNextHop)) + { + err = DataModel::Decode(reader, nextHop); + } + else if (__context_tag == to_underlying(Fields::kPathCost)) + { + err = DataModel::Decode(reader, pathCost); + } + else if (__context_tag == to_underlying(Fields::kLQIIn)) + { + err = DataModel::Decode(reader, LQIIn); + } + else if (__context_tag == to_underlying(Fields::kLQIOut)) + { + err = DataModel::Decode(reader, LQIOut); + } + else if (__context_tag == to_underlying(Fields::kAge)) + { + err = DataModel::Decode(reader, age); + } + else if (__context_tag == to_underlying(Fields::kAllocated)) + { + err = DataModel::Decode(reader, allocated); + } + else if (__context_tag == to_underlying(Fields::kLinkEstablished)) + { + err = DataModel::Decode(reader, linkEstablished); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace RouteTableStruct @@ -7561,34 +7211,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRotationTime)) + { + err = DataModel::Decode(reader, rotationTime); + } + else if (__context_tag == to_underlying(Fields::kFlags)) + { + err = DataModel::Decode(reader, flags); + } + else { - case to_underlying(Fields::kRotationTime): - ReturnErrorOnFailure(DataModel::Decode(reader, rotationTime)); - break; - case to_underlying(Fields::kFlags): - ReturnErrorOnFailure(DataModel::Decode(reader, flags)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SecurityPolicy @@ -7600,31 +7248,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ResetCounts. } // namespace Commands @@ -7635,217 +7272,146 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Channel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, channel)); - break; + return DataModel::Decode(reader, channel); case Attributes::RoutingRole::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, routingRole)); - break; + return DataModel::Decode(reader, routingRole); case Attributes::NetworkName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, networkName)); - break; + return DataModel::Decode(reader, networkName); case Attributes::PanId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, panId)); - break; + return DataModel::Decode(reader, panId); case Attributes::ExtendedPanId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, extendedPanId)); - break; + return DataModel::Decode(reader, extendedPanId); case Attributes::MeshLocalPrefix::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, meshLocalPrefix)); - break; + return DataModel::Decode(reader, meshLocalPrefix); case Attributes::OverrunCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, overrunCount)); - break; + return DataModel::Decode(reader, overrunCount); case Attributes::NeighborTable::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, neighborTable)); - break; + return DataModel::Decode(reader, neighborTable); case Attributes::RouteTable::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, routeTable)); - break; + return DataModel::Decode(reader, routeTable); case Attributes::PartitionId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, partitionId)); - break; + return DataModel::Decode(reader, partitionId); case Attributes::Weighting::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, weighting)); - break; + return DataModel::Decode(reader, weighting); case Attributes::DataVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dataVersion)); - break; + return DataModel::Decode(reader, dataVersion); case Attributes::StableDataVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, stableDataVersion)); - break; + return DataModel::Decode(reader, stableDataVersion); case Attributes::LeaderRouterId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, leaderRouterId)); - break; + return DataModel::Decode(reader, leaderRouterId); case Attributes::DetachedRoleCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, detachedRoleCount)); - break; + return DataModel::Decode(reader, detachedRoleCount); case Attributes::ChildRoleCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, childRoleCount)); - break; + return DataModel::Decode(reader, childRoleCount); case Attributes::RouterRoleCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, routerRoleCount)); - break; + return DataModel::Decode(reader, routerRoleCount); case Attributes::LeaderRoleCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, leaderRoleCount)); - break; + return DataModel::Decode(reader, leaderRoleCount); case Attributes::AttachAttemptCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attachAttemptCount)); - break; + return DataModel::Decode(reader, attachAttemptCount); case Attributes::PartitionIdChangeCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, partitionIdChangeCount)); - break; + return DataModel::Decode(reader, partitionIdChangeCount); case Attributes::BetterPartitionAttachAttemptCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, betterPartitionAttachAttemptCount)); - break; + return DataModel::Decode(reader, betterPartitionAttachAttemptCount); case Attributes::ParentChangeCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, parentChangeCount)); - break; + return DataModel::Decode(reader, parentChangeCount); case Attributes::TxTotalCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txTotalCount)); - break; + return DataModel::Decode(reader, txTotalCount); case Attributes::TxUnicastCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txUnicastCount)); - break; + return DataModel::Decode(reader, txUnicastCount); case Attributes::TxBroadcastCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txBroadcastCount)); - break; + return DataModel::Decode(reader, txBroadcastCount); case Attributes::TxAckRequestedCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txAckRequestedCount)); - break; + return DataModel::Decode(reader, txAckRequestedCount); case Attributes::TxAckedCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txAckedCount)); - break; + return DataModel::Decode(reader, txAckedCount); case Attributes::TxNoAckRequestedCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txNoAckRequestedCount)); - break; + return DataModel::Decode(reader, txNoAckRequestedCount); case Attributes::TxDataCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txDataCount)); - break; + return DataModel::Decode(reader, txDataCount); case Attributes::TxDataPollCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txDataPollCount)); - break; + return DataModel::Decode(reader, txDataPollCount); case Attributes::TxBeaconCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txBeaconCount)); - break; + return DataModel::Decode(reader, txBeaconCount); case Attributes::TxBeaconRequestCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txBeaconRequestCount)); - break; + return DataModel::Decode(reader, txBeaconRequestCount); case Attributes::TxOtherCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txOtherCount)); - break; + return DataModel::Decode(reader, txOtherCount); case Attributes::TxRetryCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txRetryCount)); - break; + return DataModel::Decode(reader, txRetryCount); case Attributes::TxDirectMaxRetryExpiryCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txDirectMaxRetryExpiryCount)); - break; + return DataModel::Decode(reader, txDirectMaxRetryExpiryCount); case Attributes::TxIndirectMaxRetryExpiryCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txIndirectMaxRetryExpiryCount)); - break; + return DataModel::Decode(reader, txIndirectMaxRetryExpiryCount); case Attributes::TxErrCcaCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txErrCcaCount)); - break; + return DataModel::Decode(reader, txErrCcaCount); case Attributes::TxErrAbortCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txErrAbortCount)); - break; + return DataModel::Decode(reader, txErrAbortCount); case Attributes::TxErrBusyChannelCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txErrBusyChannelCount)); - break; + return DataModel::Decode(reader, txErrBusyChannelCount); case Attributes::RxTotalCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxTotalCount)); - break; + return DataModel::Decode(reader, rxTotalCount); case Attributes::RxUnicastCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxUnicastCount)); - break; + return DataModel::Decode(reader, rxUnicastCount); case Attributes::RxBroadcastCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxBroadcastCount)); - break; + return DataModel::Decode(reader, rxBroadcastCount); case Attributes::RxDataCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxDataCount)); - break; + return DataModel::Decode(reader, rxDataCount); case Attributes::RxDataPollCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxDataPollCount)); - break; + return DataModel::Decode(reader, rxDataPollCount); case Attributes::RxBeaconCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxBeaconCount)); - break; + return DataModel::Decode(reader, rxBeaconCount); case Attributes::RxBeaconRequestCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxBeaconRequestCount)); - break; + return DataModel::Decode(reader, rxBeaconRequestCount); case Attributes::RxOtherCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxOtherCount)); - break; + return DataModel::Decode(reader, rxOtherCount); case Attributes::RxAddressFilteredCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxAddressFilteredCount)); - break; + return DataModel::Decode(reader, rxAddressFilteredCount); case Attributes::RxDestAddrFilteredCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxDestAddrFilteredCount)); - break; + return DataModel::Decode(reader, rxDestAddrFilteredCount); case Attributes::RxDuplicatedCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxDuplicatedCount)); - break; + return DataModel::Decode(reader, rxDuplicatedCount); case Attributes::RxErrNoFrameCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxErrNoFrameCount)); - break; + return DataModel::Decode(reader, rxErrNoFrameCount); case Attributes::RxErrUnknownNeighborCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxErrUnknownNeighborCount)); - break; + return DataModel::Decode(reader, rxErrUnknownNeighborCount); case Attributes::RxErrInvalidSrcAddrCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxErrInvalidSrcAddrCount)); - break; + return DataModel::Decode(reader, rxErrInvalidSrcAddrCount); case Attributes::RxErrSecCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxErrSecCount)); - break; + return DataModel::Decode(reader, rxErrSecCount); case Attributes::RxErrFcsCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxErrFcsCount)); - break; + return DataModel::Decode(reader, rxErrFcsCount); case Attributes::RxErrOtherCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rxErrOtherCount)); - break; + return DataModel::Decode(reader, rxErrOtherCount); case Attributes::ActiveTimestamp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeTimestamp)); - break; + return DataModel::Decode(reader, activeTimestamp); case Attributes::PendingTimestamp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, pendingTimestamp)); - break; + return DataModel::Decode(reader, pendingTimestamp); case Attributes::Delay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, delay)); - break; + return DataModel::Decode(reader, delay); case Attributes::SecurityPolicy::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, securityPolicy)); - break; + return DataModel::Decode(reader, securityPolicy); case Attributes::ChannelPage0Mask::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, channelPage0Mask)); - break; + return DataModel::Decode(reader, channelPage0Mask); case Attributes::OperationalDatasetComponents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalDatasetComponents)); - break; + return DataModel::Decode(reader, operationalDatasetComponents); case Attributes::ActiveNetworkFaultsList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeNetworkFaultsList)); - break; + return DataModel::Decode(reader, activeNetworkFaultsList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -7856,34 +7422,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kConnectionStatus), connectionStatus)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kConnectionStatus)) + { + err = DataModel::Decode(reader, connectionStatus); + } + else { - case to_underlying(Fields::kConnectionStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, connectionStatus)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ConnectionStatus. namespace NetworkFaultChange { @@ -7893,38 +7458,38 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrent), current)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPrevious), previous)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCurrent)) { - case to_underlying(Fields::kCurrent): - ReturnErrorOnFailure(DataModel::Decode(reader, current)); - break; - case to_underlying(Fields::kPrevious): - ReturnErrorOnFailure(DataModel::Decode(reader, previous)); - break; - default: - break; + err = DataModel::Decode(reader, current); } - } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; -} + else if (__context_tag == to_underlying(Fields::kPrevious)) + { + err = DataModel::Decode(reader, previous); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} } // namespace NetworkFaultChange. } // namespace Events @@ -7937,31 +7502,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ResetCounts. } // namespace Commands @@ -7972,67 +7526,46 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Bssid::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, bssid)); - break; + return DataModel::Decode(reader, bssid); case Attributes::SecurityType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, securityType)); - break; + return DataModel::Decode(reader, securityType); case Attributes::WiFiVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wiFiVersion)); - break; + return DataModel::Decode(reader, wiFiVersion); case Attributes::ChannelNumber::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, channelNumber)); - break; + return DataModel::Decode(reader, channelNumber); case Attributes::Rssi::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rssi)); - break; + return DataModel::Decode(reader, rssi); case Attributes::BeaconLostCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, beaconLostCount)); - break; + return DataModel::Decode(reader, beaconLostCount); case Attributes::BeaconRxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, beaconRxCount)); - break; + return DataModel::Decode(reader, beaconRxCount); case Attributes::PacketMulticastRxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, packetMulticastRxCount)); - break; + return DataModel::Decode(reader, packetMulticastRxCount); case Attributes::PacketMulticastTxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, packetMulticastTxCount)); - break; + return DataModel::Decode(reader, packetMulticastTxCount); case Attributes::PacketUnicastRxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, packetUnicastRxCount)); - break; + return DataModel::Decode(reader, packetUnicastRxCount); case Attributes::PacketUnicastTxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, packetUnicastTxCount)); - break; + return DataModel::Decode(reader, packetUnicastTxCount); case Attributes::CurrentMaxRate::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMaxRate)); - break; + return DataModel::Decode(reader, currentMaxRate); case Attributes::OverrunCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, overrunCount)); - break; + return DataModel::Decode(reader, overrunCount); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -8043,34 +7576,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReasonCode), reasonCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReasonCode)) { - continue; + err = DataModel::Decode(reader, reasonCode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kReasonCode): - ReturnErrorOnFailure(DataModel::Decode(reader, reasonCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Disconnection. namespace AssociationFailure { @@ -8080,37 +7612,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAssociationFailure), associationFailure)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAssociationFailure)) { - continue; + err = DataModel::Decode(reader, associationFailure); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else { - case to_underlying(Fields::kAssociationFailure): - ReturnErrorOnFailure(DataModel::Decode(reader, associationFailure)); - break; - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AssociationFailure. namespace ConnectionStatus { @@ -8119,34 +7651,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kConnectionStatus), connectionStatus)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kConnectionStatus)) + { + err = DataModel::Decode(reader, connectionStatus); + } + else { - case to_underlying(Fields::kConnectionStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, connectionStatus)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ConnectionStatus. } // namespace Events @@ -8160,31 +7691,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ResetCounts. } // namespace Commands @@ -8195,55 +7715,38 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::PHYRate::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, PHYRate)); - break; + return DataModel::Decode(reader, PHYRate); case Attributes::FullDuplex::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, fullDuplex)); - break; + return DataModel::Decode(reader, fullDuplex); case Attributes::PacketRxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, packetRxCount)); - break; + return DataModel::Decode(reader, packetRxCount); case Attributes::PacketTxCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, packetTxCount)); - break; + return DataModel::Decode(reader, packetTxCount); case Attributes::TxErrCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, txErrCount)); - break; + return DataModel::Decode(reader, txErrCount); case Attributes::CollisionCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, collisionCount)); - break; + return DataModel::Decode(reader, collisionCount); case Attributes::OverrunCount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, overrunCount)); - break; + return DataModel::Decode(reader, overrunCount); case Attributes::CarrierDetect::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, carrierDetect)); - break; + return DataModel::Decode(reader, carrierDetect); case Attributes::TimeSinceReset::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, timeSinceReset)); - break; + return DataModel::Decode(reader, timeSinceReset); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -8266,37 +7769,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOffset)) + { + err = DataModel::Decode(reader, offset); + } + else if (__context_tag == to_underlying(Fields::kValidStarting)) + { + err = DataModel::Decode(reader, validStarting); + } + else if (__context_tag == to_underlying(Fields::kValidUntil)) + { + err = DataModel::Decode(reader, validUntil); + } + else { - case to_underlying(Fields::kOffset): - ReturnErrorOnFailure(DataModel::Decode(reader, offset)); - break; - case to_underlying(Fields::kValidStarting): - ReturnErrorOnFailure(DataModel::Decode(reader, validStarting)); - break; - case to_underlying(Fields::kValidUntil): - ReturnErrorOnFailure(DataModel::Decode(reader, validUntil)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DSTOffsetStruct @@ -8313,34 +7815,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNodeID)) { - continue; + err = DataModel::Decode(reader, nodeID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else { - case to_underlying(Fields::kNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, nodeID)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace FabricScopedTrustedTimeSourceStruct @@ -8358,37 +7858,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOffset)) + { + err = DataModel::Decode(reader, offset); + } + else if (__context_tag == to_underlying(Fields::kValidAt)) + { + err = DataModel::Decode(reader, validAt); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else { - case to_underlying(Fields::kOffset): - ReturnErrorOnFailure(DataModel::Decode(reader, offset)); - break; - case to_underlying(Fields::kValidAt): - ReturnErrorOnFailure(DataModel::Decode(reader, validAt)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TimeZoneStruct @@ -8406,37 +7905,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else if (__context_tag == to_underlying(Fields::kNodeID)) + { + err = DataModel::Decode(reader, nodeID); + } + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - case to_underlying(Fields::kNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, nodeID)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TrustedTimeSourceStruct @@ -8451,40 +7949,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUTCTime), UTCTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGranularity), granularity)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTimeSource), timeSource)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUTCTime)) + { + err = DataModel::Decode(reader, UTCTime); + } + else if (__context_tag == to_underlying(Fields::kGranularity)) + { + err = DataModel::Decode(reader, granularity); + } + else if (__context_tag == to_underlying(Fields::kTimeSource)) + { + err = DataModel::Decode(reader, timeSource); + } + else { - case to_underlying(Fields::kUTCTime): - ReturnErrorOnFailure(DataModel::Decode(reader, UTCTime)); - break; - case to_underlying(Fields::kGranularity): - ReturnErrorOnFailure(DataModel::Decode(reader, granularity)); - break; - case to_underlying(Fields::kTimeSource): - ReturnErrorOnFailure(DataModel::Decode(reader, timeSource)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetUTCTime. namespace SetTrustedTimeSource { @@ -8493,34 +7992,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTrustedTimeSource), trustedTimeSource)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTrustedTimeSource)) + { + err = DataModel::Decode(reader, trustedTimeSource); + } + else { - case to_underlying(Fields::kTrustedTimeSource): - ReturnErrorOnFailure(DataModel::Decode(reader, trustedTimeSource)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetTrustedTimeSource. namespace SetTimeZone { @@ -8529,34 +8027,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTimeZone), timeZone)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTimeZone)) + { + err = DataModel::Decode(reader, timeZone); + } + else { - case to_underlying(Fields::kTimeZone): - ReturnErrorOnFailure(DataModel::Decode(reader, timeZone)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetTimeZone. namespace SetTimeZoneResponse { @@ -8565,34 +8062,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDSTOffsetRequired), DSTOffsetRequired)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDSTOffsetRequired)) + { + err = DataModel::Decode(reader, DSTOffsetRequired); + } + else { - case to_underlying(Fields::kDSTOffsetRequired): - ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffsetRequired)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetTimeZoneResponse. namespace SetDSTOffset { @@ -8601,34 +8097,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDSTOffset), DSTOffset)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDSTOffset)) + { + err = DataModel::Decode(reader, DSTOffset); + } + else { - case to_underlying(Fields::kDSTOffset): - ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffset)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetDSTOffset. namespace SetDefaultNTP { @@ -8637,34 +8132,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDefaultNTP), defaultNTP)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDefaultNTP)) + { + err = DataModel::Decode(reader, defaultNTP); + } + else { - case to_underlying(Fields::kDefaultNTP): - ReturnErrorOnFailure(DataModel::Decode(reader, defaultNTP)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetDefaultNTP. } // namespace Commands @@ -8675,67 +8169,46 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::UTCTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, UTCTime)); - break; + return DataModel::Decode(reader, UTCTime); case Attributes::Granularity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, granularity)); - break; + return DataModel::Decode(reader, granularity); case Attributes::TimeSource::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, timeSource)); - break; + return DataModel::Decode(reader, timeSource); case Attributes::TrustedTimeSource::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, trustedTimeSource)); - break; + return DataModel::Decode(reader, trustedTimeSource); case Attributes::DefaultNTP::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, defaultNTP)); - break; + return DataModel::Decode(reader, defaultNTP); case Attributes::TimeZone::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, timeZone)); - break; + return DataModel::Decode(reader, timeZone); case Attributes::DSTOffset::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffset)); - break; + return DataModel::Decode(reader, DSTOffset); case Attributes::LocalTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, localTime)); - break; + return DataModel::Decode(reader, localTime); case Attributes::TimeZoneDatabase::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, timeZoneDatabase)); - break; + return DataModel::Decode(reader, timeZoneDatabase); case Attributes::NTPServerAvailable::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, NTPServerAvailable)); - break; + return DataModel::Decode(reader, NTPServerAvailable); case Attributes::TimeZoneListMaxSize::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, timeZoneListMaxSize)); - break; + return DataModel::Decode(reader, timeZoneListMaxSize); case Attributes::DSTOffsetListMaxSize::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffsetListMaxSize)); - break; + return DataModel::Decode(reader, DSTOffsetListMaxSize); case Attributes::SupportsDNSResolve::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportsDNSResolve)); - break; + return DataModel::Decode(reader, supportsDNSResolve); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -8745,31 +8218,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace DSTTableEmpty. namespace DSTStatus { @@ -8778,34 +8240,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDSTOffsetActive), DSTOffsetActive)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDSTOffsetActive)) + { + err = DataModel::Decode(reader, DSTOffsetActive); + } + else { - case to_underlying(Fields::kDSTOffsetActive): - ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffsetActive)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DSTStatus. namespace TimeZoneStatus { @@ -8815,37 +8276,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOffset), offset)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kName), name)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOffset)) + { + err = DataModel::Decode(reader, offset); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else { - case to_underlying(Fields::kOffset): - ReturnErrorOnFailure(DataModel::Decode(reader, offset)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TimeZoneStatus. namespace TimeFailure { @@ -8853,31 +8314,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace TimeFailure. namespace MissingTrustedTimeSource { @@ -8885,31 +8335,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace MissingTrustedTimeSource. } // namespace Events @@ -8930,34 +8369,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFinish)) + { + err = DataModel::Decode(reader, finish); + } + else if (__context_tag == to_underlying(Fields::kPrimaryColor)) + { + err = DataModel::Decode(reader, primaryColor); + } + else { - case to_underlying(Fields::kFinish): - ReturnErrorOnFailure(DataModel::Decode(reader, finish)); - break; - case to_underlying(Fields::kPrimaryColor): - ReturnErrorOnFailure(DataModel::Decode(reader, primaryColor)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ProductAppearanceStruct @@ -8971,76 +8408,52 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::VendorName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorName)); - break; + return DataModel::Decode(reader, vendorName); case Attributes::VendorID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorID)); - break; + return DataModel::Decode(reader, vendorID); case Attributes::ProductName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productName)); - break; + return DataModel::Decode(reader, productName); case Attributes::NodeLabel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nodeLabel)); - break; + return DataModel::Decode(reader, nodeLabel); case Attributes::HardwareVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersion)); - break; + return DataModel::Decode(reader, hardwareVersion); case Attributes::HardwareVersionString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersionString)); - break; + return DataModel::Decode(reader, hardwareVersionString); case Attributes::SoftwareVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; + return DataModel::Decode(reader, softwareVersion); case Attributes::SoftwareVersionString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersionString)); - break; + return DataModel::Decode(reader, softwareVersionString); case Attributes::ManufacturingDate::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, manufacturingDate)); - break; + return DataModel::Decode(reader, manufacturingDate); case Attributes::PartNumber::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, partNumber)); - break; + return DataModel::Decode(reader, partNumber); case Attributes::ProductURL::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productURL)); - break; + return DataModel::Decode(reader, productURL); case Attributes::ProductLabel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productLabel)); - break; + return DataModel::Decode(reader, productLabel); case Attributes::SerialNumber::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, serialNumber)); - break; + return DataModel::Decode(reader, serialNumber); case Attributes::Reachable::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reachable)); - break; + return DataModel::Decode(reader, reachable); case Attributes::UniqueID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uniqueID)); - break; + return DataModel::Decode(reader, uniqueID); case Attributes::ProductAppearance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productAppearance)); - break; + return DataModel::Decode(reader, productAppearance); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -9051,34 +8464,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSoftwareVersion), softwareVersion)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSoftwareVersion)) + { + err = DataModel::Decode(reader, softwareVersion); + } + else { - case to_underlying(Fields::kSoftwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StartUp. namespace ShutDown { @@ -9086,31 +8498,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ShutDown. namespace Leave { @@ -9118,31 +8519,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Leave. namespace ReachableChanged { @@ -9151,34 +8541,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReachableNewValue), reachableNewValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReachableNewValue)) + { + err = DataModel::Decode(reader, reachableNewValue); + } + else { - case to_underlying(Fields::kReachableNewValue): - ReturnErrorOnFailure(DataModel::Decode(reader, reachableNewValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ReachableChanged. } // namespace Events @@ -9194,37 +8583,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::NumberOfPositions::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfPositions)); - break; + return DataModel::Decode(reader, numberOfPositions); case Attributes::CurrentPosition::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPosition)); - break; + return DataModel::Decode(reader, currentPosition); case Attributes::MultiPressMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, multiPressMax)); - break; + return DataModel::Decode(reader, multiPressMax); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -9235,34 +8613,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewPosition)) + { + err = DataModel::Decode(reader, newPosition); + } + else { - case to_underlying(Fields::kNewPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, newPosition)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SwitchLatched. namespace InitialPress { @@ -9271,34 +8648,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewPosition)) { - continue; + err = DataModel::Decode(reader, newPosition); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kNewPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, newPosition)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace InitialPress. namespace LongPress { @@ -9307,34 +8683,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewPosition)) + { + err = DataModel::Decode(reader, newPosition); + } + else { - case to_underlying(Fields::kNewPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, newPosition)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LongPress. namespace ShortRelease { @@ -9343,34 +8718,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPreviousPosition), previousPosition)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPreviousPosition)) { - continue; + err = DataModel::Decode(reader, previousPosition); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kPreviousPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, previousPosition)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ShortRelease. namespace LongRelease { @@ -9379,34 +8753,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPreviousPosition), previousPosition)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPreviousPosition)) + { + err = DataModel::Decode(reader, previousPosition); + } + else { - case to_underlying(Fields::kPreviousPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, previousPosition)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LongRelease. namespace MultiPressOngoing { @@ -9417,37 +8790,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewPosition), newPosition)); ReturnErrorOnFailure( DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCurrentNumberOfPressesCounted), currentNumberOfPressesCounted)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewPosition)) { - continue; + err = DataModel::Decode(reader, newPosition); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kCurrentNumberOfPressesCounted)) + { + err = DataModel::Decode(reader, currentNumberOfPressesCounted); + } + else { - case to_underlying(Fields::kNewPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, newPosition)); - break; - case to_underlying(Fields::kCurrentNumberOfPressesCounted): - ReturnErrorOnFailure(DataModel::Decode(reader, currentNumberOfPressesCounted)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MultiPressOngoing. namespace MultiPressComplete { @@ -9458,37 +8831,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPreviousPosition), previousPosition)); ReturnErrorOnFailure( DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTotalNumberOfPressesCounted), totalNumberOfPressesCounted)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPreviousPosition)) + { + err = DataModel::Decode(reader, previousPosition); + } + else if (__context_tag == to_underlying(Fields::kTotalNumberOfPressesCounted)) + { + err = DataModel::Decode(reader, totalNumberOfPressesCounted); + } + else { - case to_underlying(Fields::kPreviousPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, previousPosition)); - break; - case to_underlying(Fields::kTotalNumberOfPressesCounted): - ReturnErrorOnFailure(DataModel::Decode(reader, totalNumberOfPressesCounted)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MultiPressComplete. } // namespace Events @@ -9507,46 +8880,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDiscriminator), discriminator)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIterations), iterations)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSalt), salt)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCommissioningTimeout)) + { + err = DataModel::Decode(reader, commissioningTimeout); + } + else if (__context_tag == to_underlying(Fields::kPAKEPasscodeVerifier)) + { + err = DataModel::Decode(reader, PAKEPasscodeVerifier); + } + else if (__context_tag == to_underlying(Fields::kDiscriminator)) + { + err = DataModel::Decode(reader, discriminator); + } + else if (__context_tag == to_underlying(Fields::kIterations)) + { + err = DataModel::Decode(reader, iterations); + } + else if (__context_tag == to_underlying(Fields::kSalt)) + { + err = DataModel::Decode(reader, salt); + } + else { - case to_underlying(Fields::kCommissioningTimeout): - ReturnErrorOnFailure(DataModel::Decode(reader, commissioningTimeout)); - break; - case to_underlying(Fields::kPAKEPasscodeVerifier): - ReturnErrorOnFailure(DataModel::Decode(reader, PAKEPasscodeVerifier)); - break; - case to_underlying(Fields::kDiscriminator): - ReturnErrorOnFailure(DataModel::Decode(reader, discriminator)); - break; - case to_underlying(Fields::kIterations): - ReturnErrorOnFailure(DataModel::Decode(reader, iterations)); - break; - case to_underlying(Fields::kSalt): - ReturnErrorOnFailure(DataModel::Decode(reader, salt)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OpenCommissioningWindow. namespace OpenBasicCommissioningWindow { @@ -9555,34 +8931,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCommissioningTimeout), commissioningTimeout)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kCommissioningTimeout): - ReturnErrorOnFailure(DataModel::Decode(reader, commissioningTimeout)); - break; - default: - break; + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCommissioningTimeout)) + { + err = DataModel::Decode(reader, commissioningTimeout); + } + else + { } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OpenBasicCommissioningWindow. namespace RevokeCommissioning { @@ -9590,31 +8965,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace RevokeCommissioning. } // namespace Commands @@ -9625,37 +8989,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::WindowStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, windowStatus)); - break; + return DataModel::Decode(reader, windowStatus); case Attributes::AdminFabricIndex::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, adminFabricIndex)); - break; + return DataModel::Decode(reader, adminFabricIndex); case Attributes::AdminVendorId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, adminVendorId)); - break; + return DataModel::Decode(reader, adminVendorId); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -9694,46 +9047,48 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRootPublicKey)) { - continue; + err = DataModel::Decode(reader, rootPublicKey); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kVendorID)) + { + err = DataModel::Decode(reader, vendorID); + } + else if (__context_tag == to_underlying(Fields::kFabricID)) + { + err = DataModel::Decode(reader, fabricID); + } + else if (__context_tag == to_underlying(Fields::kNodeID)) + { + err = DataModel::Decode(reader, nodeID); + } + else if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kRootPublicKey): - ReturnErrorOnFailure(DataModel::Decode(reader, rootPublicKey)); - break; - case to_underlying(Fields::kVendorID): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorID)); - break; - case to_underlying(Fields::kFabricID): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricID)); - break; - case to_underlying(Fields::kNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, nodeID)); - break; - case to_underlying(Fields::kLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, label)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace FabricDescriptorStruct @@ -9771,37 +9126,36 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNoc)) + { + err = DataModel::Decode(reader, noc); + } + else if (__context_tag == to_underlying(Fields::kIcac)) + { + err = DataModel::Decode(reader, icac); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kNoc): - ReturnErrorOnFailure(DataModel::Decode(reader, noc)); - break; - case to_underlying(Fields::kIcac): - ReturnErrorOnFailure(DataModel::Decode(reader, icac)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NOCStruct @@ -9814,34 +9168,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAttestationNonce), attestationNonce)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAttestationNonce)) + { + err = DataModel::Decode(reader, attestationNonce); + } + else { - case to_underlying(Fields::kAttestationNonce): - ReturnErrorOnFailure(DataModel::Decode(reader, attestationNonce)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AttestationRequest. namespace AttestationResponse { @@ -9851,37 +9204,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAttestationElements), attestationElements)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAttestationSignature), attestationSignature)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAttestationElements)) + { + err = DataModel::Decode(reader, attestationElements); + } + else if (__context_tag == to_underlying(Fields::kAttestationSignature)) + { + err = DataModel::Decode(reader, attestationSignature); + } + else { - case to_underlying(Fields::kAttestationElements): - ReturnErrorOnFailure(DataModel::Decode(reader, attestationElements)); - break; - case to_underlying(Fields::kAttestationSignature): - ReturnErrorOnFailure(DataModel::Decode(reader, attestationSignature)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AttestationResponse. namespace CertificateChainRequest { @@ -9890,34 +9243,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCertificateType), certificateType)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCertificateType)) { - continue; + err = DataModel::Decode(reader, certificateType); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kCertificateType): - ReturnErrorOnFailure(DataModel::Decode(reader, certificateType)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CertificateChainRequest. namespace CertificateChainResponse { @@ -9926,34 +9278,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCertificate), certificate)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCertificate)) { - continue; + err = DataModel::Decode(reader, certificate); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kCertificate): - ReturnErrorOnFailure(DataModel::Decode(reader, certificate)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CertificateChainResponse. namespace CSRRequest { @@ -9963,37 +9314,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCSRNonce), CSRNonce)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIsForUpdateNOC), isForUpdateNOC)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCSRNonce)) { - continue; + err = DataModel::Decode(reader, CSRNonce); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kIsForUpdateNOC)) + { + err = DataModel::Decode(reader, isForUpdateNOC); + } + else { - case to_underlying(Fields::kCSRNonce): - ReturnErrorOnFailure(DataModel::Decode(reader, CSRNonce)); - break; - case to_underlying(Fields::kIsForUpdateNOC): - ReturnErrorOnFailure(DataModel::Decode(reader, isForUpdateNOC)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CSRRequest. namespace CSRResponse { @@ -10003,37 +9354,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNOCSRElements), NOCSRElements)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAttestationSignature), attestationSignature)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNOCSRElements)) + { + err = DataModel::Decode(reader, NOCSRElements); + } + else if (__context_tag == to_underlying(Fields::kAttestationSignature)) + { + err = DataModel::Decode(reader, attestationSignature); + } + else { - case to_underlying(Fields::kNOCSRElements): - ReturnErrorOnFailure(DataModel::Decode(reader, NOCSRElements)); - break; - case to_underlying(Fields::kAttestationSignature): - ReturnErrorOnFailure(DataModel::Decode(reader, attestationSignature)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CSRResponse. namespace AddNOC { @@ -10046,46 +9397,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIPKValue), IPKValue)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCaseAdminSubject), caseAdminSubject)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAdminVendorId), adminVendorId)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNOCValue)) { - continue; + err = DataModel::Decode(reader, NOCValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kICACValue)) + { + err = DataModel::Decode(reader, ICACValue); + } + else if (__context_tag == to_underlying(Fields::kIPKValue)) + { + err = DataModel::Decode(reader, IPKValue); + } + else if (__context_tag == to_underlying(Fields::kCaseAdminSubject)) + { + err = DataModel::Decode(reader, caseAdminSubject); + } + else if (__context_tag == to_underlying(Fields::kAdminVendorId)) + { + err = DataModel::Decode(reader, adminVendorId); + } + else { - case to_underlying(Fields::kNOCValue): - ReturnErrorOnFailure(DataModel::Decode(reader, NOCValue)); - break; - case to_underlying(Fields::kICACValue): - ReturnErrorOnFailure(DataModel::Decode(reader, ICACValue)); - break; - case to_underlying(Fields::kIPKValue): - ReturnErrorOnFailure(DataModel::Decode(reader, IPKValue)); - break; - case to_underlying(Fields::kCaseAdminSubject): - ReturnErrorOnFailure(DataModel::Decode(reader, caseAdminSubject)); - break; - case to_underlying(Fields::kAdminVendorId): - ReturnErrorOnFailure(DataModel::Decode(reader, adminVendorId)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddNOC. namespace UpdateNOC { @@ -10095,37 +9449,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNOCValue), NOCValue)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kICACValue), ICACValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNOCValue)) { - continue; + err = DataModel::Decode(reader, NOCValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kICACValue)) + { + err = DataModel::Decode(reader, ICACValue); + } + else { - case to_underlying(Fields::kNOCValue): - ReturnErrorOnFailure(DataModel::Decode(reader, NOCValue)); - break; - case to_underlying(Fields::kICACValue): - ReturnErrorOnFailure(DataModel::Decode(reader, ICACValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace UpdateNOC. namespace NOCResponse { @@ -10136,40 +9490,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusCode), statusCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDebugText), debugText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatusCode)) + { + err = DataModel::Decode(reader, statusCode); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else if (__context_tag == to_underlying(Fields::kDebugText)) + { + err = DataModel::Decode(reader, debugText); + } + else { - case to_underlying(Fields::kStatusCode): - ReturnErrorOnFailure(DataModel::Decode(reader, statusCode)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - case to_underlying(Fields::kDebugText): - ReturnErrorOnFailure(DataModel::Decode(reader, debugText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NOCResponse. namespace UpdateFabricLabel { @@ -10178,34 +9533,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLabel), label)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else { - case to_underlying(Fields::kLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, label)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace UpdateFabricLabel. namespace RemoveFabric { @@ -10214,34 +9568,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RemoveFabric. namespace AddTrustedRootCertificate { @@ -10250,34 +9603,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRootCACertificate), rootCACertificate)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRootCACertificate)) + { + err = DataModel::Decode(reader, rootCACertificate); + } + else { - case to_underlying(Fields::kRootCACertificate): - ReturnErrorOnFailure(DataModel::Decode(reader, rootCACertificate)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddTrustedRootCertificate. } // namespace Commands @@ -10288,46 +9640,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::NOCs::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, NOCs)); - break; + return DataModel::Decode(reader, NOCs); case Attributes::Fabrics::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, fabrics)); - break; + return DataModel::Decode(reader, fabrics); case Attributes::SupportedFabrics::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedFabrics)); - break; + return DataModel::Decode(reader, supportedFabrics); case Attributes::CommissionedFabrics::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, commissionedFabrics)); - break; + return DataModel::Decode(reader, commissionedFabrics); case Attributes::TrustedRootCertificates::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, trustedRootCertificates)); - break; + return DataModel::Decode(reader, trustedRootCertificates); case Attributes::CurrentFabricIndex::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentFabricIndex)); - break; + return DataModel::Decode(reader, currentFabricIndex); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -10364,40 +9702,40 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupId)) + { + err = DataModel::Decode(reader, groupId); + } + else if (__context_tag == to_underlying(Fields::kEndpoints)) + { + err = DataModel::Decode(reader, endpoints); + } + else if (__context_tag == to_underlying(Fields::kGroupName)) + { + err = DataModel::Decode(reader, groupName); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kGroupId): - ReturnErrorOnFailure(DataModel::Decode(reader, groupId)); - break; - case to_underlying(Fields::kEndpoints): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoints)); - break; - case to_underlying(Fields::kGroupName): - ReturnErrorOnFailure(DataModel::Decode(reader, groupName)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GroupInfoMapStruct @@ -10428,37 +9766,36 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupId)) + { + err = DataModel::Decode(reader, groupId); + } + else if (__context_tag == to_underlying(Fields::kGroupKeySetID)) + { + err = DataModel::Decode(reader, groupKeySetID); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kGroupId): - ReturnErrorOnFailure(DataModel::Decode(reader, groupId)); - break; - case to_underlying(Fields::kGroupKeySetID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GroupKeyMapStruct @@ -10481,52 +9818,56 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kGroupKeySetID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); - break; - case to_underlying(Fields::kGroupKeySecurityPolicy): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySecurityPolicy)); - break; - case to_underlying(Fields::kEpochKey0): - ReturnErrorOnFailure(DataModel::Decode(reader, epochKey0)); - break; - case to_underlying(Fields::kEpochStartTime0): - ReturnErrorOnFailure(DataModel::Decode(reader, epochStartTime0)); - break; - case to_underlying(Fields::kEpochKey1): - ReturnErrorOnFailure(DataModel::Decode(reader, epochKey1)); - break; - case to_underlying(Fields::kEpochStartTime1): - ReturnErrorOnFailure(DataModel::Decode(reader, epochStartTime1)); - break; - case to_underlying(Fields::kEpochKey2): - ReturnErrorOnFailure(DataModel::Decode(reader, epochKey2)); - break; - case to_underlying(Fields::kEpochStartTime2): - ReturnErrorOnFailure(DataModel::Decode(reader, epochStartTime2)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kGroupKeySetID)) + { + err = DataModel::Decode(reader, groupKeySetID); + } + else if (__context_tag == to_underlying(Fields::kGroupKeySecurityPolicy)) + { + err = DataModel::Decode(reader, groupKeySecurityPolicy); + } + else if (__context_tag == to_underlying(Fields::kEpochKey0)) + { + err = DataModel::Decode(reader, epochKey0); + } + else if (__context_tag == to_underlying(Fields::kEpochStartTime0)) + { + err = DataModel::Decode(reader, epochStartTime0); + } + else if (__context_tag == to_underlying(Fields::kEpochKey1)) + { + err = DataModel::Decode(reader, epochKey1); + } + else if (__context_tag == to_underlying(Fields::kEpochStartTime1)) + { + err = DataModel::Decode(reader, epochStartTime1); + } + else if (__context_tag == to_underlying(Fields::kEpochKey2)) + { + err = DataModel::Decode(reader, epochKey2); + } + else if (__context_tag == to_underlying(Fields::kEpochStartTime2)) + { + err = DataModel::Decode(reader, epochStartTime2); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace GroupKeySetStruct @@ -10539,34 +9880,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupKeySet), groupKeySet)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupKeySet)) { - continue; + err = DataModel::Decode(reader, groupKeySet); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kGroupKeySet): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySet)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace KeySetWrite. namespace KeySetRead { @@ -10575,34 +9915,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupKeySetID), groupKeySetID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupKeySetID)) { - continue; + err = DataModel::Decode(reader, groupKeySetID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kGroupKeySetID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace KeySetRead. namespace KeySetReadResponse { @@ -10611,34 +9950,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupKeySet), groupKeySet)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupKeySet)) { - continue; + err = DataModel::Decode(reader, groupKeySet); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kGroupKeySet): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySet)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace KeySetReadResponse. namespace KeySetRemove { @@ -10647,34 +9985,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupKeySetID), groupKeySetID)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupKeySetID)) { - continue; + err = DataModel::Decode(reader, groupKeySetID); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kGroupKeySetID): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace KeySetRemove. namespace KeySetReadAllIndices { @@ -10682,31 +10019,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace KeySetReadAllIndices. namespace KeySetReadAllIndicesResponse { @@ -10715,34 +10041,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kGroupKeySetIDs), groupKeySetIDs)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kGroupKeySetIDs)) { - continue; + err = DataModel::Decode(reader, groupKeySetIDs); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kGroupKeySetIDs): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetIDs)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace KeySetReadAllIndicesResponse. } // namespace Commands @@ -10753,40 +10078,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GroupKeyMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeyMap)); - break; + return DataModel::Decode(reader, groupKeyMap); case Attributes::GroupTable::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, groupTable)); - break; + return DataModel::Decode(reader, groupTable); case Attributes::MaxGroupsPerFabric::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxGroupsPerFabric)); - break; + return DataModel::Decode(reader, maxGroupsPerFabric); case Attributes::MaxGroupKeysPerFabric::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxGroupKeysPerFabric)); - break; + return DataModel::Decode(reader, maxGroupKeysPerFabric); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -10804,31 +10117,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::LabelList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, labelList)); - break; + return DataModel::Decode(reader, labelList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -10846,31 +10150,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::LabelList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, labelList)); - break; + return DataModel::Decode(reader, labelList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -10887,28 +10182,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -10925,28 +10212,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -10963,28 +10242,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11001,31 +10272,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::StateValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, stateValue)); - break; + return DataModel::Decode(reader, stateValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11036,34 +10298,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStateValue), stateValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStateValue)) + { + err = DataModel::Decode(reader, stateValue); + } + else { - case to_underlying(Fields::kStateValue): - ReturnErrorOnFailure(DataModel::Decode(reader, stateValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StateChange. } // namespace Events @@ -11109,40 +10370,40 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCheckInNodeID)) + { + err = DataModel::Decode(reader, checkInNodeID); + } + else if (__context_tag == to_underlying(Fields::kMonitoredSubject)) + { + err = DataModel::Decode(reader, monitoredSubject); + } + else if (__context_tag == to_underlying(Fields::kKey)) + { + err = DataModel::Decode(reader, key); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else { - case to_underlying(Fields::kCheckInNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, checkInNodeID)); - break; - case to_underlying(Fields::kMonitoredSubject): - ReturnErrorOnFailure(DataModel::Decode(reader, monitoredSubject)); - break; - case to_underlying(Fields::kKey): - ReturnErrorOnFailure(DataModel::Decode(reader, key)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MonitoringRegistrationStruct @@ -11158,43 +10419,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMonitoredSubject), monitoredSubject)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kKey), key)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kVerificationKey), verificationKey)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCheckInNodeID)) + { + err = DataModel::Decode(reader, checkInNodeID); + } + else if (__context_tag == to_underlying(Fields::kMonitoredSubject)) + { + err = DataModel::Decode(reader, monitoredSubject); + } + else if (__context_tag == to_underlying(Fields::kKey)) + { + err = DataModel::Decode(reader, key); + } + else if (__context_tag == to_underlying(Fields::kVerificationKey)) + { + err = DataModel::Decode(reader, verificationKey); + } + else { - case to_underlying(Fields::kCheckInNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, checkInNodeID)); - break; - case to_underlying(Fields::kMonitoredSubject): - ReturnErrorOnFailure(DataModel::Decode(reader, monitoredSubject)); - break; - case to_underlying(Fields::kKey): - ReturnErrorOnFailure(DataModel::Decode(reader, key)); - break; - case to_underlying(Fields::kVerificationKey): - ReturnErrorOnFailure(DataModel::Decode(reader, verificationKey)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RegisterClient. namespace RegisterClientResponse { @@ -11203,34 +10466,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kICDCounter), ICDCounter)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kICDCounter)) { - continue; + err = DataModel::Decode(reader, ICDCounter); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kICDCounter): - ReturnErrorOnFailure(DataModel::Decode(reader, ICDCounter)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RegisterClientResponse. namespace UnregisterClient { @@ -11240,37 +10502,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCheckInNodeID), checkInNodeID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kVerificationKey), verificationKey)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCheckInNodeID)) + { + err = DataModel::Decode(reader, checkInNodeID); + } + else if (__context_tag == to_underlying(Fields::kVerificationKey)) + { + err = DataModel::Decode(reader, verificationKey); + } + else { - case to_underlying(Fields::kCheckInNodeID): - ReturnErrorOnFailure(DataModel::Decode(reader, checkInNodeID)); - break; - case to_underlying(Fields::kVerificationKey): - ReturnErrorOnFailure(DataModel::Decode(reader, verificationKey)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace UnregisterClient. namespace StayActiveRequest { @@ -11278,31 +10540,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace StayActiveRequest. } // namespace Commands @@ -11313,46 +10564,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::IdleModeInterval::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, idleModeInterval)); - break; + return DataModel::Decode(reader, idleModeInterval); case Attributes::ActiveModeInterval::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeModeInterval)); - break; + return DataModel::Decode(reader, activeModeInterval); case Attributes::ActiveModeThreshold::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeModeThreshold)); - break; + return DataModel::Decode(reader, activeModeThreshold); case Attributes::RegisteredClients::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, registeredClients)); - break; + return DataModel::Decode(reader, registeredClients); case Attributes::ICDCounter::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ICDCounter)); - break; + return DataModel::Decode(reader, ICDCounter); case Attributes::ClientsSupportedPerFabric::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clientsSupportedPerFabric)); - break; + return DataModel::Decode(reader, clientsSupportedPerFabric); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11374,34 +10611,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMfgCode)) { - continue; + err = DataModel::Decode(reader, mfgCode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kMfgCode): - ReturnErrorOnFailure(DataModel::Decode(reader, mfgCode)); - break; - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SemanticTagStruct @@ -11419,37 +10654,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else if (__context_tag == to_underlying(Fields::kMode)) + { + err = DataModel::Decode(reader, mode); + } + else if (__context_tag == to_underlying(Fields::kSemanticTags)) + { + err = DataModel::Decode(reader, semanticTags); + } + else { - case to_underlying(Fields::kLabel): - ReturnErrorOnFailure(DataModel::Decode(reader, label)); - break; - case to_underlying(Fields::kMode): - ReturnErrorOnFailure(DataModel::Decode(reader, mode)); - break; - case to_underlying(Fields::kSemanticTags): - ReturnErrorOnFailure(DataModel::Decode(reader, semanticTags)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ModeOptionStruct @@ -11462,34 +10696,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewMode), newMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewMode)) + { + err = DataModel::Decode(reader, newMode); + } + else { - case to_underlying(Fields::kNewMode): - ReturnErrorOnFailure(DataModel::Decode(reader, newMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToMode. } // namespace Commands @@ -11500,46 +10733,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Description::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, description)); - break; + return DataModel::Decode(reader, description); case Attributes::StandardNamespace::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, standardNamespace)); - break; + return DataModel::Decode(reader, standardNamespace); case Attributes::SupportedModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); - break; + return DataModel::Decode(reader, supportedModes); case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); - break; + return DataModel::Decode(reader, currentMode); case Attributes::StartUpMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); - break; + return DataModel::Decode(reader, startUpMode); case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); - break; + return DataModel::Decode(reader, onMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11556,34 +10775,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewMode), newMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewMode)) { - continue; + err = DataModel::Decode(reader, newMode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kNewMode): - ReturnErrorOnFailure(DataModel::Decode(reader, newMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToMode. namespace ChangeToModeResponse { @@ -11593,37 +10811,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusText), statusText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStatusText)) + { + err = DataModel::Decode(reader, statusText); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kStatusText): - ReturnErrorOnFailure(DataModel::Decode(reader, statusText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToModeResponse. } // namespace Commands @@ -11634,40 +10852,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SupportedModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); - break; + return DataModel::Decode(reader, supportedModes); case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); - break; + return DataModel::Decode(reader, currentMode); case Attributes::StartUpMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); - break; + return DataModel::Decode(reader, startUpMode); case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); - break; + return DataModel::Decode(reader, onMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11684,34 +10890,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewMode), newMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewMode)) + { + err = DataModel::Decode(reader, newMode); + } + else { - case to_underlying(Fields::kNewMode): - ReturnErrorOnFailure(DataModel::Decode(reader, newMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToMode. namespace ChangeToModeResponse { @@ -11721,37 +10926,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusText), statusText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kStatusText)) + { + err = DataModel::Decode(reader, statusText); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kStatusText): - ReturnErrorOnFailure(DataModel::Decode(reader, statusText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToModeResponse. } // namespace Commands @@ -11762,40 +10967,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SupportedModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); - break; + return DataModel::Decode(reader, supportedModes); case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); - break; + return DataModel::Decode(reader, currentMode); case Attributes::StartUpMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); - break; + return DataModel::Decode(reader, startUpMode); case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); - break; + return DataModel::Decode(reader, onMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11812,40 +11005,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SpinSpeeds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, spinSpeeds)); - break; + return DataModel::Decode(reader, spinSpeeds); case Attributes::SpinSpeedCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, spinSpeedCurrent)); - break; + return DataModel::Decode(reader, spinSpeedCurrent); case Attributes::NumberOfRinses::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfRinses)); - break; + return DataModel::Decode(reader, numberOfRinses); case Attributes::SupportedRinses::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedRinses)); - break; + return DataModel::Decode(reader, supportedRinses); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11862,34 +11043,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewMode), newMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewMode)) + { + err = DataModel::Decode(reader, newMode); + } + else { - case to_underlying(Fields::kNewMode): - ReturnErrorOnFailure(DataModel::Decode(reader, newMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToMode. namespace ChangeToModeResponse { @@ -11899,37 +11079,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusText), statusText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kStatusText)) + { + err = DataModel::Decode(reader, statusText); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kStatusText): - ReturnErrorOnFailure(DataModel::Decode(reader, statusText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToModeResponse. } // namespace Commands @@ -11940,40 +11120,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SupportedModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); - break; + return DataModel::Decode(reader, supportedModes); case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); - break; + return DataModel::Decode(reader, currentMode); case Attributes::StartUpMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); - break; + return DataModel::Decode(reader, startUpMode); case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); - break; + return DataModel::Decode(reader, onMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -11990,34 +11158,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewMode), newMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewMode)) + { + err = DataModel::Decode(reader, newMode); + } + else { - case to_underlying(Fields::kNewMode): - ReturnErrorOnFailure(DataModel::Decode(reader, newMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToMode. namespace ChangeToModeResponse { @@ -12027,37 +11194,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusText), statusText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kStatusText)) + { + err = DataModel::Decode(reader, statusText); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kStatusText): - ReturnErrorOnFailure(DataModel::Decode(reader, statusText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToModeResponse. } // namespace Commands @@ -12068,40 +11235,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SupportedModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); - break; + return DataModel::Decode(reader, supportedModes); case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); - break; + return DataModel::Decode(reader, currentMode); case Attributes::StartUpMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); - break; + return DataModel::Decode(reader, startUpMode); case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); - break; + return DataModel::Decode(reader, onMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -12118,37 +11273,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTargetTemperature), targetTemperature)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTargetTemperatureLevel), targetTemperatureLevel)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTargetTemperature)) { - continue; + err = DataModel::Decode(reader, targetTemperature); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kTargetTemperatureLevel)) + { + err = DataModel::Decode(reader, targetTemperatureLevel); + } + else { - case to_underlying(Fields::kTargetTemperature): - ReturnErrorOnFailure(DataModel::Decode(reader, targetTemperature)); - break; - case to_underlying(Fields::kTargetTemperatureLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, targetTemperatureLevel)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetTemperature. } // namespace Commands @@ -12159,46 +11314,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::TemperatureSetpoint::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, temperatureSetpoint)); - break; + return DataModel::Decode(reader, temperatureSetpoint); case Attributes::MinTemperature::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minTemperature)); - break; + return DataModel::Decode(reader, minTemperature); case Attributes::MaxTemperature::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxTemperature)); - break; + return DataModel::Decode(reader, maxTemperature); case Attributes::Step::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, step)); - break; + return DataModel::Decode(reader, step); case Attributes::SelectedTemperatureLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, selectedTemperatureLevel)); - break; + return DataModel::Decode(reader, selectedTemperatureLevel); case Attributes::SupportedTemperatureLevels::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedTemperatureLevels)); - break; + return DataModel::Decode(reader, supportedTemperatureLevels); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -12215,37 +11356,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Mask::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, mask)); - break; + return DataModel::Decode(reader, mask); case Attributes::State::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, state)); - break; + return DataModel::Decode(reader, state); case Attributes::Supported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supported)); - break; + return DataModel::Decode(reader, supported); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -12259,43 +11389,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInactive), inactive)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kState), state)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMask), mask)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActive)) + { + err = DataModel::Decode(reader, active); + } + else if (__context_tag == to_underlying(Fields::kInactive)) + { + err = DataModel::Decode(reader, inactive); + } + else if (__context_tag == to_underlying(Fields::kState)) + { + err = DataModel::Decode(reader, state); + } + else if (__context_tag == to_underlying(Fields::kMask)) + { + err = DataModel::Decode(reader, mask); + } + else { - case to_underlying(Fields::kActive): - ReturnErrorOnFailure(DataModel::Decode(reader, active)); - break; - case to_underlying(Fields::kInactive): - ReturnErrorOnFailure(DataModel::Decode(reader, inactive)); - break; - case to_underlying(Fields::kState): - ReturnErrorOnFailure(DataModel::Decode(reader, state)); - break; - case to_underlying(Fields::kMask): - ReturnErrorOnFailure(DataModel::Decode(reader, mask)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Notify. } // namespace Events @@ -12311,34 +11443,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNewMode), newMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNewMode)) { - continue; + err = DataModel::Decode(reader, newMode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kNewMode): - ReturnErrorOnFailure(DataModel::Decode(reader, newMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToMode. namespace ChangeToModeResponse { @@ -12348,37 +11479,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusText), statusText)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStatusText)) + { + err = DataModel::Decode(reader, statusText); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kStatusText): - ReturnErrorOnFailure(DataModel::Decode(reader, statusText)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeToModeResponse. } // namespace Commands @@ -12389,40 +11520,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::SupportedModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); - break; + return DataModel::Decode(reader, supportedModes); case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); - break; + return DataModel::Decode(reader, currentMode); case Attributes::StartUpMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); - break; + return DataModel::Decode(reader, startUpMode); case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); - break; + return DataModel::Decode(reader, onMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -12439,31 +11558,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::AirQuality::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, airQuality)); - break; + return DataModel::Decode(reader, airQuality); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -12478,31 +11588,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SelfTestRequest. } // namespace Commands @@ -12513,67 +11612,46 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::ExpressedState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, expressedState)); - break; + return DataModel::Decode(reader, expressedState); case Attributes::SmokeState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, smokeState)); - break; + return DataModel::Decode(reader, smokeState); case Attributes::COState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, COState)); - break; + return DataModel::Decode(reader, COState); case Attributes::BatteryAlert::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, batteryAlert)); - break; + return DataModel::Decode(reader, batteryAlert); case Attributes::DeviceMuted::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, deviceMuted)); - break; + return DataModel::Decode(reader, deviceMuted); case Attributes::TestInProgress::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, testInProgress)); - break; + return DataModel::Decode(reader, testInProgress); case Attributes::HardwareFaultAlert::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareFaultAlert)); - break; + return DataModel::Decode(reader, hardwareFaultAlert); case Attributes::EndOfServiceAlert::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, endOfServiceAlert)); - break; + return DataModel::Decode(reader, endOfServiceAlert); case Attributes::InterconnectSmokeAlarm::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, interconnectSmokeAlarm)); - break; + return DataModel::Decode(reader, interconnectSmokeAlarm); case Attributes::InterconnectCOAlarm::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, interconnectCOAlarm)); - break; + return DataModel::Decode(reader, interconnectCOAlarm); case Attributes::ContaminationState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, contaminationState)); - break; + return DataModel::Decode(reader, contaminationState); case Attributes::SmokeSensitivityLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, smokeSensitivityLevel)); - break; + return DataModel::Decode(reader, smokeSensitivityLevel); case Attributes::ExpiryDate::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, expiryDate)); - break; + return DataModel::Decode(reader, expiryDate); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -12584,34 +11662,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarmSeverityLevel)) { - continue; + err = DataModel::Decode(reader, alarmSeverityLevel); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kAlarmSeverityLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SmokeAlarm. namespace COAlarm { @@ -12620,34 +11697,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarmSeverityLevel)) { - continue; + err = DataModel::Decode(reader, alarmSeverityLevel); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kAlarmSeverityLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace COAlarm. namespace LowBattery { @@ -12656,34 +11732,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarmSeverityLevel)) { - continue; + err = DataModel::Decode(reader, alarmSeverityLevel); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kAlarmSeverityLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LowBattery. namespace HardwareFault { @@ -12691,31 +11766,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace HardwareFault. namespace EndOfService { @@ -12723,31 +11787,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace EndOfService. namespace SelfTestComplete { @@ -12755,31 +11808,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SelfTestComplete. namespace AlarmMuted { @@ -12787,31 +11829,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace AlarmMuted. namespace MuteEnded { @@ -12819,31 +11850,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace MuteEnded. namespace InterconnectSmokeAlarm { @@ -12852,34 +11872,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarmSeverityLevel)) + { + err = DataModel::Decode(reader, alarmSeverityLevel); + } + else { - case to_underlying(Fields::kAlarmSeverityLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace InterconnectSmokeAlarm. namespace InterconnectCOAlarm { @@ -12888,34 +11907,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarmSeverityLevel), alarmSeverityLevel)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarmSeverityLevel)) { - continue; + err = DataModel::Decode(reader, alarmSeverityLevel); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kAlarmSeverityLevel): - ReturnErrorOnFailure(DataModel::Decode(reader, alarmSeverityLevel)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace InterconnectCOAlarm. namespace AllClear { @@ -12923,31 +11941,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace AllClear. } // namespace Events @@ -12962,34 +11969,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarms), alarms)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarms)) + { + err = DataModel::Decode(reader, alarms); + } + else { - case to_underlying(Fields::kAlarms): - ReturnErrorOnFailure(DataModel::Decode(reader, alarms)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Reset. namespace ModifyEnabledAlarms { @@ -12998,34 +12004,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMask), mask)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMask)) + { + err = DataModel::Decode(reader, mask); + } + else { - case to_underlying(Fields::kMask): - ReturnErrorOnFailure(DataModel::Decode(reader, mask)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ModifyEnabledAlarms. } // namespace Commands @@ -13036,40 +12041,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Mask::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, mask)); - break; + return DataModel::Decode(reader, mask); case Attributes::Latch::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, latch)); - break; + return DataModel::Decode(reader, latch); case Attributes::State::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, state)); - break; + return DataModel::Decode(reader, state); case Attributes::Supported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supported)); - break; + return DataModel::Decode(reader, supported); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -13083,43 +12076,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInactive), inactive)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kState), state)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMask), mask)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kActive)) + { + err = DataModel::Decode(reader, active); + } + else if (__context_tag == to_underlying(Fields::kInactive)) + { + err = DataModel::Decode(reader, inactive); + } + else if (__context_tag == to_underlying(Fields::kState)) + { + err = DataModel::Decode(reader, state); + } + else if (__context_tag == to_underlying(Fields::kMask)) + { + err = DataModel::Decode(reader, mask); + } + else { - case to_underlying(Fields::kActive): - ReturnErrorOnFailure(DataModel::Decode(reader, active)); - break; - case to_underlying(Fields::kInactive): - ReturnErrorOnFailure(DataModel::Decode(reader, inactive)); - break; - case to_underlying(Fields::kState): - ReturnErrorOnFailure(DataModel::Decode(reader, state)); - break; - case to_underlying(Fields::kMask): - ReturnErrorOnFailure(DataModel::Decode(reader, mask)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Notify. } // namespace Events @@ -13134,31 +12129,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Pause. namespace Stop { @@ -13166,31 +12150,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Stop. namespace Start { @@ -13198,31 +12171,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Start. namespace Resume { @@ -13230,31 +12192,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Resume. namespace OperationalCommandResponse { @@ -13263,34 +12214,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCommandResponseState), commandResponseState)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCommandResponseState)) { - continue; + err = DataModel::Decode(reader, commandResponseState); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kCommandResponseState): - ReturnErrorOnFailure(DataModel::Decode(reader, commandResponseState)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationalCommandResponse. } // namespace Commands @@ -13301,46 +12251,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::PhaseList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, phaseList)); - break; + return DataModel::Decode(reader, phaseList); case Attributes::CurrentPhase::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPhase)); - break; + return DataModel::Decode(reader, currentPhase); case Attributes::CountdownTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, countdownTime)); - break; + return DataModel::Decode(reader, countdownTime); case Attributes::OperationalStateList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalStateList)); - break; + return DataModel::Decode(reader, operationalStateList); case Attributes::OperationalState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalState)); - break; + return DataModel::Decode(reader, operationalState); case Attributes::OperationalError::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalError)); - break; + return DataModel::Decode(reader, operationalError); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -13351,34 +12287,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kErrorState), errorState)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kErrorState)) { - continue; + err = DataModel::Decode(reader, errorState); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kErrorState): - ReturnErrorOnFailure(DataModel::Decode(reader, errorState)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationalError. namespace OperationCompletion { @@ -13389,40 +12324,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCompletionErrorCode), completionErrorCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTotalOperationalTime), totalOperationalTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPausedTime), pausedTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCompletionErrorCode)) { - continue; + err = DataModel::Decode(reader, completionErrorCode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kTotalOperationalTime)) + { + err = DataModel::Decode(reader, totalOperationalTime); + } + else if (__context_tag == to_underlying(Fields::kPausedTime)) + { + err = DataModel::Decode(reader, pausedTime); + } + else { - case to_underlying(Fields::kCompletionErrorCode): - ReturnErrorOnFailure(DataModel::Decode(reader, completionErrorCode)); - break; - case to_underlying(Fields::kTotalOperationalTime): - ReturnErrorOnFailure(DataModel::Decode(reader, totalOperationalTime)); - break; - case to_underlying(Fields::kPausedTime): - ReturnErrorOnFailure(DataModel::Decode(reader, pausedTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationCompletion. } // namespace Events @@ -13437,31 +12373,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Pause. namespace Stop { @@ -13469,31 +12394,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Stop. namespace Start { @@ -13501,31 +12415,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Start. namespace Resume { @@ -13533,31 +12436,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Resume. namespace OperationalCommandResponse { @@ -13566,34 +12458,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCommandResponseState), commandResponseState)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCommandResponseState)) { - continue; + err = DataModel::Decode(reader, commandResponseState); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kCommandResponseState): - ReturnErrorOnFailure(DataModel::Decode(reader, commandResponseState)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationalCommandResponse. } // namespace Commands @@ -13604,46 +12495,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::PhaseList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, phaseList)); - break; + return DataModel::Decode(reader, phaseList); case Attributes::CurrentPhase::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPhase)); - break; + return DataModel::Decode(reader, currentPhase); case Attributes::CountdownTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, countdownTime)); - break; + return DataModel::Decode(reader, countdownTime); case Attributes::OperationalStateList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalStateList)); - break; + return DataModel::Decode(reader, operationalStateList); case Attributes::OperationalState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalState)); - break; + return DataModel::Decode(reader, operationalState); case Attributes::OperationalError::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalError)); - break; + return DataModel::Decode(reader, operationalError); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -13654,34 +12531,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kErrorState), errorState)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kErrorState)) + { + err = DataModel::Decode(reader, errorState); + } + else { - case to_underlying(Fields::kErrorState): - ReturnErrorOnFailure(DataModel::Decode(reader, errorState)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationalError. namespace OperationCompletion { @@ -13692,40 +12568,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCompletionErrorCode), completionErrorCode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTotalOperationalTime), totalOperationalTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPausedTime), pausedTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCompletionErrorCode)) + { + err = DataModel::Decode(reader, completionErrorCode); + } + else if (__context_tag == to_underlying(Fields::kTotalOperationalTime)) + { + err = DataModel::Decode(reader, totalOperationalTime); + } + else if (__context_tag == to_underlying(Fields::kPausedTime)) + { + err = DataModel::Decode(reader, pausedTime); + } + else { - case to_underlying(Fields::kCompletionErrorCode): - ReturnErrorOnFailure(DataModel::Decode(reader, completionErrorCode)); - break; - case to_underlying(Fields::kTotalOperationalTime): - ReturnErrorOnFailure(DataModel::Decode(reader, totalOperationalTime)); - break; - case to_underlying(Fields::kPausedTime): - ReturnErrorOnFailure(DataModel::Decode(reader, pausedTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OperationCompletion. } // namespace Events @@ -13746,34 +12623,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kProductIdentifierType)) { - continue; + err = DataModel::Decode(reader, productIdentifierType); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kProductIdentifierValue)) + { + err = DataModel::Decode(reader, productIdentifierValue); + } + else { - case to_underlying(Fields::kProductIdentifierType): - ReturnErrorOnFailure(DataModel::Decode(reader, productIdentifierType)); - break; - case to_underlying(Fields::kProductIdentifierValue): - ReturnErrorOnFailure(DataModel::Decode(reader, productIdentifierValue)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ReplacementProductStruct @@ -13785,31 +12660,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ResetCondition. } // namespace Commands @@ -13820,46 +12684,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Condition::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, condition)); - break; + return DataModel::Decode(reader, condition); case Attributes::DegradationDirection::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, degradationDirection)); - break; + return DataModel::Decode(reader, degradationDirection); case Attributes::ChangeIndication::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, changeIndication)); - break; + return DataModel::Decode(reader, changeIndication); case Attributes::InPlaceIndicator::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, inPlaceIndicator)); - break; + return DataModel::Decode(reader, inPlaceIndicator); case Attributes::LastChangedTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lastChangedTime)); - break; + return DataModel::Decode(reader, lastChangedTime); case Attributes::ReplacementProductList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, replacementProductList)); - break; + return DataModel::Decode(reader, replacementProductList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -13881,34 +12731,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kProductIdentifierType)) + { + err = DataModel::Decode(reader, productIdentifierType); + } + else if (__context_tag == to_underlying(Fields::kProductIdentifierValue)) + { + err = DataModel::Decode(reader, productIdentifierValue); + } + else { - case to_underlying(Fields::kProductIdentifierType): - ReturnErrorOnFailure(DataModel::Decode(reader, productIdentifierType)); - break; - case to_underlying(Fields::kProductIdentifierValue): - ReturnErrorOnFailure(DataModel::Decode(reader, productIdentifierValue)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ReplacementProductStruct @@ -13920,31 +12768,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ResetCondition. } // namespace Commands @@ -13955,46 +12792,32 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Condition::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, condition)); - break; + return DataModel::Decode(reader, condition); case Attributes::DegradationDirection::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, degradationDirection)); - break; + return DataModel::Decode(reader, degradationDirection); case Attributes::ChangeIndication::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, changeIndication)); - break; + return DataModel::Decode(reader, changeIndication); case Attributes::InPlaceIndicator::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, inPlaceIndicator)); - break; + return DataModel::Decode(reader, inPlaceIndicator); case Attributes::LastChangedTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lastChangedTime)); - break; + return DataModel::Decode(reader, lastChangedTime); case Attributes::ReplacementProductList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, replacementProductList)); - break; + return DataModel::Decode(reader, replacementProductList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -14016,34 +12839,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCredentialType)) { - continue; + err = DataModel::Decode(reader, credentialType); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kCredentialIndex)) + { + err = DataModel::Decode(reader, credentialIndex); + } + else { - case to_underlying(Fields::kCredentialType): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialType)); - break; - case to_underlying(Fields::kCredentialIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialIndex)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace CredentialStruct @@ -14056,34 +12877,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPINCode), PINCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPINCode)) + { + err = DataModel::Decode(reader, PINCode); + } + else { - case to_underlying(Fields::kPINCode): - ReturnErrorOnFailure(DataModel::Decode(reader, PINCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LockDoor. namespace UnlockDoor { @@ -14092,34 +12912,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPINCode), PINCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPINCode)) + { + err = DataModel::Decode(reader, PINCode); + } + else { - case to_underlying(Fields::kPINCode): - ReturnErrorOnFailure(DataModel::Decode(reader, PINCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace UnlockDoor. namespace UnlockWithTimeout { @@ -14129,37 +12948,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTimeout), timeout)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPINCode), PINCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTimeout)) + { + err = DataModel::Decode(reader, timeout); + } + else if (__context_tag == to_underlying(Fields::kPINCode)) + { + err = DataModel::Decode(reader, PINCode); + } + else { - case to_underlying(Fields::kTimeout): - ReturnErrorOnFailure(DataModel::Decode(reader, timeout)); - break; - case to_underlying(Fields::kPINCode): - ReturnErrorOnFailure(DataModel::Decode(reader, PINCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace UnlockWithTimeout. namespace SetWeekDaySchedule { @@ -14174,52 +12993,57 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStartMinute), startMinute)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEndHour), endHour)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEndMinute), endMinute)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWeekDayIndex)) + { + err = DataModel::Decode(reader, weekDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kDaysMask)) + { + err = DataModel::Decode(reader, daysMask); + } + else if (__context_tag == to_underlying(Fields::kStartHour)) + { + err = DataModel::Decode(reader, startHour); + } + else if (__context_tag == to_underlying(Fields::kStartMinute)) + { + err = DataModel::Decode(reader, startMinute); + } + else if (__context_tag == to_underlying(Fields::kEndHour)) + { + err = DataModel::Decode(reader, endHour); + } + else if (__context_tag == to_underlying(Fields::kEndMinute)) + { + err = DataModel::Decode(reader, endMinute); + } + else { - case to_underlying(Fields::kWeekDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, weekDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kDaysMask): - ReturnErrorOnFailure(DataModel::Decode(reader, daysMask)); - break; - case to_underlying(Fields::kStartHour): - ReturnErrorOnFailure(DataModel::Decode(reader, startHour)); - break; - case to_underlying(Fields::kStartMinute): - ReturnErrorOnFailure(DataModel::Decode(reader, startMinute)); - break; - case to_underlying(Fields::kEndHour): - ReturnErrorOnFailure(DataModel::Decode(reader, endHour)); - break; - case to_underlying(Fields::kEndMinute): - ReturnErrorOnFailure(DataModel::Decode(reader, endMinute)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetWeekDaySchedule. namespace GetWeekDaySchedule { @@ -14229,37 +13053,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kWeekDayIndex), weekDayIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWeekDayIndex)) + { + err = DataModel::Decode(reader, weekDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else { - case to_underlying(Fields::kWeekDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, weekDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetWeekDaySchedule. namespace GetWeekDayScheduleResponse { @@ -14275,55 +13099,61 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStartMinute), startMinute)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEndHour), endHour)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEndMinute), endMinute)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWeekDayIndex)) + { + err = DataModel::Decode(reader, weekDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kDaysMask)) + { + err = DataModel::Decode(reader, daysMask); + } + else if (__context_tag == to_underlying(Fields::kStartHour)) + { + err = DataModel::Decode(reader, startHour); + } + else if (__context_tag == to_underlying(Fields::kStartMinute)) + { + err = DataModel::Decode(reader, startMinute); + } + else if (__context_tag == to_underlying(Fields::kEndHour)) + { + err = DataModel::Decode(reader, endHour); + } + else if (__context_tag == to_underlying(Fields::kEndMinute)) + { + err = DataModel::Decode(reader, endMinute); + } + else { - case to_underlying(Fields::kWeekDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, weekDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kDaysMask): - ReturnErrorOnFailure(DataModel::Decode(reader, daysMask)); - break; - case to_underlying(Fields::kStartHour): - ReturnErrorOnFailure(DataModel::Decode(reader, startHour)); - break; - case to_underlying(Fields::kStartMinute): - ReturnErrorOnFailure(DataModel::Decode(reader, startMinute)); - break; - case to_underlying(Fields::kEndHour): - ReturnErrorOnFailure(DataModel::Decode(reader, endHour)); - break; - case to_underlying(Fields::kEndMinute): - ReturnErrorOnFailure(DataModel::Decode(reader, endMinute)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetWeekDayScheduleResponse. namespace ClearWeekDaySchedule { @@ -14333,37 +13163,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kWeekDayIndex), weekDayIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWeekDayIndex)) + { + err = DataModel::Decode(reader, weekDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else { - case to_underlying(Fields::kWeekDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, weekDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ClearWeekDaySchedule. namespace SetYearDaySchedule { @@ -14375,43 +13205,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalStartTime), localStartTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalEndTime), localEndTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kYearDayIndex)) + { + err = DataModel::Decode(reader, yearDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kLocalStartTime)) + { + err = DataModel::Decode(reader, localStartTime); + } + else if (__context_tag == to_underlying(Fields::kLocalEndTime)) + { + err = DataModel::Decode(reader, localEndTime); + } + else { - case to_underlying(Fields::kYearDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, yearDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kLocalStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localStartTime)); - break; - case to_underlying(Fields::kLocalEndTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localEndTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetYearDaySchedule. namespace GetYearDaySchedule { @@ -14421,37 +13253,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kYearDayIndex), yearDayIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kYearDayIndex)) + { + err = DataModel::Decode(reader, yearDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else { - case to_underlying(Fields::kYearDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, yearDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetYearDaySchedule. namespace GetYearDayScheduleResponse { @@ -14464,46 +13296,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalStartTime), localStartTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalEndTime), localEndTime)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kYearDayIndex)) + { + err = DataModel::Decode(reader, yearDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kLocalStartTime)) + { + err = DataModel::Decode(reader, localStartTime); + } + else if (__context_tag == to_underlying(Fields::kLocalEndTime)) + { + err = DataModel::Decode(reader, localEndTime); + } + else { - case to_underlying(Fields::kYearDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, yearDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kLocalStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localStartTime)); - break; - case to_underlying(Fields::kLocalEndTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localEndTime)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetYearDayScheduleResponse. namespace ClearYearDaySchedule { @@ -14513,37 +13348,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kYearDayIndex), yearDayIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kYearDayIndex)) + { + err = DataModel::Decode(reader, yearDayIndex); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else { - case to_underlying(Fields::kYearDayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, yearDayIndex)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ClearYearDaySchedule. namespace SetHolidaySchedule { @@ -14555,43 +13390,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalStartTime), localStartTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalEndTime), localEndTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOperatingMode), operatingMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHolidayIndex)) + { + err = DataModel::Decode(reader, holidayIndex); + } + else if (__context_tag == to_underlying(Fields::kLocalStartTime)) + { + err = DataModel::Decode(reader, localStartTime); + } + else if (__context_tag == to_underlying(Fields::kLocalEndTime)) + { + err = DataModel::Decode(reader, localEndTime); + } + else if (__context_tag == to_underlying(Fields::kOperatingMode)) + { + err = DataModel::Decode(reader, operatingMode); + } + else { - case to_underlying(Fields::kHolidayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, holidayIndex)); - break; - case to_underlying(Fields::kLocalStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localStartTime)); - break; - case to_underlying(Fields::kLocalEndTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localEndTime)); - break; - case to_underlying(Fields::kOperatingMode): - ReturnErrorOnFailure(DataModel::Decode(reader, operatingMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetHolidaySchedule. namespace GetHolidaySchedule { @@ -14600,34 +13437,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kHolidayIndex), holidayIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHolidayIndex)) + { + err = DataModel::Decode(reader, holidayIndex); + } + else { - case to_underlying(Fields::kHolidayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, holidayIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetHolidaySchedule. namespace GetHolidayScheduleResponse { @@ -14640,46 +13476,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalStartTime), localStartTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLocalEndTime), localEndTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOperatingMode), operatingMode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHolidayIndex)) + { + err = DataModel::Decode(reader, holidayIndex); + } + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kLocalStartTime)) + { + err = DataModel::Decode(reader, localStartTime); + } + else if (__context_tag == to_underlying(Fields::kLocalEndTime)) + { + err = DataModel::Decode(reader, localEndTime); + } + else if (__context_tag == to_underlying(Fields::kOperatingMode)) + { + err = DataModel::Decode(reader, operatingMode); + } + else { - case to_underlying(Fields::kHolidayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, holidayIndex)); - break; - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kLocalStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localStartTime)); - break; - case to_underlying(Fields::kLocalEndTime): - ReturnErrorOnFailure(DataModel::Decode(reader, localEndTime)); - break; - case to_underlying(Fields::kOperatingMode): - ReturnErrorOnFailure(DataModel::Decode(reader, operatingMode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetHolidayScheduleResponse. namespace ClearHolidaySchedule { @@ -14688,34 +13527,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kHolidayIndex), holidayIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHolidayIndex)) + { + err = DataModel::Decode(reader, holidayIndex); + } + else { - case to_underlying(Fields::kHolidayIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, holidayIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ClearHolidaySchedule. namespace SetUser { @@ -14730,52 +13568,57 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserStatus), userStatus)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserType), userType)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCredentialRule), credentialRule)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperationType)) + { + err = DataModel::Decode(reader, operationType); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kUserName)) + { + err = DataModel::Decode(reader, userName); + } + else if (__context_tag == to_underlying(Fields::kUserUniqueID)) + { + err = DataModel::Decode(reader, userUniqueID); + } + else if (__context_tag == to_underlying(Fields::kUserStatus)) + { + err = DataModel::Decode(reader, userStatus); + } + else if (__context_tag == to_underlying(Fields::kUserType)) + { + err = DataModel::Decode(reader, userType); + } + else if (__context_tag == to_underlying(Fields::kCredentialRule)) + { + err = DataModel::Decode(reader, credentialRule); + } + else { - case to_underlying(Fields::kOperationType): - ReturnErrorOnFailure(DataModel::Decode(reader, operationType)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kUserName): - ReturnErrorOnFailure(DataModel::Decode(reader, userName)); - break; - case to_underlying(Fields::kUserUniqueID): - ReturnErrorOnFailure(DataModel::Decode(reader, userUniqueID)); - break; - case to_underlying(Fields::kUserStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, userStatus)); - break; - case to_underlying(Fields::kUserType): - ReturnErrorOnFailure(DataModel::Decode(reader, userType)); - break; - case to_underlying(Fields::kCredentialRule): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialRule)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetUser. namespace GetUser { @@ -14784,34 +13627,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else { - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetUser. namespace GetUserResponse { @@ -14829,61 +13671,69 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCreatorFabricIndex), creatorFabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLastModifiedFabricIndex), lastModifiedFabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNextUserIndex), nextUserIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kUserName): - ReturnErrorOnFailure(DataModel::Decode(reader, userName)); - break; - case to_underlying(Fields::kUserUniqueID): - ReturnErrorOnFailure(DataModel::Decode(reader, userUniqueID)); - break; - case to_underlying(Fields::kUserStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, userStatus)); - break; - case to_underlying(Fields::kUserType): - ReturnErrorOnFailure(DataModel::Decode(reader, userType)); - break; - case to_underlying(Fields::kCredentialRule): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialRule)); - break; - case to_underlying(Fields::kCredentials): - ReturnErrorOnFailure(DataModel::Decode(reader, credentials)); - break; - case to_underlying(Fields::kCreatorFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, creatorFabricIndex)); - break; - case to_underlying(Fields::kLastModifiedFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, lastModifiedFabricIndex)); - break; - case to_underlying(Fields::kNextUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, nextUserIndex)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kUserName)) + { + err = DataModel::Decode(reader, userName); + } + else if (__context_tag == to_underlying(Fields::kUserUniqueID)) + { + err = DataModel::Decode(reader, userUniqueID); + } + else if (__context_tag == to_underlying(Fields::kUserStatus)) + { + err = DataModel::Decode(reader, userStatus); + } + else if (__context_tag == to_underlying(Fields::kUserType)) + { + err = DataModel::Decode(reader, userType); + } + else if (__context_tag == to_underlying(Fields::kCredentialRule)) + { + err = DataModel::Decode(reader, credentialRule); + } + else if (__context_tag == to_underlying(Fields::kCredentials)) + { + err = DataModel::Decode(reader, credentials); + } + else if (__context_tag == to_underlying(Fields::kCreatorFabricIndex)) + { + err = DataModel::Decode(reader, creatorFabricIndex); + } + else if (__context_tag == to_underlying(Fields::kLastModifiedFabricIndex)) + { + err = DataModel::Decode(reader, lastModifiedFabricIndex); + } + else if (__context_tag == to_underlying(Fields::kNextUserIndex)) + { + err = DataModel::Decode(reader, nextUserIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace GetUserResponse. namespace ClearUser { @@ -14892,34 +13742,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUserIndex)) { - continue; + err = DataModel::Decode(reader, userIndex); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ClearUser. namespace SetCredential { @@ -14933,49 +13782,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserStatus), userStatus)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserType), userType)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperationType)) { - continue; + err = DataModel::Decode(reader, operationType); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kCredential)) + { + err = DataModel::Decode(reader, credential); + } + else if (__context_tag == to_underlying(Fields::kCredentialData)) + { + err = DataModel::Decode(reader, credentialData); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kUserStatus)) + { + err = DataModel::Decode(reader, userStatus); + } + else if (__context_tag == to_underlying(Fields::kUserType)) + { + err = DataModel::Decode(reader, userType); + } + else { - case to_underlying(Fields::kOperationType): - ReturnErrorOnFailure(DataModel::Decode(reader, operationType)); - break; - case to_underlying(Fields::kCredential): - ReturnErrorOnFailure(DataModel::Decode(reader, credential)); - break; - case to_underlying(Fields::kCredentialData): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialData)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kUserStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, userStatus)); - break; - case to_underlying(Fields::kUserType): - ReturnErrorOnFailure(DataModel::Decode(reader, userType)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetCredential. namespace SetCredentialResponse { @@ -14986,40 +13839,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kUserIndex), userIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNextCredentialIndex), nextCredentialIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kNextCredentialIndex)) + { + err = DataModel::Decode(reader, nextCredentialIndex); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kNextCredentialIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, nextCredentialIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetCredentialResponse. namespace GetCredentialStatus { @@ -15028,34 +13882,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCredential), credential)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCredential)) + { + err = DataModel::Decode(reader, credential); + } + else { - case to_underlying(Fields::kCredential): - ReturnErrorOnFailure(DataModel::Decode(reader, credential)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetCredentialStatus. namespace GetCredentialStatusResponse { @@ -15068,46 +13921,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCreatorFabricIndex), creatorFabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLastModifiedFabricIndex), lastModifiedFabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNextCredentialIndex), nextCredentialIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCredentialExists)) + { + err = DataModel::Decode(reader, credentialExists); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kCreatorFabricIndex)) + { + err = DataModel::Decode(reader, creatorFabricIndex); + } + else if (__context_tag == to_underlying(Fields::kLastModifiedFabricIndex)) + { + err = DataModel::Decode(reader, lastModifiedFabricIndex); + } + else if (__context_tag == to_underlying(Fields::kNextCredentialIndex)) + { + err = DataModel::Decode(reader, nextCredentialIndex); + } + else { - case to_underlying(Fields::kCredentialExists): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialExists)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kCreatorFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, creatorFabricIndex)); - break; - case to_underlying(Fields::kLastModifiedFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, lastModifiedFabricIndex)); - break; - case to_underlying(Fields::kNextCredentialIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, nextCredentialIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetCredentialStatusResponse. namespace ClearCredential { @@ -15116,34 +13972,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCredential), credential)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCredential)) + { + err = DataModel::Decode(reader, credential); + } + else { - case to_underlying(Fields::kCredential): - ReturnErrorOnFailure(DataModel::Decode(reader, credential)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ClearCredential. namespace UnboltDoor { @@ -15152,34 +14007,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPINCode), PINCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPINCode)) + { + err = DataModel::Decode(reader, PINCode); + } + else { - case to_underlying(Fields::kPINCode): - ReturnErrorOnFailure(DataModel::Decode(reader, PINCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace UnboltDoor. } // namespace Commands @@ -15190,136 +14044,92 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::LockState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lockState)); - break; + return DataModel::Decode(reader, lockState); case Attributes::LockType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lockType)); - break; + return DataModel::Decode(reader, lockType); case Attributes::ActuatorEnabled::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, actuatorEnabled)); - break; + return DataModel::Decode(reader, actuatorEnabled); case Attributes::DoorState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, doorState)); - break; + return DataModel::Decode(reader, doorState); case Attributes::DoorOpenEvents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, doorOpenEvents)); - break; + return DataModel::Decode(reader, doorOpenEvents); case Attributes::DoorClosedEvents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, doorClosedEvents)); - break; + return DataModel::Decode(reader, doorClosedEvents); case Attributes::OpenPeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, openPeriod)); - break; + return DataModel::Decode(reader, openPeriod); case Attributes::NumberOfTotalUsersSupported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfTotalUsersSupported)); - break; + return DataModel::Decode(reader, numberOfTotalUsersSupported); case Attributes::NumberOfPINUsersSupported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfPINUsersSupported)); - break; + return DataModel::Decode(reader, numberOfPINUsersSupported); case Attributes::NumberOfRFIDUsersSupported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfRFIDUsersSupported)); - break; + return DataModel::Decode(reader, numberOfRFIDUsersSupported); case Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfWeekDaySchedulesSupportedPerUser)); - break; + return DataModel::Decode(reader, numberOfWeekDaySchedulesSupportedPerUser); case Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfYearDaySchedulesSupportedPerUser)); - break; + return DataModel::Decode(reader, numberOfYearDaySchedulesSupportedPerUser); case Attributes::NumberOfHolidaySchedulesSupported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfHolidaySchedulesSupported)); - break; + return DataModel::Decode(reader, numberOfHolidaySchedulesSupported); case Attributes::MaxPINCodeLength::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxPINCodeLength)); - break; + return DataModel::Decode(reader, maxPINCodeLength); case Attributes::MinPINCodeLength::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minPINCodeLength)); - break; + return DataModel::Decode(reader, minPINCodeLength); case Attributes::MaxRFIDCodeLength::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxRFIDCodeLength)); - break; + return DataModel::Decode(reader, maxRFIDCodeLength); case Attributes::MinRFIDCodeLength::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minRFIDCodeLength)); - break; + return DataModel::Decode(reader, minRFIDCodeLength); case Attributes::CredentialRulesSupport::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, credentialRulesSupport)); - break; + return DataModel::Decode(reader, credentialRulesSupport); case Attributes::NumberOfCredentialsSupportedPerUser::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfCredentialsSupportedPerUser)); - break; + return DataModel::Decode(reader, numberOfCredentialsSupportedPerUser); case Attributes::Language::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, language)); - break; + return DataModel::Decode(reader, language); case Attributes::LEDSettings::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, LEDSettings)); - break; + return DataModel::Decode(reader, LEDSettings); case Attributes::AutoRelockTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, autoRelockTime)); - break; + return DataModel::Decode(reader, autoRelockTime); case Attributes::SoundVolume::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, soundVolume)); - break; + return DataModel::Decode(reader, soundVolume); case Attributes::OperatingMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operatingMode)); - break; + return DataModel::Decode(reader, operatingMode); case Attributes::SupportedOperatingModes::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedOperatingModes)); - break; + return DataModel::Decode(reader, supportedOperatingModes); case Attributes::DefaultConfigurationRegister::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, defaultConfigurationRegister)); - break; + return DataModel::Decode(reader, defaultConfigurationRegister); case Attributes::EnableLocalProgramming::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enableLocalProgramming)); - break; + return DataModel::Decode(reader, enableLocalProgramming); case Attributes::EnableOneTouchLocking::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enableOneTouchLocking)); - break; + return DataModel::Decode(reader, enableOneTouchLocking); case Attributes::EnableInsideStatusLED::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enableInsideStatusLED)); - break; + return DataModel::Decode(reader, enableInsideStatusLED); case Attributes::EnablePrivacyModeButton::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enablePrivacyModeButton)); - break; + return DataModel::Decode(reader, enablePrivacyModeButton); case Attributes::LocalProgrammingFeatures::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, localProgrammingFeatures)); - break; + return DataModel::Decode(reader, localProgrammingFeatures); case Attributes::WrongCodeEntryLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, wrongCodeEntryLimit)); - break; + return DataModel::Decode(reader, wrongCodeEntryLimit); case Attributes::UserCodeTemporaryDisableTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, userCodeTemporaryDisableTime)); - break; + return DataModel::Decode(reader, userCodeTemporaryDisableTime); case Attributes::SendPINOverTheAir::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, sendPINOverTheAir)); - break; + return DataModel::Decode(reader, sendPINOverTheAir); case Attributes::RequirePINforRemoteOperation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, requirePINforRemoteOperation)); - break; + return DataModel::Decode(reader, requirePINforRemoteOperation); case Attributes::ExpiringUserTimeout::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, expiringUserTimeout)); - break; + return DataModel::Decode(reader, expiringUserTimeout); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -15330,34 +14140,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAlarmCode), alarmCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAlarmCode)) + { + err = DataModel::Decode(reader, alarmCode); + } + else { - case to_underlying(Fields::kAlarmCode): - ReturnErrorOnFailure(DataModel::Decode(reader, alarmCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DoorLockAlarm. namespace DoorStateChange { @@ -15366,34 +14175,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDoorState), doorState)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDoorState)) + { + err = DataModel::Decode(reader, doorState); + } + else { - case to_underlying(Fields::kDoorState): - ReturnErrorOnFailure(DataModel::Decode(reader, doorState)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DoorStateChange. namespace LockOperation { @@ -15407,49 +14215,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSourceNode), sourceNode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCredentials), credentials)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLockOperationType)) + { + err = DataModel::Decode(reader, lockOperationType); + } + else if (__context_tag == to_underlying(Fields::kOperationSource)) + { + err = DataModel::Decode(reader, operationSource); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else if (__context_tag == to_underlying(Fields::kSourceNode)) + { + err = DataModel::Decode(reader, sourceNode); + } + else if (__context_tag == to_underlying(Fields::kCredentials)) + { + err = DataModel::Decode(reader, credentials); + } + else { - case to_underlying(Fields::kLockOperationType): - ReturnErrorOnFailure(DataModel::Decode(reader, lockOperationType)); - break; - case to_underlying(Fields::kOperationSource): - ReturnErrorOnFailure(DataModel::Decode(reader, operationSource)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - case to_underlying(Fields::kSourceNode): - ReturnErrorOnFailure(DataModel::Decode(reader, sourceNode)); - break; - case to_underlying(Fields::kCredentials): - ReturnErrorOnFailure(DataModel::Decode(reader, credentials)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LockOperation. namespace LockOperationError { @@ -15464,52 +14276,57 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSourceNode), sourceNode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCredentials), credentials)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLockOperationType)) + { + err = DataModel::Decode(reader, lockOperationType); + } + else if (__context_tag == to_underlying(Fields::kOperationSource)) + { + err = DataModel::Decode(reader, operationSource); + } + else if (__context_tag == to_underlying(Fields::kOperationError)) + { + err = DataModel::Decode(reader, operationError); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else if (__context_tag == to_underlying(Fields::kSourceNode)) + { + err = DataModel::Decode(reader, sourceNode); + } + else if (__context_tag == to_underlying(Fields::kCredentials)) + { + err = DataModel::Decode(reader, credentials); + } + else { - case to_underlying(Fields::kLockOperationType): - ReturnErrorOnFailure(DataModel::Decode(reader, lockOperationType)); - break; - case to_underlying(Fields::kOperationSource): - ReturnErrorOnFailure(DataModel::Decode(reader, operationSource)); - break; - case to_underlying(Fields::kOperationError): - ReturnErrorOnFailure(DataModel::Decode(reader, operationError)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - case to_underlying(Fields::kSourceNode): - ReturnErrorOnFailure(DataModel::Decode(reader, sourceNode)); - break; - case to_underlying(Fields::kCredentials): - ReturnErrorOnFailure(DataModel::Decode(reader, credentials)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LockOperationError. namespace LockUserChange { @@ -15524,52 +14341,57 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSourceNode), sourceNode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDataIndex), dataIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLockDataType)) + { + err = DataModel::Decode(reader, lockDataType); + } + else if (__context_tag == to_underlying(Fields::kDataOperationType)) + { + err = DataModel::Decode(reader, dataOperationType); + } + else if (__context_tag == to_underlying(Fields::kOperationSource)) + { + err = DataModel::Decode(reader, operationSource); + } + else if (__context_tag == to_underlying(Fields::kUserIndex)) + { + err = DataModel::Decode(reader, userIndex); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else if (__context_tag == to_underlying(Fields::kSourceNode)) + { + err = DataModel::Decode(reader, sourceNode); + } + else if (__context_tag == to_underlying(Fields::kDataIndex)) + { + err = DataModel::Decode(reader, dataIndex); + } + else { - case to_underlying(Fields::kLockDataType): - ReturnErrorOnFailure(DataModel::Decode(reader, lockDataType)); - break; - case to_underlying(Fields::kDataOperationType): - ReturnErrorOnFailure(DataModel::Decode(reader, dataOperationType)); - break; - case to_underlying(Fields::kOperationSource): - ReturnErrorOnFailure(DataModel::Decode(reader, operationSource)); - break; - case to_underlying(Fields::kUserIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, userIndex)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - case to_underlying(Fields::kSourceNode): - ReturnErrorOnFailure(DataModel::Decode(reader, sourceNode)); - break; - case to_underlying(Fields::kDataIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, dataIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LockUserChange. } // namespace Events @@ -15583,31 +14405,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace UpOrOpen. namespace DownOrClose { @@ -15615,31 +14426,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace DownOrClose. namespace StopMotion { @@ -15647,31 +14447,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace StopMotion. namespace GoToLiftValue { @@ -15680,34 +14469,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLiftValue), liftValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLiftValue)) { - continue; + err = DataModel::Decode(reader, liftValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kLiftValue): - ReturnErrorOnFailure(DataModel::Decode(reader, liftValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GoToLiftValue. namespace GoToLiftPercentage { @@ -15716,34 +14504,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLiftPercent100thsValue), liftPercent100thsValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kLiftPercent100thsValue)) { - continue; + err = DataModel::Decode(reader, liftPercent100thsValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kLiftPercent100thsValue): - ReturnErrorOnFailure(DataModel::Decode(reader, liftPercent100thsValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GoToLiftPercentage. namespace GoToTiltValue { @@ -15752,34 +14539,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTiltValue), tiltValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTiltValue)) { - continue; + err = DataModel::Decode(reader, tiltValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kTiltValue): - ReturnErrorOnFailure(DataModel::Decode(reader, tiltValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GoToTiltValue. namespace GoToTiltPercentage { @@ -15788,34 +14574,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTiltPercent100thsValue), tiltPercent100thsValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTiltPercent100thsValue)) { - continue; + err = DataModel::Decode(reader, tiltPercent100thsValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kTiltPercent100thsValue): - ReturnErrorOnFailure(DataModel::Decode(reader, tiltPercent100thsValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GoToTiltPercentage. } // namespace Commands @@ -15826,94 +14611,64 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Type::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; + return DataModel::Decode(reader, type); case Attributes::PhysicalClosedLimitLift::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalClosedLimitLift)); - break; + return DataModel::Decode(reader, physicalClosedLimitLift); case Attributes::PhysicalClosedLimitTilt::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalClosedLimitTilt)); - break; + return DataModel::Decode(reader, physicalClosedLimitTilt); case Attributes::CurrentPositionLift::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPositionLift)); - break; + return DataModel::Decode(reader, currentPositionLift); case Attributes::CurrentPositionTilt::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPositionTilt)); - break; + return DataModel::Decode(reader, currentPositionTilt); case Attributes::NumberOfActuationsLift::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfActuationsLift)); - break; + return DataModel::Decode(reader, numberOfActuationsLift); case Attributes::NumberOfActuationsTilt::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfActuationsTilt)); - break; + return DataModel::Decode(reader, numberOfActuationsTilt); case Attributes::ConfigStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, configStatus)); - break; + return DataModel::Decode(reader, configStatus); case Attributes::CurrentPositionLiftPercentage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPositionLiftPercentage)); - break; + return DataModel::Decode(reader, currentPositionLiftPercentage); case Attributes::CurrentPositionTiltPercentage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPositionTiltPercentage)); - break; + return DataModel::Decode(reader, currentPositionTiltPercentage); case Attributes::OperationalStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationalStatus)); - break; + return DataModel::Decode(reader, operationalStatus); case Attributes::TargetPositionLiftPercent100ths::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, targetPositionLiftPercent100ths)); - break; + return DataModel::Decode(reader, targetPositionLiftPercent100ths); case Attributes::TargetPositionTiltPercent100ths::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, targetPositionTiltPercent100ths)); - break; + return DataModel::Decode(reader, targetPositionTiltPercent100ths); case Attributes::EndProductType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, endProductType)); - break; + return DataModel::Decode(reader, endProductType); case Attributes::CurrentPositionLiftPercent100ths::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPositionLiftPercent100ths)); - break; + return DataModel::Decode(reader, currentPositionLiftPercent100ths); case Attributes::CurrentPositionTiltPercent100ths::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentPositionTiltPercent100ths)); - break; + return DataModel::Decode(reader, currentPositionTiltPercent100ths); case Attributes::InstalledOpenLimitLift::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, installedOpenLimitLift)); - break; + return DataModel::Decode(reader, installedOpenLimitLift); case Attributes::InstalledClosedLimitLift::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, installedClosedLimitLift)); - break; + return DataModel::Decode(reader, installedClosedLimitLift); case Attributes::InstalledOpenLimitTilt::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, installedOpenLimitTilt)); - break; + return DataModel::Decode(reader, installedOpenLimitTilt); case Attributes::InstalledClosedLimitTilt::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, installedClosedLimitTilt)); - break; + return DataModel::Decode(reader, installedClosedLimitTilt); case Attributes::Mode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, mode)); - break; + return DataModel::Decode(reader, mode); case Attributes::SafetyStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, safetyStatus)); - break; + return DataModel::Decode(reader, safetyStatus); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -15929,34 +14684,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPercentOpen), percentOpen)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPercentOpen)) + { + err = DataModel::Decode(reader, percentOpen); + } + else { - case to_underlying(Fields::kPercentOpen): - ReturnErrorOnFailure(DataModel::Decode(reader, percentOpen)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BarrierControlGoToPercent. namespace BarrierControlStop { @@ -15964,31 +14718,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace BarrierControlStop. } // namespace Commands @@ -15999,58 +14742,40 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::BarrierMovingState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierMovingState)); - break; + return DataModel::Decode(reader, barrierMovingState); case Attributes::BarrierSafetyStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierSafetyStatus)); - break; + return DataModel::Decode(reader, barrierSafetyStatus); case Attributes::BarrierCapabilities::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierCapabilities)); - break; + return DataModel::Decode(reader, barrierCapabilities); case Attributes::BarrierOpenEvents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierOpenEvents)); - break; + return DataModel::Decode(reader, barrierOpenEvents); case Attributes::BarrierCloseEvents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierCloseEvents)); - break; + return DataModel::Decode(reader, barrierCloseEvents); case Attributes::BarrierCommandOpenEvents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierCommandOpenEvents)); - break; + return DataModel::Decode(reader, barrierCommandOpenEvents); case Attributes::BarrierCommandCloseEvents::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierCommandCloseEvents)); - break; + return DataModel::Decode(reader, barrierCommandCloseEvents); case Attributes::BarrierOpenPeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierOpenPeriod)); - break; + return DataModel::Decode(reader, barrierOpenPeriod); case Attributes::BarrierClosePeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierClosePeriod)); - break; + return DataModel::Decode(reader, barrierClosePeriod); case Attributes::BarrierPosition::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, barrierPosition)); - break; + return DataModel::Decode(reader, barrierPosition); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -16067,97 +14792,66 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MaxPressure::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxPressure)); - break; + return DataModel::Decode(reader, maxPressure); case Attributes::MaxSpeed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxSpeed)); - break; + return DataModel::Decode(reader, maxSpeed); case Attributes::MaxFlow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxFlow)); - break; + return DataModel::Decode(reader, maxFlow); case Attributes::MinConstPressure::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minConstPressure)); - break; + return DataModel::Decode(reader, minConstPressure); case Attributes::MaxConstPressure::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxConstPressure)); - break; + return DataModel::Decode(reader, maxConstPressure); case Attributes::MinCompPressure::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minCompPressure)); - break; + return DataModel::Decode(reader, minCompPressure); case Attributes::MaxCompPressure::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxCompPressure)); - break; + return DataModel::Decode(reader, maxCompPressure); case Attributes::MinConstSpeed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minConstSpeed)); - break; + return DataModel::Decode(reader, minConstSpeed); case Attributes::MaxConstSpeed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxConstSpeed)); - break; + return DataModel::Decode(reader, maxConstSpeed); case Attributes::MinConstFlow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minConstFlow)); - break; + return DataModel::Decode(reader, minConstFlow); case Attributes::MaxConstFlow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxConstFlow)); - break; + return DataModel::Decode(reader, maxConstFlow); case Attributes::MinConstTemp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minConstTemp)); - break; + return DataModel::Decode(reader, minConstTemp); case Attributes::MaxConstTemp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxConstTemp)); - break; + return DataModel::Decode(reader, maxConstTemp); case Attributes::PumpStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, pumpStatus)); - break; + return DataModel::Decode(reader, pumpStatus); case Attributes::EffectiveOperationMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, effectiveOperationMode)); - break; + return DataModel::Decode(reader, effectiveOperationMode); case Attributes::EffectiveControlMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, effectiveControlMode)); - break; + return DataModel::Decode(reader, effectiveControlMode); case Attributes::Capacity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, capacity)); - break; + return DataModel::Decode(reader, capacity); case Attributes::Speed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, speed)); - break; + return DataModel::Decode(reader, speed); case Attributes::LifetimeRunningHours::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lifetimeRunningHours)); - break; + return DataModel::Decode(reader, lifetimeRunningHours); case Attributes::Power::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, power)); - break; + return DataModel::Decode(reader, power); case Attributes::LifetimeEnergyConsumed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lifetimeEnergyConsumed)); - break; + return DataModel::Decode(reader, lifetimeEnergyConsumed); case Attributes::OperationMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, operationMode)); - break; + return DataModel::Decode(reader, operationMode); case Attributes::ControlMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, controlMode)); - break; + return DataModel::Decode(reader, controlMode); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -16167,31 +14861,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SupplyVoltageLow. namespace SupplyVoltageHigh { @@ -16199,31 +14882,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SupplyVoltageHigh. namespace PowerMissingPhase { @@ -16231,31 +14903,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace PowerMissingPhase. namespace SystemPressureLow { @@ -16263,31 +14924,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SystemPressureLow. namespace SystemPressureHigh { @@ -16295,31 +14945,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SystemPressureHigh. namespace DryRunning { @@ -16327,31 +14966,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace DryRunning. namespace MotorTemperatureHigh { @@ -16359,31 +14987,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace MotorTemperatureHigh. namespace PumpMotorFatalFailure { @@ -16391,31 +15008,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace PumpMotorFatalFailure. namespace ElectronicTemperatureHigh { @@ -16423,31 +15029,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ElectronicTemperatureHigh. namespace PumpBlocked { @@ -16455,31 +15050,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace PumpBlocked. namespace SensorFailure { @@ -16487,31 +15071,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace SensorFailure. namespace ElectronicNonFatalFailure { @@ -16519,31 +15092,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ElectronicNonFatalFailure. namespace ElectronicFatalFailure { @@ -16551,31 +15113,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ElectronicFatalFailure. namespace GeneralFault { @@ -16583,31 +15134,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace GeneralFault. namespace Leakage { @@ -16615,31 +15155,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Leakage. namespace AirDetection { @@ -16647,31 +15176,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace AirDetection. namespace TurbineOperation { @@ -16679,31 +15197,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace TurbineOperation. } // namespace Events @@ -16725,37 +15232,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kHeatSetpoint)) + { + err = DataModel::Decode(reader, heatSetpoint); + } + else if (__context_tag == to_underlying(Fields::kCoolSetpoint)) + { + err = DataModel::Decode(reader, coolSetpoint); + } + else { - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kHeatSetpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, heatSetpoint)); - break; - case to_underlying(Fields::kCoolSetpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, coolSetpoint)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ThermostatScheduleTransition @@ -16769,37 +15275,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMode), mode)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAmount), amount)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMode)) + { + err = DataModel::Decode(reader, mode); + } + else if (__context_tag == to_underlying(Fields::kAmount)) + { + err = DataModel::Decode(reader, amount); + } + else { - case to_underlying(Fields::kMode): - ReturnErrorOnFailure(DataModel::Decode(reader, mode)); - break; - case to_underlying(Fields::kAmount): - ReturnErrorOnFailure(DataModel::Decode(reader, amount)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetpointRaiseLower. namespace GetWeeklyScheduleResponse { @@ -16812,43 +15318,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDayOfWeekForSequence), dayOfWeekForSequence)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kModeForSequence), modeForSequence)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitions), transitions)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNumberOfTransitionsForSequence)) { - continue; + err = DataModel::Decode(reader, numberOfTransitionsForSequence); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kDayOfWeekForSequence)) + { + err = DataModel::Decode(reader, dayOfWeekForSequence); + } + else if (__context_tag == to_underlying(Fields::kModeForSequence)) + { + err = DataModel::Decode(reader, modeForSequence); + } + else if (__context_tag == to_underlying(Fields::kTransitions)) + { + err = DataModel::Decode(reader, transitions); + } + else { - case to_underlying(Fields::kNumberOfTransitionsForSequence): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfTransitionsForSequence)); - break; - case to_underlying(Fields::kDayOfWeekForSequence): - ReturnErrorOnFailure(DataModel::Decode(reader, dayOfWeekForSequence)); - break; - case to_underlying(Fields::kModeForSequence): - ReturnErrorOnFailure(DataModel::Decode(reader, modeForSequence)); - break; - case to_underlying(Fields::kTransitions): - ReturnErrorOnFailure(DataModel::Decode(reader, transitions)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetWeeklyScheduleResponse. namespace SetWeeklySchedule { @@ -16861,43 +15369,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDayOfWeekForSequence), dayOfWeekForSequence)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kModeForSequence), modeForSequence)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitions), transitions)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNumberOfTransitionsForSequence)) + { + err = DataModel::Decode(reader, numberOfTransitionsForSequence); + } + else if (__context_tag == to_underlying(Fields::kDayOfWeekForSequence)) + { + err = DataModel::Decode(reader, dayOfWeekForSequence); + } + else if (__context_tag == to_underlying(Fields::kModeForSequence)) + { + err = DataModel::Decode(reader, modeForSequence); + } + else if (__context_tag == to_underlying(Fields::kTransitions)) + { + err = DataModel::Decode(reader, transitions); + } + else { - case to_underlying(Fields::kNumberOfTransitionsForSequence): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfTransitionsForSequence)); - break; - case to_underlying(Fields::kDayOfWeekForSequence): - ReturnErrorOnFailure(DataModel::Decode(reader, dayOfWeekForSequence)); - break; - case to_underlying(Fields::kModeForSequence): - ReturnErrorOnFailure(DataModel::Decode(reader, modeForSequence)); - break; - case to_underlying(Fields::kTransitions): - ReturnErrorOnFailure(DataModel::Decode(reader, transitions)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SetWeeklySchedule. namespace GetWeeklySchedule { @@ -16907,37 +15417,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDaysToReturn), daysToReturn)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kModeToReturn), modeToReturn)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDaysToReturn)) { - continue; + err = DataModel::Decode(reader, daysToReturn); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kModeToReturn)) + { + err = DataModel::Decode(reader, modeToReturn); + } + else { - case to_underlying(Fields::kDaysToReturn): - ReturnErrorOnFailure(DataModel::Decode(reader, daysToReturn)); - break; - case to_underlying(Fields::kModeToReturn): - ReturnErrorOnFailure(DataModel::Decode(reader, modeToReturn)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetWeeklySchedule. namespace ClearWeeklySchedule { @@ -16945,31 +15455,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ClearWeeklySchedule. } // namespace Commands @@ -16980,175 +15479,118 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::LocalTemperature::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, localTemperature)); - break; + return DataModel::Decode(reader, localTemperature); case Attributes::OutdoorTemperature::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, outdoorTemperature)); - break; + return DataModel::Decode(reader, outdoorTemperature); case Attributes::Occupancy::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupancy)); - break; + return DataModel::Decode(reader, occupancy); case Attributes::AbsMinHeatSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, absMinHeatSetpointLimit)); - break; + return DataModel::Decode(reader, absMinHeatSetpointLimit); case Attributes::AbsMaxHeatSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, absMaxHeatSetpointLimit)); - break; + return DataModel::Decode(reader, absMaxHeatSetpointLimit); case Attributes::AbsMinCoolSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, absMinCoolSetpointLimit)); - break; + return DataModel::Decode(reader, absMinCoolSetpointLimit); case Attributes::AbsMaxCoolSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, absMaxCoolSetpointLimit)); - break; + return DataModel::Decode(reader, absMaxCoolSetpointLimit); case Attributes::PICoolingDemand::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, PICoolingDemand)); - break; + return DataModel::Decode(reader, PICoolingDemand); case Attributes::PIHeatingDemand::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, PIHeatingDemand)); - break; + return DataModel::Decode(reader, PIHeatingDemand); case Attributes::HVACSystemTypeConfiguration::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, HVACSystemTypeConfiguration)); - break; + return DataModel::Decode(reader, HVACSystemTypeConfiguration); case Attributes::LocalTemperatureCalibration::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, localTemperatureCalibration)); - break; + return DataModel::Decode(reader, localTemperatureCalibration); case Attributes::OccupiedCoolingSetpoint::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupiedCoolingSetpoint)); - break; + return DataModel::Decode(reader, occupiedCoolingSetpoint); case Attributes::OccupiedHeatingSetpoint::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupiedHeatingSetpoint)); - break; + return DataModel::Decode(reader, occupiedHeatingSetpoint); case Attributes::UnoccupiedCoolingSetpoint::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, unoccupiedCoolingSetpoint)); - break; + return DataModel::Decode(reader, unoccupiedCoolingSetpoint); case Attributes::UnoccupiedHeatingSetpoint::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, unoccupiedHeatingSetpoint)); - break; + return DataModel::Decode(reader, unoccupiedHeatingSetpoint); case Attributes::MinHeatSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minHeatSetpointLimit)); - break; + return DataModel::Decode(reader, minHeatSetpointLimit); case Attributes::MaxHeatSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxHeatSetpointLimit)); - break; + return DataModel::Decode(reader, maxHeatSetpointLimit); case Attributes::MinCoolSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minCoolSetpointLimit)); - break; + return DataModel::Decode(reader, minCoolSetpointLimit); case Attributes::MaxCoolSetpointLimit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxCoolSetpointLimit)); - break; + return DataModel::Decode(reader, maxCoolSetpointLimit); case Attributes::MinSetpointDeadBand::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minSetpointDeadBand)); - break; + return DataModel::Decode(reader, minSetpointDeadBand); case Attributes::RemoteSensing::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, remoteSensing)); - break; + return DataModel::Decode(reader, remoteSensing); case Attributes::ControlSequenceOfOperation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, controlSequenceOfOperation)); - break; + return DataModel::Decode(reader, controlSequenceOfOperation); case Attributes::SystemMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, systemMode)); - break; + return DataModel::Decode(reader, systemMode); case Attributes::ThermostatRunningMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, thermostatRunningMode)); - break; + return DataModel::Decode(reader, thermostatRunningMode); case Attributes::StartOfWeek::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startOfWeek)); - break; + return DataModel::Decode(reader, startOfWeek); case Attributes::NumberOfWeeklyTransitions::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfWeeklyTransitions)); - break; + return DataModel::Decode(reader, numberOfWeeklyTransitions); case Attributes::NumberOfDailyTransitions::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfDailyTransitions)); - break; + return DataModel::Decode(reader, numberOfDailyTransitions); case Attributes::TemperatureSetpointHold::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, temperatureSetpointHold)); - break; + return DataModel::Decode(reader, temperatureSetpointHold); case Attributes::TemperatureSetpointHoldDuration::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, temperatureSetpointHoldDuration)); - break; + return DataModel::Decode(reader, temperatureSetpointHoldDuration); case Attributes::ThermostatProgrammingOperationMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, thermostatProgrammingOperationMode)); - break; + return DataModel::Decode(reader, thermostatProgrammingOperationMode); case Attributes::ThermostatRunningState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, thermostatRunningState)); - break; + return DataModel::Decode(reader, thermostatRunningState); case Attributes::SetpointChangeSource::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, setpointChangeSource)); - break; + return DataModel::Decode(reader, setpointChangeSource); case Attributes::SetpointChangeAmount::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, setpointChangeAmount)); - break; + return DataModel::Decode(reader, setpointChangeAmount); case Attributes::SetpointChangeSourceTimestamp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, setpointChangeSourceTimestamp)); - break; + return DataModel::Decode(reader, setpointChangeSourceTimestamp); case Attributes::OccupiedSetback::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupiedSetback)); - break; + return DataModel::Decode(reader, occupiedSetback); case Attributes::OccupiedSetbackMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupiedSetbackMin)); - break; + return DataModel::Decode(reader, occupiedSetbackMin); case Attributes::OccupiedSetbackMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupiedSetbackMax)); - break; + return DataModel::Decode(reader, occupiedSetbackMax); case Attributes::UnoccupiedSetback::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, unoccupiedSetback)); - break; + return DataModel::Decode(reader, unoccupiedSetback); case Attributes::UnoccupiedSetbackMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, unoccupiedSetbackMin)); - break; + return DataModel::Decode(reader, unoccupiedSetbackMin); case Attributes::UnoccupiedSetbackMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, unoccupiedSetbackMax)); - break; + return DataModel::Decode(reader, unoccupiedSetbackMax); case Attributes::EmergencyHeatDelta::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, emergencyHeatDelta)); - break; + return DataModel::Decode(reader, emergencyHeatDelta); case Attributes::ACType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACType)); - break; + return DataModel::Decode(reader, ACType); case Attributes::ACCapacity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACCapacity)); - break; + return DataModel::Decode(reader, ACCapacity); case Attributes::ACRefrigerantType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACRefrigerantType)); - break; + return DataModel::Decode(reader, ACRefrigerantType); case Attributes::ACCompressorType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACCompressorType)); - break; + return DataModel::Decode(reader, ACCompressorType); case Attributes::ACErrorCode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACErrorCode)); - break; + return DataModel::Decode(reader, ACErrorCode); case Attributes::ACLouverPosition::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACLouverPosition)); - break; + return DataModel::Decode(reader, ACLouverPosition); case Attributes::ACCoilTemperature::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACCoilTemperature)); - break; + return DataModel::Decode(reader, ACCoilTemperature); case Attributes::ACCapacityformat::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ACCapacityformat)); - break; + return DataModel::Decode(reader, ACCapacityformat); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -17166,40 +15608,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDirection), direction)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kWrap), wrap)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kLowestOff), lowestOff)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDirection)) { - continue; + err = DataModel::Decode(reader, direction); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kWrap)) + { + err = DataModel::Decode(reader, wrap); + } + else if (__context_tag == to_underlying(Fields::kLowestOff)) + { + err = DataModel::Decode(reader, lowestOff); + } + else { - case to_underlying(Fields::kDirection): - ReturnErrorOnFailure(DataModel::Decode(reader, direction)); - break; - case to_underlying(Fields::kWrap): - ReturnErrorOnFailure(DataModel::Decode(reader, wrap)); - break; - case to_underlying(Fields::kLowestOff): - ReturnErrorOnFailure(DataModel::Decode(reader, lowestOff)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Step. } // namespace Commands @@ -17210,64 +15653,44 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::FanMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, fanMode)); - break; + return DataModel::Decode(reader, fanMode); case Attributes::FanModeSequence::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, fanModeSequence)); - break; + return DataModel::Decode(reader, fanModeSequence); case Attributes::PercentSetting::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, percentSetting)); - break; + return DataModel::Decode(reader, percentSetting); case Attributes::PercentCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, percentCurrent)); - break; + return DataModel::Decode(reader, percentCurrent); case Attributes::SpeedMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, speedMax)); - break; + return DataModel::Decode(reader, speedMax); case Attributes::SpeedSetting::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, speedSetting)); - break; + return DataModel::Decode(reader, speedSetting); case Attributes::SpeedCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, speedCurrent)); - break; + return DataModel::Decode(reader, speedCurrent); case Attributes::RockSupport::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rockSupport)); - break; + return DataModel::Decode(reader, rockSupport); case Attributes::RockSetting::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rockSetting)); - break; + return DataModel::Decode(reader, rockSetting); case Attributes::WindSupport::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, windSupport)); - break; + return DataModel::Decode(reader, windSupport); case Attributes::WindSetting::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, windSetting)); - break; + return DataModel::Decode(reader, windSetting); case Attributes::AirflowDirection::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, airflowDirection)); - break; + return DataModel::Decode(reader, airflowDirection); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -17284,37 +15707,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::TemperatureDisplayMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, temperatureDisplayMode)); - break; + return DataModel::Decode(reader, temperatureDisplayMode); case Attributes::KeypadLockout::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, keypadLockout)); - break; + return DataModel::Decode(reader, keypadLockout); case Attributes::ScheduleProgrammingVisibility::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, scheduleProgrammingVisibility)); - break; + return DataModel::Decode(reader, scheduleProgrammingVisibility); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -17334,46 +15746,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHue)) + { + err = DataModel::Decode(reader, hue); + } + else if (__context_tag == to_underlying(Fields::kDirection)) + { + err = DataModel::Decode(reader, direction); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kHue): - ReturnErrorOnFailure(DataModel::Decode(reader, hue)); - break; - case to_underlying(Fields::kDirection): - ReturnErrorOnFailure(DataModel::Decode(reader, direction)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToHue. namespace MoveHue { @@ -17385,43 +15800,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRate), rate)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMoveMode)) + { + err = DataModel::Decode(reader, moveMode); + } + else if (__context_tag == to_underlying(Fields::kRate)) + { + err = DataModel::Decode(reader, rate); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kMoveMode): - ReturnErrorOnFailure(DataModel::Decode(reader, moveMode)); - break; - case to_underlying(Fields::kRate): - ReturnErrorOnFailure(DataModel::Decode(reader, rate)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveHue. namespace StepHue { @@ -17434,46 +15851,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepMode)) { - continue; + err = DataModel::Decode(reader, stepMode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStepSize)) + { + err = DataModel::Decode(reader, stepSize); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepMode): - ReturnErrorOnFailure(DataModel::Decode(reader, stepMode)); - break; - case to_underlying(Fields::kStepSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stepSize)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StepHue. namespace MoveToSaturation { @@ -17485,43 +15905,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSaturation)) { - continue; + err = DataModel::Decode(reader, saturation); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kSaturation): - ReturnErrorOnFailure(DataModel::Decode(reader, saturation)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToSaturation. namespace MoveSaturation { @@ -17533,43 +15955,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRate), rate)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMoveMode)) + { + err = DataModel::Decode(reader, moveMode); + } + else if (__context_tag == to_underlying(Fields::kRate)) + { + err = DataModel::Decode(reader, rate); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kMoveMode): - ReturnErrorOnFailure(DataModel::Decode(reader, moveMode)); - break; - case to_underlying(Fields::kRate): - ReturnErrorOnFailure(DataModel::Decode(reader, rate)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveSaturation. namespace StepSaturation { @@ -17582,46 +16006,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepMode)) { - continue; + err = DataModel::Decode(reader, stepMode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStepSize)) + { + err = DataModel::Decode(reader, stepSize); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepMode): - ReturnErrorOnFailure(DataModel::Decode(reader, stepMode)); - break; - case to_underlying(Fields::kStepSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stepSize)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StepSaturation. namespace MoveToHueAndSaturation { @@ -17634,46 +16061,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHue)) { - continue; + err = DataModel::Decode(reader, hue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kSaturation)) + { + err = DataModel::Decode(reader, saturation); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kHue): - ReturnErrorOnFailure(DataModel::Decode(reader, hue)); - break; - case to_underlying(Fields::kSaturation): - ReturnErrorOnFailure(DataModel::Decode(reader, saturation)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToHueAndSaturation. namespace MoveToColor { @@ -17686,50 +16116,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kColorX)) { - case to_underlying(Fields::kColorX): - ReturnErrorOnFailure(DataModel::Decode(reader, colorX)); - break; - case to_underlying(Fields::kColorY): - ReturnErrorOnFailure(DataModel::Decode(reader, colorY)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; + err = DataModel::Decode(reader, colorX); } - } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; -} -} // namespace MoveToColor. -namespace MoveColor { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const + else if (__context_tag == to_underlying(Fields::kColorY)) + { + err = DataModel::Decode(reader, colorY); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace MoveToColor. +namespace MoveColor { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); @@ -17737,43 +16170,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRateY), rateY)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRateX)) + { + err = DataModel::Decode(reader, rateX); + } + else if (__context_tag == to_underlying(Fields::kRateY)) + { + err = DataModel::Decode(reader, rateY); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kRateX): - ReturnErrorOnFailure(DataModel::Decode(reader, rateX)); - break; - case to_underlying(Fields::kRateY): - ReturnErrorOnFailure(DataModel::Decode(reader, rateY)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveColor. namespace StepColor { @@ -17786,46 +16221,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepX)) + { + err = DataModel::Decode(reader, stepX); + } + else if (__context_tag == to_underlying(Fields::kStepY)) + { + err = DataModel::Decode(reader, stepY); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepX): - ReturnErrorOnFailure(DataModel::Decode(reader, stepX)); - break; - case to_underlying(Fields::kStepY): - ReturnErrorOnFailure(DataModel::Decode(reader, stepY)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StepColor. namespace MoveToColorTemperature { @@ -17837,43 +16275,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kColorTemperatureMireds)) + { + err = DataModel::Decode(reader, colorTemperatureMireds); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kColorTemperatureMireds): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTemperatureMireds)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveToColorTemperature. namespace EnhancedMoveToHue { @@ -17886,46 +16326,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEnhancedHue)) + { + err = DataModel::Decode(reader, enhancedHue); + } + else if (__context_tag == to_underlying(Fields::kDirection)) + { + err = DataModel::Decode(reader, direction); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kEnhancedHue): - ReturnErrorOnFailure(DataModel::Decode(reader, enhancedHue)); - break; - case to_underlying(Fields::kDirection): - ReturnErrorOnFailure(DataModel::Decode(reader, direction)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedMoveToHue. namespace EnhancedMoveHue { @@ -17937,43 +16380,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRate), rate)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMoveMode)) + { + err = DataModel::Decode(reader, moveMode); + } + else if (__context_tag == to_underlying(Fields::kRate)) + { + err = DataModel::Decode(reader, rate); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kMoveMode): - ReturnErrorOnFailure(DataModel::Decode(reader, moveMode)); - break; - case to_underlying(Fields::kRate): - ReturnErrorOnFailure(DataModel::Decode(reader, rate)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedMoveHue. namespace EnhancedStepHue { @@ -17986,46 +16431,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepMode)) + { + err = DataModel::Decode(reader, stepMode); + } + else if (__context_tag == to_underlying(Fields::kStepSize)) + { + err = DataModel::Decode(reader, stepSize); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepMode): - ReturnErrorOnFailure(DataModel::Decode(reader, stepMode)); - break; - case to_underlying(Fields::kStepSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stepSize)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedStepHue. namespace EnhancedMoveToHueAndSaturation { @@ -18038,46 +16486,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTransitionTime), transitionTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEnhancedHue)) + { + err = DataModel::Decode(reader, enhancedHue); + } + else if (__context_tag == to_underlying(Fields::kSaturation)) + { + err = DataModel::Decode(reader, saturation); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kEnhancedHue): - ReturnErrorOnFailure(DataModel::Decode(reader, enhancedHue)); - break; - case to_underlying(Fields::kSaturation): - ReturnErrorOnFailure(DataModel::Decode(reader, saturation)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace EnhancedMoveToHueAndSaturation. namespace ColorLoopSet { @@ -18092,52 +16543,57 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStartHue), startHue)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUpdateFlags)) + { + err = DataModel::Decode(reader, updateFlags); + } + else if (__context_tag == to_underlying(Fields::kAction)) + { + err = DataModel::Decode(reader, action); + } + else if (__context_tag == to_underlying(Fields::kDirection)) + { + err = DataModel::Decode(reader, direction); + } + else if (__context_tag == to_underlying(Fields::kTime)) + { + err = DataModel::Decode(reader, time); + } + else if (__context_tag == to_underlying(Fields::kStartHue)) + { + err = DataModel::Decode(reader, startHue); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kUpdateFlags): - ReturnErrorOnFailure(DataModel::Decode(reader, updateFlags)); - break; - case to_underlying(Fields::kAction): - ReturnErrorOnFailure(DataModel::Decode(reader, action)); - break; - case to_underlying(Fields::kDirection): - ReturnErrorOnFailure(DataModel::Decode(reader, direction)); - break; - case to_underlying(Fields::kTime): - ReturnErrorOnFailure(DataModel::Decode(reader, time)); - break; - case to_underlying(Fields::kStartHue): - ReturnErrorOnFailure(DataModel::Decode(reader, startHue)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ColorLoopSet. namespace StopMoveStep { @@ -18147,37 +16603,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StopMoveStep. namespace MoveColorTemperature { @@ -18193,49 +16649,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::Encode(aWriter, TLV::ContextTag(Fields::kColorTemperatureMaximumMireds), colorTemperatureMaximumMireds)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMoveMode)) + { + err = DataModel::Decode(reader, moveMode); + } + else if (__context_tag == to_underlying(Fields::kRate)) + { + err = DataModel::Decode(reader, rate); + } + else if (__context_tag == to_underlying(Fields::kColorTemperatureMinimumMireds)) + { + err = DataModel::Decode(reader, colorTemperatureMinimumMireds); + } + else if (__context_tag == to_underlying(Fields::kColorTemperatureMaximumMireds)) + { + err = DataModel::Decode(reader, colorTemperatureMaximumMireds); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kMoveMode): - ReturnErrorOnFailure(DataModel::Decode(reader, moveMode)); - break; - case to_underlying(Fields::kRate): - ReturnErrorOnFailure(DataModel::Decode(reader, rate)); - break; - case to_underlying(Fields::kColorTemperatureMinimumMireds): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTemperatureMinimumMireds)); - break; - case to_underlying(Fields::kColorTemperatureMaximumMireds): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTemperatureMaximumMireds)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace MoveColorTemperature. namespace StepColorTemperature { @@ -18252,52 +16712,57 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::Encode(aWriter, TLV::ContextTag(Fields::kColorTemperatureMaximumMireds), colorTemperatureMaximumMireds)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsMask), optionsMask)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionsOverride), optionsOverride)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStepMode)) { - continue; + err = DataModel::Decode(reader, stepMode); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStepSize)) + { + err = DataModel::Decode(reader, stepSize); + } + else if (__context_tag == to_underlying(Fields::kTransitionTime)) + { + err = DataModel::Decode(reader, transitionTime); + } + else if (__context_tag == to_underlying(Fields::kColorTemperatureMinimumMireds)) + { + err = DataModel::Decode(reader, colorTemperatureMinimumMireds); + } + else if (__context_tag == to_underlying(Fields::kColorTemperatureMaximumMireds)) + { + err = DataModel::Decode(reader, colorTemperatureMaximumMireds); + } + else if (__context_tag == to_underlying(Fields::kOptionsMask)) + { + err = DataModel::Decode(reader, optionsMask); + } + else if (__context_tag == to_underlying(Fields::kOptionsOverride)) + { + err = DataModel::Decode(reader, optionsOverride); + } + else { - case to_underlying(Fields::kStepMode): - ReturnErrorOnFailure(DataModel::Decode(reader, stepMode)); - break; - case to_underlying(Fields::kStepSize): - ReturnErrorOnFailure(DataModel::Decode(reader, stepSize)); - break; - case to_underlying(Fields::kTransitionTime): - ReturnErrorOnFailure(DataModel::Decode(reader, transitionTime)); - break; - case to_underlying(Fields::kColorTemperatureMinimumMireds): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTemperatureMinimumMireds)); - break; - case to_underlying(Fields::kColorTemperatureMaximumMireds): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTemperatureMaximumMireds)); - break; - case to_underlying(Fields::kOptionsMask): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsMask)); - break; - case to_underlying(Fields::kOptionsOverride): - ReturnErrorOnFailure(DataModel::Decode(reader, optionsOverride)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StepColorTemperature. } // namespace Commands @@ -18308,184 +16773,124 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::CurrentHue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentHue)); - break; + return DataModel::Decode(reader, currentHue); case Attributes::CurrentSaturation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentSaturation)); - break; + return DataModel::Decode(reader, currentSaturation); case Attributes::RemainingTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, remainingTime)); - break; + return DataModel::Decode(reader, remainingTime); case Attributes::CurrentX::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentX)); - break; + return DataModel::Decode(reader, currentX); case Attributes::CurrentY::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentY)); - break; + return DataModel::Decode(reader, currentY); case Attributes::DriftCompensation::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, driftCompensation)); - break; + return DataModel::Decode(reader, driftCompensation); case Attributes::CompensationText::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, compensationText)); - break; + return DataModel::Decode(reader, compensationText); case Attributes::ColorTemperatureMireds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTemperatureMireds)); - break; + return DataModel::Decode(reader, colorTemperatureMireds); case Attributes::ColorMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorMode)); - break; + return DataModel::Decode(reader, colorMode); case Attributes::Options::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, options)); - break; + return DataModel::Decode(reader, options); case Attributes::NumberOfPrimaries::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfPrimaries)); - break; + return DataModel::Decode(reader, numberOfPrimaries); case Attributes::Primary1X::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary1X)); - break; + return DataModel::Decode(reader, primary1X); case Attributes::Primary1Y::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary1Y)); - break; + return DataModel::Decode(reader, primary1Y); case Attributes::Primary1Intensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary1Intensity)); - break; + return DataModel::Decode(reader, primary1Intensity); case Attributes::Primary2X::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary2X)); - break; + return DataModel::Decode(reader, primary2X); case Attributes::Primary2Y::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary2Y)); - break; + return DataModel::Decode(reader, primary2Y); case Attributes::Primary2Intensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary2Intensity)); - break; + return DataModel::Decode(reader, primary2Intensity); case Attributes::Primary3X::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary3X)); - break; + return DataModel::Decode(reader, primary3X); case Attributes::Primary3Y::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary3Y)); - break; + return DataModel::Decode(reader, primary3Y); case Attributes::Primary3Intensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary3Intensity)); - break; + return DataModel::Decode(reader, primary3Intensity); case Attributes::Primary4X::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary4X)); - break; + return DataModel::Decode(reader, primary4X); case Attributes::Primary4Y::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary4Y)); - break; + return DataModel::Decode(reader, primary4Y); case Attributes::Primary4Intensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary4Intensity)); - break; + return DataModel::Decode(reader, primary4Intensity); case Attributes::Primary5X::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary5X)); - break; + return DataModel::Decode(reader, primary5X); case Attributes::Primary5Y::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary5Y)); - break; + return DataModel::Decode(reader, primary5Y); case Attributes::Primary5Intensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary5Intensity)); - break; + return DataModel::Decode(reader, primary5Intensity); case Attributes::Primary6X::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary6X)); - break; + return DataModel::Decode(reader, primary6X); case Attributes::Primary6Y::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary6Y)); - break; + return DataModel::Decode(reader, primary6Y); case Attributes::Primary6Intensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, primary6Intensity)); - break; + return DataModel::Decode(reader, primary6Intensity); case Attributes::WhitePointX::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, whitePointX)); - break; + return DataModel::Decode(reader, whitePointX); case Attributes::WhitePointY::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, whitePointY)); - break; + return DataModel::Decode(reader, whitePointY); case Attributes::ColorPointRX::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointRX)); - break; + return DataModel::Decode(reader, colorPointRX); case Attributes::ColorPointRY::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointRY)); - break; + return DataModel::Decode(reader, colorPointRY); case Attributes::ColorPointRIntensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointRIntensity)); - break; + return DataModel::Decode(reader, colorPointRIntensity); case Attributes::ColorPointGX::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointGX)); - break; + return DataModel::Decode(reader, colorPointGX); case Attributes::ColorPointGY::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointGY)); - break; + return DataModel::Decode(reader, colorPointGY); case Attributes::ColorPointGIntensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointGIntensity)); - break; + return DataModel::Decode(reader, colorPointGIntensity); case Attributes::ColorPointBX::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointBX)); - break; + return DataModel::Decode(reader, colorPointBX); case Attributes::ColorPointBY::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointBY)); - break; + return DataModel::Decode(reader, colorPointBY); case Attributes::ColorPointBIntensity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorPointBIntensity)); - break; + return DataModel::Decode(reader, colorPointBIntensity); case Attributes::EnhancedCurrentHue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enhancedCurrentHue)); - break; + return DataModel::Decode(reader, enhancedCurrentHue); case Attributes::EnhancedColorMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enhancedColorMode)); - break; + return DataModel::Decode(reader, enhancedColorMode); case Attributes::ColorLoopActive::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorLoopActive)); - break; + return DataModel::Decode(reader, colorLoopActive); case Attributes::ColorLoopDirection::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorLoopDirection)); - break; + return DataModel::Decode(reader, colorLoopDirection); case Attributes::ColorLoopTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorLoopTime)); - break; + return DataModel::Decode(reader, colorLoopTime); case Attributes::ColorLoopStartEnhancedHue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorLoopStartEnhancedHue)); - break; + return DataModel::Decode(reader, colorLoopStartEnhancedHue); case Attributes::ColorLoopStoredEnhancedHue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorLoopStoredEnhancedHue)); - break; + return DataModel::Decode(reader, colorLoopStoredEnhancedHue); case Attributes::ColorCapabilities::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorCapabilities)); - break; + return DataModel::Decode(reader, colorCapabilities); case Attributes::ColorTempPhysicalMinMireds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTempPhysicalMinMireds)); - break; + return DataModel::Decode(reader, colorTempPhysicalMinMireds); case Attributes::ColorTempPhysicalMaxMireds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, colorTempPhysicalMaxMireds)); - break; + return DataModel::Decode(reader, colorTempPhysicalMaxMireds); case Attributes::CoupleColorTempToLevelMinMireds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, coupleColorTempToLevelMinMireds)); - break; + return DataModel::Decode(reader, coupleColorTempToLevelMinMireds); case Attributes::StartUpColorTemperatureMireds::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startUpColorTemperatureMireds)); - break; + return DataModel::Decode(reader, startUpColorTemperatureMireds); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18502,70 +16907,48 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::PhysicalMinLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalMinLevel)); - break; + return DataModel::Decode(reader, physicalMinLevel); case Attributes::PhysicalMaxLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalMaxLevel)); - break; + return DataModel::Decode(reader, physicalMaxLevel); case Attributes::BallastStatus::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ballastStatus)); - break; + return DataModel::Decode(reader, ballastStatus); case Attributes::MinLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minLevel)); - break; + return DataModel::Decode(reader, minLevel); case Attributes::MaxLevel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxLevel)); - break; + return DataModel::Decode(reader, maxLevel); case Attributes::IntrinsicBallastFactor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, intrinsicBallastFactor)); - break; + return DataModel::Decode(reader, intrinsicBallastFactor); case Attributes::BallastFactorAdjustment::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ballastFactorAdjustment)); - break; + return DataModel::Decode(reader, ballastFactorAdjustment); case Attributes::LampQuantity::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampQuantity)); - break; + return DataModel::Decode(reader, lampQuantity); case Attributes::LampType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampType)); - break; + return DataModel::Decode(reader, lampType); case Attributes::LampManufacturer::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampManufacturer)); - break; + return DataModel::Decode(reader, lampManufacturer); case Attributes::LampRatedHours::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampRatedHours)); - break; + return DataModel::Decode(reader, lampRatedHours); case Attributes::LampBurnHours::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampBurnHours)); - break; + return DataModel::Decode(reader, lampBurnHours); case Attributes::LampAlarmMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampAlarmMode)); - break; + return DataModel::Decode(reader, lampAlarmMode); case Attributes::LampBurnHoursTripPoint::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lampBurnHoursTripPoint)); - break; + return DataModel::Decode(reader, lampBurnHoursTripPoint); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18582,43 +16965,30 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::Tolerance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, tolerance)); - break; + return DataModel::Decode(reader, tolerance); case Attributes::LightSensorType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lightSensorType)); - break; + return DataModel::Decode(reader, lightSensorType); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18635,40 +17005,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::Tolerance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, tolerance)); - break; + return DataModel::Decode(reader, tolerance); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18685,55 +17043,38 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::Tolerance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, tolerance)); - break; + return DataModel::Decode(reader, tolerance); case Attributes::ScaledValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, scaledValue)); - break; + return DataModel::Decode(reader, scaledValue); case Attributes::MinScaledValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minScaledValue)); - break; + return DataModel::Decode(reader, minScaledValue); case Attributes::MaxScaledValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxScaledValue)); - break; + return DataModel::Decode(reader, maxScaledValue); case Attributes::ScaledTolerance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, scaledTolerance)); - break; + return DataModel::Decode(reader, scaledTolerance); case Attributes::Scale::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, scale)); - break; + return DataModel::Decode(reader, scale); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18750,40 +17091,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::Tolerance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, tolerance)); - break; + return DataModel::Decode(reader, tolerance); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18800,40 +17129,28 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::Tolerance::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, tolerance)); - break; + return DataModel::Decode(reader, tolerance); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18850,64 +17167,44 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Occupancy::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupancy)); - break; + return DataModel::Decode(reader, occupancy); case Attributes::OccupancySensorType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupancySensorType)); - break; + return DataModel::Decode(reader, occupancySensorType); case Attributes::OccupancySensorTypeBitmap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, occupancySensorTypeBitmap)); - break; + return DataModel::Decode(reader, occupancySensorTypeBitmap); case Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, PIROccupiedToUnoccupiedDelay)); - break; + return DataModel::Decode(reader, PIROccupiedToUnoccupiedDelay); case Attributes::PIRUnoccupiedToOccupiedDelay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, PIRUnoccupiedToOccupiedDelay)); - break; + return DataModel::Decode(reader, PIRUnoccupiedToOccupiedDelay); case Attributes::PIRUnoccupiedToOccupiedThreshold::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, PIRUnoccupiedToOccupiedThreshold)); - break; + return DataModel::Decode(reader, PIRUnoccupiedToOccupiedThreshold); case Attributes::UltrasonicOccupiedToUnoccupiedDelay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ultrasonicOccupiedToUnoccupiedDelay)); - break; + return DataModel::Decode(reader, ultrasonicOccupiedToUnoccupiedDelay); case Attributes::UltrasonicUnoccupiedToOccupiedDelay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ultrasonicUnoccupiedToOccupiedDelay)); - break; + return DataModel::Decode(reader, ultrasonicUnoccupiedToOccupiedDelay); case Attributes::UltrasonicUnoccupiedToOccupiedThreshold::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ultrasonicUnoccupiedToOccupiedThreshold)); - break; + return DataModel::Decode(reader, ultrasonicUnoccupiedToOccupiedThreshold); case Attributes::PhysicalContactOccupiedToUnoccupiedDelay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalContactOccupiedToUnoccupiedDelay)); - break; + return DataModel::Decode(reader, physicalContactOccupiedToUnoccupiedDelay); case Attributes::PhysicalContactUnoccupiedToOccupiedDelay::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalContactUnoccupiedToOccupiedDelay)); - break; + return DataModel::Decode(reader, physicalContactUnoccupiedToOccupiedDelay); case Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, physicalContactUnoccupiedToOccupiedThreshold)); - break; + return DataModel::Decode(reader, physicalContactUnoccupiedToOccupiedThreshold); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18924,61 +17221,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -18995,61 +17273,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19066,61 +17325,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19137,61 +17377,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19208,61 +17429,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19279,61 +17481,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19350,61 +17533,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19421,61 +17585,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19492,61 +17637,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19563,61 +17689,42 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredValue)); - break; + return DataModel::Decode(reader, measuredValue); case Attributes::MinMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, minMeasuredValue)); - break; + return DataModel::Decode(reader, minMeasuredValue); case Attributes::MaxMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, maxMeasuredValue)); - break; + return DataModel::Decode(reader, maxMeasuredValue); case Attributes::PeakMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValue)); - break; + return DataModel::Decode(reader, peakMeasuredValue); case Attributes::PeakMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, peakMeasuredValueWindow)); - break; + return DataModel::Decode(reader, peakMeasuredValueWindow); case Attributes::AverageMeasuredValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValue)); - break; + return DataModel::Decode(reader, averageMeasuredValue); case Attributes::AverageMeasuredValueWindow::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageMeasuredValueWindow)); - break; + return DataModel::Decode(reader, averageMeasuredValueWindow); case Attributes::Uncertainty::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, uncertainty)); - break; + return DataModel::Decode(reader, uncertainty); case Attributes::MeasurementUnit::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementUnit)); - break; + return DataModel::Decode(reader, measurementUnit); case Attributes::MeasurementMedium::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementMedium)); - break; + return DataModel::Decode(reader, measurementMedium); case Attributes::LevelValue::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, levelValue)); - break; + return DataModel::Decode(reader, levelValue); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19634,31 +17741,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MACAddress::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, MACAddress)); - break; + return DataModel::Decode(reader, MACAddress); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19683,43 +17781,44 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMajorNumber)) + { + err = DataModel::Decode(reader, majorNumber); + } + else if (__context_tag == to_underlying(Fields::kMinorNumber)) + { + err = DataModel::Decode(reader, minorNumber); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kCallSign)) + { + err = DataModel::Decode(reader, callSign); + } + else if (__context_tag == to_underlying(Fields::kAffiliateCallSign)) + { + err = DataModel::Decode(reader, affiliateCallSign); + } + else { - case to_underlying(Fields::kMajorNumber): - ReturnErrorOnFailure(DataModel::Decode(reader, majorNumber)); - break; - case to_underlying(Fields::kMinorNumber): - ReturnErrorOnFailure(DataModel::Decode(reader, minorNumber)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kCallSign): - ReturnErrorOnFailure(DataModel::Decode(reader, callSign)); - break; - case to_underlying(Fields::kAffiliateCallSign): - ReturnErrorOnFailure(DataModel::Decode(reader, affiliateCallSign)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChannelInfoStruct @@ -19738,40 +17837,40 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kOperatorName)) + { + err = DataModel::Decode(reader, operatorName); + } + else if (__context_tag == to_underlying(Fields::kLineupName)) + { + err = DataModel::Decode(reader, lineupName); + } + else if (__context_tag == to_underlying(Fields::kPostalCode)) + { + err = DataModel::Decode(reader, postalCode); + } + else if (__context_tag == to_underlying(Fields::kLineupInfoType)) + { + err = DataModel::Decode(reader, lineupInfoType); + } + else { - case to_underlying(Fields::kOperatorName): - ReturnErrorOnFailure(DataModel::Decode(reader, operatorName)); - break; - case to_underlying(Fields::kLineupName): - ReturnErrorOnFailure(DataModel::Decode(reader, lineupName)); - break; - case to_underlying(Fields::kPostalCode): - ReturnErrorOnFailure(DataModel::Decode(reader, postalCode)); - break; - case to_underlying(Fields::kLineupInfoType): - ReturnErrorOnFailure(DataModel::Decode(reader, lineupInfoType)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LineupInfoStruct @@ -19784,34 +17883,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMatch), match)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMatch)) { - continue; + err = DataModel::Decode(reader, match); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kMatch): - ReturnErrorOnFailure(DataModel::Decode(reader, match)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeChannel. namespace ChangeChannelResponse { @@ -19821,37 +17919,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) { - continue; + err = DataModel::Decode(reader, status); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeChannelResponse. namespace ChangeChannelByNumber { @@ -19861,37 +17959,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMajorNumber), majorNumber)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMinorNumber), minorNumber)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMajorNumber)) + { + err = DataModel::Decode(reader, majorNumber); + } + else if (__context_tag == to_underlying(Fields::kMinorNumber)) + { + err = DataModel::Decode(reader, minorNumber); + } + else { - case to_underlying(Fields::kMajorNumber): - ReturnErrorOnFailure(DataModel::Decode(reader, majorNumber)); - break; - case to_underlying(Fields::kMinorNumber): - ReturnErrorOnFailure(DataModel::Decode(reader, minorNumber)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ChangeChannelByNumber. namespace SkipChannel { @@ -19900,34 +17998,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kCount), count)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kCount)) { - continue; + err = DataModel::Decode(reader, count); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kCount): - ReturnErrorOnFailure(DataModel::Decode(reader, count)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SkipChannel. } // namespace Commands @@ -19938,37 +18035,26 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::ChannelList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, channelList)); - break; + return DataModel::Decode(reader, channelList); case Attributes::Lineup::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lineup)); - break; + return DataModel::Decode(reader, lineup); case Attributes::CurrentChannel::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentChannel)); - break; + return DataModel::Decode(reader, currentChannel); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -19990,34 +18076,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIdentifier)) + { + err = DataModel::Decode(reader, identifier); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else { - case to_underlying(Fields::kIdentifier): - ReturnErrorOnFailure(DataModel::Decode(reader, identifier)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TargetInfoStruct @@ -20031,37 +18115,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTarget), target)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTarget)) { - continue; + err = DataModel::Decode(reader, target); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kTarget): - ReturnErrorOnFailure(DataModel::Decode(reader, target)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NavigateTarget. namespace NavigateTargetResponse { @@ -20071,37 +18155,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NavigateTargetResponse. } // namespace Commands @@ -20112,34 +18196,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::TargetList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, targetList)); - break; + return DataModel::Decode(reader, targetList); case Attributes::CurrentTarget::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentTarget)); - break; + return DataModel::Decode(reader, currentTarget); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -20161,34 +18235,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kUpdatedAt)) { - continue; + err = DataModel::Decode(reader, updatedAt); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kPosition)) + { + err = DataModel::Decode(reader, position); + } + else { - case to_underlying(Fields::kUpdatedAt): - ReturnErrorOnFailure(DataModel::Decode(reader, updatedAt)); - break; - case to_underlying(Fields::kPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, position)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace PlaybackPositionStruct @@ -20200,31 +18272,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Play. namespace Pause { @@ -20232,31 +18293,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Pause. namespace Stop { @@ -20264,31 +18314,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Stop. namespace StartOver { @@ -20296,31 +18335,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace StartOver. namespace Previous { @@ -20328,31 +18356,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Previous. namespace Next { @@ -20360,31 +18377,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Next. namespace Rewind { @@ -20392,31 +18398,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Rewind. namespace FastForward { @@ -20424,31 +18419,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace FastForward. namespace SkipForward { @@ -20458,34 +18442,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure( DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDeltaPositionMilliseconds), deltaPositionMilliseconds)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDeltaPositionMilliseconds)) + { + err = DataModel::Decode(reader, deltaPositionMilliseconds); + } + else { - case to_underlying(Fields::kDeltaPositionMilliseconds): - ReturnErrorOnFailure(DataModel::Decode(reader, deltaPositionMilliseconds)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SkipForward. namespace SkipBackward { @@ -20495,34 +18478,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure( DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDeltaPositionMilliseconds), deltaPositionMilliseconds)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kDeltaPositionMilliseconds)) + { + err = DataModel::Decode(reader, deltaPositionMilliseconds); + } + else { - case to_underlying(Fields::kDeltaPositionMilliseconds): - ReturnErrorOnFailure(DataModel::Decode(reader, deltaPositionMilliseconds)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SkipBackward. namespace PlaybackResponse { @@ -20532,37 +18514,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace PlaybackResponse. namespace Seek { @@ -20571,34 +18553,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPosition), position)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPosition)) + { + err = DataModel::Decode(reader, position); + } + else { - case to_underlying(Fields::kPosition): - ReturnErrorOnFailure(DataModel::Decode(reader, position)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Seek. } // namespace Commands @@ -20609,49 +18590,34 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::CurrentState::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentState)); - break; + return DataModel::Decode(reader, currentState); case Attributes::StartTime::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, startTime)); - break; + return DataModel::Decode(reader, startTime); case Attributes::Duration::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, duration)); - break; + return DataModel::Decode(reader, duration); case Attributes::SampledPosition::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, sampledPosition)); - break; + return DataModel::Decode(reader, sampledPosition); case Attributes::PlaybackSpeed::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, playbackSpeed)); - break; + return DataModel::Decode(reader, playbackSpeed); case Attributes::SeekRangeEnd::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, seekRangeEnd)); - break; + return DataModel::Decode(reader, seekRangeEnd); case Attributes::SeekRangeStart::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, seekRangeStart)); - break; + return DataModel::Decode(reader, seekRangeStart); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -20675,40 +18641,40 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIndex)) + { + err = DataModel::Decode(reader, index); + } + else if (__context_tag == to_underlying(Fields::kInputType)) + { + err = DataModel::Decode(reader, inputType); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kDescription)) + { + err = DataModel::Decode(reader, description); + } + else { - case to_underlying(Fields::kIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, index)); - break; - case to_underlying(Fields::kInputType): - ReturnErrorOnFailure(DataModel::Decode(reader, inputType)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kDescription): - ReturnErrorOnFailure(DataModel::Decode(reader, description)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace InputInfoStruct @@ -20721,34 +18687,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIndex), index)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIndex)) { - continue; + err = DataModel::Decode(reader, index); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, index)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SelectInput. namespace ShowInputStatus { @@ -20756,31 +18721,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace ShowInputStatus. namespace HideInputStatus { @@ -20788,31 +18742,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace HideInputStatus. namespace RenameInput { @@ -20822,37 +18765,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIndex), index)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kName), name)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIndex)) + { + err = DataModel::Decode(reader, index); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else { - case to_underlying(Fields::kIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, index)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RenameInput. } // namespace Commands @@ -20863,34 +18806,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::InputList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, inputList)); - break; + return DataModel::Decode(reader, inputList); case Attributes::CurrentInput::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentInput)); - break; + return DataModel::Decode(reader, currentInput); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -20905,31 +18838,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Sleep. } // namespace Commands @@ -20940,28 +18862,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -20977,34 +18891,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kKeyCode), keyCode)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kKeyCode)) + { + err = DataModel::Decode(reader, keyCode); + } + else { - case to_underlying(Fields::kKeyCode): - ReturnErrorOnFailure(DataModel::Decode(reader, keyCode)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SendKey. namespace SendKeyResponse { @@ -21013,34 +18926,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SendKeyResponse. } // namespace Commands @@ -21051,28 +18963,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -21095,37 +18999,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWidth)) { - continue; + err = DataModel::Decode(reader, width); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kHeight)) + { + err = DataModel::Decode(reader, height); + } + else if (__context_tag == to_underlying(Fields::kMetric)) + { + err = DataModel::Decode(reader, metric); + } + else { - case to_underlying(Fields::kWidth): - ReturnErrorOnFailure(DataModel::Decode(reader, width)); - break; - case to_underlying(Fields::kHeight): - ReturnErrorOnFailure(DataModel::Decode(reader, height)); - break; - case to_underlying(Fields::kMetric): - ReturnErrorOnFailure(DataModel::Decode(reader, metric)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DimensionStruct @@ -21142,34 +19045,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AdditionalInfoStruct @@ -21187,37 +19088,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kType)) + { + err = DataModel::Decode(reader, type); + } + else if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else if (__context_tag == to_underlying(Fields::kExternalIDList)) + { + err = DataModel::Decode(reader, externalIDList); + } + else { - case to_underlying(Fields::kType): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - case to_underlying(Fields::kExternalIDList): - ReturnErrorOnFailure(DataModel::Decode(reader, externalIDList)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ParameterStruct @@ -21233,31 +19133,28 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kParameterList)) { - continue; + err = DataModel::Decode(reader, parameterList); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kParameterList): - ReturnErrorOnFailure(DataModel::Decode(reader, parameterList)); - break; - default: - break; } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ContentSearchStruct @@ -21275,37 +19172,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kImageURL)) + { + err = DataModel::Decode(reader, imageURL); + } + else if (__context_tag == to_underlying(Fields::kColor)) + { + err = DataModel::Decode(reader, color); + } + else if (__context_tag == to_underlying(Fields::kSize)) + { + err = DataModel::Decode(reader, size); + } + else { - case to_underlying(Fields::kImageURL): - ReturnErrorOnFailure(DataModel::Decode(reader, imageURL)); - break; - case to_underlying(Fields::kColor): - ReturnErrorOnFailure(DataModel::Decode(reader, color)); - break; - case to_underlying(Fields::kSize): - ReturnErrorOnFailure(DataModel::Decode(reader, size)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StyleInformationStruct @@ -21326,46 +19222,48 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kProviderName)) { - continue; + err = DataModel::Decode(reader, providerName); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kBackground)) + { + err = DataModel::Decode(reader, background); + } + else if (__context_tag == to_underlying(Fields::kLogo)) + { + err = DataModel::Decode(reader, logo); + } + else if (__context_tag == to_underlying(Fields::kProgressBar)) + { + err = DataModel::Decode(reader, progressBar); + } + else if (__context_tag == to_underlying(Fields::kSplash)) + { + err = DataModel::Decode(reader, splash); + } + else if (__context_tag == to_underlying(Fields::kWaterMark)) + { + err = DataModel::Decode(reader, waterMark); + } + else { - case to_underlying(Fields::kProviderName): - ReturnErrorOnFailure(DataModel::Decode(reader, providerName)); - break; - case to_underlying(Fields::kBackground): - ReturnErrorOnFailure(DataModel::Decode(reader, background)); - break; - case to_underlying(Fields::kLogo): - ReturnErrorOnFailure(DataModel::Decode(reader, logo)); - break; - case to_underlying(Fields::kProgressBar): - ReturnErrorOnFailure(DataModel::Decode(reader, progressBar)); - break; - case to_underlying(Fields::kSplash): - ReturnErrorOnFailure(DataModel::Decode(reader, splash)); - break; - case to_underlying(Fields::kWaterMark): - ReturnErrorOnFailure(DataModel::Decode(reader, waterMark)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BrandingInformationStruct @@ -21380,40 +19278,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSearch), search)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAutoPlay), autoPlay)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSearch)) + { + err = DataModel::Decode(reader, search); + } + else if (__context_tag == to_underlying(Fields::kAutoPlay)) + { + err = DataModel::Decode(reader, autoPlay); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kSearch): - ReturnErrorOnFailure(DataModel::Decode(reader, search)); - break; - case to_underlying(Fields::kAutoPlay): - ReturnErrorOnFailure(DataModel::Decode(reader, autoPlay)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LaunchContent. namespace LaunchURL { @@ -21424,40 +19323,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kContentURL), contentURL)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kDisplayString), displayString)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kBrandingInformation), brandingInformation)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kContentURL)) + { + err = DataModel::Decode(reader, contentURL); + } + else if (__context_tag == to_underlying(Fields::kDisplayString)) + { + err = DataModel::Decode(reader, displayString); + } + else if (__context_tag == to_underlying(Fields::kBrandingInformation)) + { + err = DataModel::Decode(reader, brandingInformation); + } + else { - case to_underlying(Fields::kContentURL): - ReturnErrorOnFailure(DataModel::Decode(reader, contentURL)); - break; - case to_underlying(Fields::kDisplayString): - ReturnErrorOnFailure(DataModel::Decode(reader, displayString)); - break; - case to_underlying(Fields::kBrandingInformation): - ReturnErrorOnFailure(DataModel::Decode(reader, brandingInformation)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LaunchURL. namespace LauncherResponse { @@ -21467,37 +19367,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LauncherResponse. } // namespace Commands @@ -21508,34 +19408,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::AcceptHeader::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptHeader)); - break; + return DataModel::Decode(reader, acceptHeader); case Attributes::SupportedStreamingProtocols::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, supportedStreamingProtocols)); - break; + return DataModel::Decode(reader, supportedStreamingProtocols); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -21558,37 +19448,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIndex)) + { + err = DataModel::Decode(reader, index); + } + else if (__context_tag == to_underlying(Fields::kOutputType)) + { + err = DataModel::Decode(reader, outputType); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else { - case to_underlying(Fields::kIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, index)); - break; - case to_underlying(Fields::kOutputType): - ReturnErrorOnFailure(DataModel::Decode(reader, outputType)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace OutputInfoStruct @@ -21601,34 +19490,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIndex), index)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIndex)) + { + err = DataModel::Decode(reader, index); + } + else { - case to_underlying(Fields::kIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, index)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SelectOutput. namespace RenameOutput { @@ -21638,37 +19526,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIndex), index)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kName), name)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kIndex)) + { + err = DataModel::Decode(reader, index); + } + else if (__context_tag == to_underlying(Fields::kName)) + { + err = DataModel::Decode(reader, name); + } + else { - case to_underlying(Fields::kIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, index)); - break; - case to_underlying(Fields::kName): - ReturnErrorOnFailure(DataModel::Decode(reader, name)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace RenameOutput. } // namespace Commands @@ -21679,34 +19567,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::OutputList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, outputList)); - break; + return DataModel::Decode(reader, outputList); case Attributes::CurrentOutput::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentOutput)); - break; + return DataModel::Decode(reader, currentOutput); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -21728,34 +19606,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kApplication)) { - continue; + err = DataModel::Decode(reader, application); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else { - case to_underlying(Fields::kApplication): - ReturnErrorOnFailure(DataModel::Decode(reader, application)); - break; - case to_underlying(Fields::kEndpoint): - ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace ApplicationEPStruct @@ -21769,37 +19645,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kApplication), application)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kApplication)) + { + err = DataModel::Decode(reader, application); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kApplication): - ReturnErrorOnFailure(DataModel::Decode(reader, application)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LaunchApp. namespace StopApp { @@ -21808,34 +19684,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kApplication), application)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kApplication)) + { + err = DataModel::Decode(reader, application); + } + else { - case to_underlying(Fields::kApplication): - ReturnErrorOnFailure(DataModel::Decode(reader, application)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace StopApp. namespace HideApp { @@ -21844,34 +19719,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kApplication), application)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kApplication)) { - continue; + err = DataModel::Decode(reader, application); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kApplication): - ReturnErrorOnFailure(DataModel::Decode(reader, application)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace HideApp. namespace LauncherResponse { @@ -21881,37 +19755,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatus), status)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kData), data)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else { - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kData): - ReturnErrorOnFailure(DataModel::Decode(reader, data)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace LauncherResponse. } // namespace Commands @@ -21922,34 +19796,24 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::CatalogList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, catalogList)); - break; + return DataModel::Decode(reader, catalogList); case Attributes::CurrentApp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentApp)); - break; + return DataModel::Decode(reader, currentApp); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -21967,52 +19831,36 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::VendorName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorName)); - break; + return DataModel::Decode(reader, vendorName); case Attributes::VendorID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorID)); - break; + return DataModel::Decode(reader, vendorID); case Attributes::ApplicationName::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, applicationName)); - break; + return DataModel::Decode(reader, applicationName); case Attributes::ProductID::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, productID)); - break; + return DataModel::Decode(reader, productID); case Attributes::Application::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, application)); - break; + return DataModel::Decode(reader, application); case Attributes::Status::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; + return DataModel::Decode(reader, status); case Attributes::ApplicationVersion::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, applicationVersion)); - break; + return DataModel::Decode(reader, applicationVersion); case Attributes::AllowedVendorList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, allowedVendorList)); - break; + return DataModel::Decode(reader, allowedVendorList); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -22028,34 +19876,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTempAccountIdentifier), tempAccountIdentifier)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTempAccountIdentifier)) + { + err = DataModel::Decode(reader, tempAccountIdentifier); + } + else { - case to_underlying(Fields::kTempAccountIdentifier): - ReturnErrorOnFailure(DataModel::Decode(reader, tempAccountIdentifier)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetSetupPIN. namespace GetSetupPINResponse { @@ -22064,34 +19911,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSetupPIN), setupPIN)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kSetupPIN)) + { + err = DataModel::Decode(reader, setupPIN); + } + else { - case to_underlying(Fields::kSetupPIN): - ReturnErrorOnFailure(DataModel::Decode(reader, setupPIN)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetSetupPINResponse. namespace Login { @@ -22101,37 +19947,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTempAccountIdentifier), tempAccountIdentifier)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSetupPIN), setupPIN)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTempAccountIdentifier)) + { + err = DataModel::Decode(reader, tempAccountIdentifier); + } + else if (__context_tag == to_underlying(Fields::kSetupPIN)) + { + err = DataModel::Decode(reader, setupPIN); + } + else { - case to_underlying(Fields::kTempAccountIdentifier): - ReturnErrorOnFailure(DataModel::Decode(reader, tempAccountIdentifier)); - break; - case to_underlying(Fields::kSetupPIN): - ReturnErrorOnFailure(DataModel::Decode(reader, setupPIN)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace Login. namespace Logout { @@ -22139,31 +19985,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Logout. } // namespace Commands @@ -22174,28 +20009,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -22214,43 +20041,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kProfileIntervalPeriod), profileIntervalPeriod)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMaxNumberOfIntervals), maxNumberOfIntervals)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kListOfAttributes), listOfAttributes)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kProfileCount)) + { + err = DataModel::Decode(reader, profileCount); + } + else if (__context_tag == to_underlying(Fields::kProfileIntervalPeriod)) + { + err = DataModel::Decode(reader, profileIntervalPeriod); + } + else if (__context_tag == to_underlying(Fields::kMaxNumberOfIntervals)) + { + err = DataModel::Decode(reader, maxNumberOfIntervals); + } + else if (__context_tag == to_underlying(Fields::kListOfAttributes)) + { + err = DataModel::Decode(reader, listOfAttributes); + } + else { - case to_underlying(Fields::kProfileCount): - ReturnErrorOnFailure(DataModel::Decode(reader, profileCount)); - break; - case to_underlying(Fields::kProfileIntervalPeriod): - ReturnErrorOnFailure(DataModel::Decode(reader, profileIntervalPeriod)); - break; - case to_underlying(Fields::kMaxNumberOfIntervals): - ReturnErrorOnFailure(DataModel::Decode(reader, maxNumberOfIntervals)); - break; - case to_underlying(Fields::kListOfAttributes): - ReturnErrorOnFailure(DataModel::Decode(reader, listOfAttributes)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetProfileInfoResponseCommand. namespace GetProfileInfoCommand { @@ -22258,31 +20087,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace GetProfileInfoCommand. namespace GetMeasurementProfileResponseCommand { @@ -22297,49 +20115,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNumberOfIntervalsDelivered), numberOfIntervalsDelivered)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAttributeId), attributeId)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kIntervals), intervals)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kStartTime)) + { + err = DataModel::Decode(reader, startTime); + } + else if (__context_tag == to_underlying(Fields::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kProfileIntervalPeriod)) + { + err = DataModel::Decode(reader, profileIntervalPeriod); + } + else if (__context_tag == to_underlying(Fields::kNumberOfIntervalsDelivered)) + { + err = DataModel::Decode(reader, numberOfIntervalsDelivered); + } + else if (__context_tag == to_underlying(Fields::kAttributeId)) + { + err = DataModel::Decode(reader, attributeId); + } + else if (__context_tag == to_underlying(Fields::kIntervals)) + { + err = DataModel::Decode(reader, intervals); + } + else { - case to_underlying(Fields::kStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, startTime)); - break; - case to_underlying(Fields::kStatus): - ReturnErrorOnFailure(DataModel::Decode(reader, status)); - break; - case to_underlying(Fields::kProfileIntervalPeriod): - ReturnErrorOnFailure(DataModel::Decode(reader, profileIntervalPeriod)); - break; - case to_underlying(Fields::kNumberOfIntervalsDelivered): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfIntervalsDelivered)); - break; - case to_underlying(Fields::kAttributeId): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeId)); - break; - case to_underlying(Fields::kIntervals): - ReturnErrorOnFailure(DataModel::Decode(reader, intervals)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetMeasurementProfileResponseCommand. namespace GetMeasurementProfileCommand { @@ -22350,40 +20172,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kAttributeId), attributeId)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStartTime), startTime)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNumberOfIntervals), numberOfIntervals)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kAttributeId)) { - continue; + err = DataModel::Decode(reader, attributeId); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kStartTime)) + { + err = DataModel::Decode(reader, startTime); + } + else if (__context_tag == to_underlying(Fields::kNumberOfIntervals)) + { + err = DataModel::Decode(reader, numberOfIntervals); + } + else { - case to_underlying(Fields::kAttributeId): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeId)); - break; - case to_underlying(Fields::kStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, startTime)); - break; - case to_underlying(Fields::kNumberOfIntervals): - ReturnErrorOnFailure(DataModel::Decode(reader, numberOfIntervals)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace GetMeasurementProfileCommand. } // namespace Commands @@ -22394,412 +20217,276 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::MeasurementType::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measurementType)); - break; + return DataModel::Decode(reader, measurementType); case Attributes::DcVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcVoltage)); - break; + return DataModel::Decode(reader, dcVoltage); case Attributes::DcVoltageMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcVoltageMin)); - break; + return DataModel::Decode(reader, dcVoltageMin); case Attributes::DcVoltageMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcVoltageMax)); - break; + return DataModel::Decode(reader, dcVoltageMax); case Attributes::DcCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcCurrent)); - break; + return DataModel::Decode(reader, dcCurrent); case Attributes::DcCurrentMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcCurrentMin)); - break; + return DataModel::Decode(reader, dcCurrentMin); case Attributes::DcCurrentMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcCurrentMax)); - break; + return DataModel::Decode(reader, dcCurrentMax); case Attributes::DcPower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcPower)); - break; + return DataModel::Decode(reader, dcPower); case Attributes::DcPowerMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcPowerMin)); - break; + return DataModel::Decode(reader, dcPowerMin); case Attributes::DcPowerMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcPowerMax)); - break; + return DataModel::Decode(reader, dcPowerMax); case Attributes::DcVoltageMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcVoltageMultiplier)); - break; + return DataModel::Decode(reader, dcVoltageMultiplier); case Attributes::DcVoltageDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcVoltageDivisor)); - break; + return DataModel::Decode(reader, dcVoltageDivisor); case Attributes::DcCurrentMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcCurrentMultiplier)); - break; + return DataModel::Decode(reader, dcCurrentMultiplier); case Attributes::DcCurrentDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcCurrentDivisor)); - break; + return DataModel::Decode(reader, dcCurrentDivisor); case Attributes::DcPowerMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcPowerMultiplier)); - break; + return DataModel::Decode(reader, dcPowerMultiplier); case Attributes::DcPowerDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, dcPowerDivisor)); - break; + return DataModel::Decode(reader, dcPowerDivisor); case Attributes::AcFrequency::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acFrequency)); - break; + return DataModel::Decode(reader, acFrequency); case Attributes::AcFrequencyMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acFrequencyMin)); - break; + return DataModel::Decode(reader, acFrequencyMin); case Attributes::AcFrequencyMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acFrequencyMax)); - break; + return DataModel::Decode(reader, acFrequencyMax); case Attributes::NeutralCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, neutralCurrent)); - break; + return DataModel::Decode(reader, neutralCurrent); case Attributes::TotalActivePower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, totalActivePower)); - break; + return DataModel::Decode(reader, totalActivePower); case Attributes::TotalReactivePower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, totalReactivePower)); - break; + return DataModel::Decode(reader, totalReactivePower); case Attributes::TotalApparentPower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, totalApparentPower)); - break; + return DataModel::Decode(reader, totalApparentPower); case Attributes::Measured1stHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measured1stHarmonicCurrent)); - break; + return DataModel::Decode(reader, measured1stHarmonicCurrent); case Attributes::Measured3rdHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measured3rdHarmonicCurrent)); - break; + return DataModel::Decode(reader, measured3rdHarmonicCurrent); case Attributes::Measured5thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measured5thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measured5thHarmonicCurrent); case Attributes::Measured7thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measured7thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measured7thHarmonicCurrent); case Attributes::Measured9thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measured9thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measured9thHarmonicCurrent); case Attributes::Measured11thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measured11thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measured11thHarmonicCurrent); case Attributes::MeasuredPhase1stHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredPhase1stHarmonicCurrent)); - break; + return DataModel::Decode(reader, measuredPhase1stHarmonicCurrent); case Attributes::MeasuredPhase3rdHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredPhase3rdHarmonicCurrent)); - break; + return DataModel::Decode(reader, measuredPhase3rdHarmonicCurrent); case Attributes::MeasuredPhase5thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredPhase5thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measuredPhase5thHarmonicCurrent); case Attributes::MeasuredPhase7thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredPhase7thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measuredPhase7thHarmonicCurrent); case Attributes::MeasuredPhase9thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredPhase9thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measuredPhase9thHarmonicCurrent); case Attributes::MeasuredPhase11thHarmonicCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, measuredPhase11thHarmonicCurrent)); - break; + return DataModel::Decode(reader, measuredPhase11thHarmonicCurrent); case Attributes::AcFrequencyMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acFrequencyMultiplier)); - break; + return DataModel::Decode(reader, acFrequencyMultiplier); case Attributes::AcFrequencyDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acFrequencyDivisor)); - break; + return DataModel::Decode(reader, acFrequencyDivisor); case Attributes::PowerMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, powerMultiplier)); - break; + return DataModel::Decode(reader, powerMultiplier); case Attributes::PowerDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, powerDivisor)); - break; + return DataModel::Decode(reader, powerDivisor); case Attributes::HarmonicCurrentMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, harmonicCurrentMultiplier)); - break; + return DataModel::Decode(reader, harmonicCurrentMultiplier); case Attributes::PhaseHarmonicCurrentMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, phaseHarmonicCurrentMultiplier)); - break; + return DataModel::Decode(reader, phaseHarmonicCurrentMultiplier); case Attributes::InstantaneousVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, instantaneousVoltage)); - break; + return DataModel::Decode(reader, instantaneousVoltage); case Attributes::InstantaneousLineCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, instantaneousLineCurrent)); - break; + return DataModel::Decode(reader, instantaneousLineCurrent); case Attributes::InstantaneousActiveCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, instantaneousActiveCurrent)); - break; + return DataModel::Decode(reader, instantaneousActiveCurrent); case Attributes::InstantaneousReactiveCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, instantaneousReactiveCurrent)); - break; + return DataModel::Decode(reader, instantaneousReactiveCurrent); case Attributes::InstantaneousPower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, instantaneousPower)); - break; + return DataModel::Decode(reader, instantaneousPower); case Attributes::RmsVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltage)); - break; + return DataModel::Decode(reader, rmsVoltage); case Attributes::RmsVoltageMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageMin)); - break; + return DataModel::Decode(reader, rmsVoltageMin); case Attributes::RmsVoltageMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageMax)); - break; + return DataModel::Decode(reader, rmsVoltageMax); case Attributes::RmsCurrent::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrent)); - break; + return DataModel::Decode(reader, rmsCurrent); case Attributes::RmsCurrentMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentMin)); - break; + return DataModel::Decode(reader, rmsCurrentMin); case Attributes::RmsCurrentMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentMax)); - break; + return DataModel::Decode(reader, rmsCurrentMax); case Attributes::ActivePower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePower)); - break; + return DataModel::Decode(reader, activePower); case Attributes::ActivePowerMin::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerMin)); - break; + return DataModel::Decode(reader, activePowerMin); case Attributes::ActivePowerMax::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerMax)); - break; + return DataModel::Decode(reader, activePowerMax); case Attributes::ReactivePower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reactivePower)); - break; + return DataModel::Decode(reader, reactivePower); case Attributes::ApparentPower::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, apparentPower)); - break; + return DataModel::Decode(reader, apparentPower); case Attributes::PowerFactor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, powerFactor)); - break; + return DataModel::Decode(reader, powerFactor); case Attributes::AverageRmsVoltageMeasurementPeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsVoltageMeasurementPeriod)); - break; + return DataModel::Decode(reader, averageRmsVoltageMeasurementPeriod); case Attributes::AverageRmsUnderVoltageCounter::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsUnderVoltageCounter)); - break; + return DataModel::Decode(reader, averageRmsUnderVoltageCounter); case Attributes::RmsExtremeOverVoltagePeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeOverVoltagePeriod)); - break; + return DataModel::Decode(reader, rmsExtremeOverVoltagePeriod); case Attributes::RmsExtremeUnderVoltagePeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeUnderVoltagePeriod)); - break; + return DataModel::Decode(reader, rmsExtremeUnderVoltagePeriod); case Attributes::RmsVoltageSagPeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSagPeriod)); - break; + return DataModel::Decode(reader, rmsVoltageSagPeriod); case Attributes::RmsVoltageSwellPeriod::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSwellPeriod)); - break; + return DataModel::Decode(reader, rmsVoltageSwellPeriod); case Attributes::AcVoltageMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acVoltageMultiplier)); - break; + return DataModel::Decode(reader, acVoltageMultiplier); case Attributes::AcVoltageDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acVoltageDivisor)); - break; + return DataModel::Decode(reader, acVoltageDivisor); case Attributes::AcCurrentMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acCurrentMultiplier)); - break; + return DataModel::Decode(reader, acCurrentMultiplier); case Attributes::AcCurrentDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acCurrentDivisor)); - break; + return DataModel::Decode(reader, acCurrentDivisor); case Attributes::AcPowerMultiplier::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acPowerMultiplier)); - break; + return DataModel::Decode(reader, acPowerMultiplier); case Attributes::AcPowerDivisor::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acPowerDivisor)); - break; + return DataModel::Decode(reader, acPowerDivisor); case Attributes::OverloadAlarmsMask::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, overloadAlarmsMask)); - break; + return DataModel::Decode(reader, overloadAlarmsMask); case Attributes::VoltageOverload::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, voltageOverload)); - break; + return DataModel::Decode(reader, voltageOverload); case Attributes::CurrentOverload::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentOverload)); - break; + return DataModel::Decode(reader, currentOverload); case Attributes::AcOverloadAlarmsMask::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acOverloadAlarmsMask)); - break; + return DataModel::Decode(reader, acOverloadAlarmsMask); case Attributes::AcVoltageOverload::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acVoltageOverload)); - break; + return DataModel::Decode(reader, acVoltageOverload); case Attributes::AcCurrentOverload::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acCurrentOverload)); - break; + return DataModel::Decode(reader, acCurrentOverload); case Attributes::AcActivePowerOverload::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acActivePowerOverload)); - break; + return DataModel::Decode(reader, acActivePowerOverload); case Attributes::AcReactivePowerOverload::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acReactivePowerOverload)); - break; + return DataModel::Decode(reader, acReactivePowerOverload); case Attributes::AverageRmsOverVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsOverVoltage)); - break; + return DataModel::Decode(reader, averageRmsOverVoltage); case Attributes::AverageRmsUnderVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsUnderVoltage)); - break; + return DataModel::Decode(reader, averageRmsUnderVoltage); case Attributes::RmsExtremeOverVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeOverVoltage)); - break; + return DataModel::Decode(reader, rmsExtremeOverVoltage); case Attributes::RmsExtremeUnderVoltage::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeUnderVoltage)); - break; + return DataModel::Decode(reader, rmsExtremeUnderVoltage); case Attributes::RmsVoltageSag::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSag)); - break; + return DataModel::Decode(reader, rmsVoltageSag); case Attributes::RmsVoltageSwell::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSwell)); - break; + return DataModel::Decode(reader, rmsVoltageSwell); case Attributes::LineCurrentPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lineCurrentPhaseB)); - break; + return DataModel::Decode(reader, lineCurrentPhaseB); case Attributes::ActiveCurrentPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeCurrentPhaseB)); - break; + return DataModel::Decode(reader, activeCurrentPhaseB); case Attributes::ReactiveCurrentPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reactiveCurrentPhaseB)); - break; + return DataModel::Decode(reader, reactiveCurrentPhaseB); case Attributes::RmsVoltagePhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltagePhaseB)); - break; + return DataModel::Decode(reader, rmsVoltagePhaseB); case Attributes::RmsVoltageMinPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageMinPhaseB)); - break; + return DataModel::Decode(reader, rmsVoltageMinPhaseB); case Attributes::RmsVoltageMaxPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageMaxPhaseB)); - break; + return DataModel::Decode(reader, rmsVoltageMaxPhaseB); case Attributes::RmsCurrentPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentPhaseB)); - break; + return DataModel::Decode(reader, rmsCurrentPhaseB); case Attributes::RmsCurrentMinPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentMinPhaseB)); - break; + return DataModel::Decode(reader, rmsCurrentMinPhaseB); case Attributes::RmsCurrentMaxPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentMaxPhaseB)); - break; + return DataModel::Decode(reader, rmsCurrentMaxPhaseB); case Attributes::ActivePowerPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerPhaseB)); - break; + return DataModel::Decode(reader, activePowerPhaseB); case Attributes::ActivePowerMinPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerMinPhaseB)); - break; + return DataModel::Decode(reader, activePowerMinPhaseB); case Attributes::ActivePowerMaxPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerMaxPhaseB)); - break; + return DataModel::Decode(reader, activePowerMaxPhaseB); case Attributes::ReactivePowerPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reactivePowerPhaseB)); - break; + return DataModel::Decode(reader, reactivePowerPhaseB); case Attributes::ApparentPowerPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, apparentPowerPhaseB)); - break; + return DataModel::Decode(reader, apparentPowerPhaseB); case Attributes::PowerFactorPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, powerFactorPhaseB)); - break; + return DataModel::Decode(reader, powerFactorPhaseB); case Attributes::AverageRmsVoltageMeasurementPeriodPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsVoltageMeasurementPeriodPhaseB)); - break; + return DataModel::Decode(reader, averageRmsVoltageMeasurementPeriodPhaseB); case Attributes::AverageRmsOverVoltageCounterPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsOverVoltageCounterPhaseB)); - break; + return DataModel::Decode(reader, averageRmsOverVoltageCounterPhaseB); case Attributes::AverageRmsUnderVoltageCounterPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsUnderVoltageCounterPhaseB)); - break; + return DataModel::Decode(reader, averageRmsUnderVoltageCounterPhaseB); case Attributes::RmsExtremeOverVoltagePeriodPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeOverVoltagePeriodPhaseB)); - break; + return DataModel::Decode(reader, rmsExtremeOverVoltagePeriodPhaseB); case Attributes::RmsExtremeUnderVoltagePeriodPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeUnderVoltagePeriodPhaseB)); - break; + return DataModel::Decode(reader, rmsExtremeUnderVoltagePeriodPhaseB); case Attributes::RmsVoltageSagPeriodPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSagPeriodPhaseB)); - break; + return DataModel::Decode(reader, rmsVoltageSagPeriodPhaseB); case Attributes::RmsVoltageSwellPeriodPhaseB::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSwellPeriodPhaseB)); - break; + return DataModel::Decode(reader, rmsVoltageSwellPeriodPhaseB); case Attributes::LineCurrentPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, lineCurrentPhaseC)); - break; + return DataModel::Decode(reader, lineCurrentPhaseC); case Attributes::ActiveCurrentPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activeCurrentPhaseC)); - break; + return DataModel::Decode(reader, activeCurrentPhaseC); case Attributes::ReactiveCurrentPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reactiveCurrentPhaseC)); - break; + return DataModel::Decode(reader, reactiveCurrentPhaseC); case Attributes::RmsVoltagePhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltagePhaseC)); - break; + return DataModel::Decode(reader, rmsVoltagePhaseC); case Attributes::RmsVoltageMinPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageMinPhaseC)); - break; + return DataModel::Decode(reader, rmsVoltageMinPhaseC); case Attributes::RmsVoltageMaxPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageMaxPhaseC)); - break; + return DataModel::Decode(reader, rmsVoltageMaxPhaseC); case Attributes::RmsCurrentPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentPhaseC)); - break; + return DataModel::Decode(reader, rmsCurrentPhaseC); case Attributes::RmsCurrentMinPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentMinPhaseC)); - break; + return DataModel::Decode(reader, rmsCurrentMinPhaseC); case Attributes::RmsCurrentMaxPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsCurrentMaxPhaseC)); - break; + return DataModel::Decode(reader, rmsCurrentMaxPhaseC); case Attributes::ActivePowerPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerPhaseC)); - break; + return DataModel::Decode(reader, activePowerPhaseC); case Attributes::ActivePowerMinPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerMinPhaseC)); - break; + return DataModel::Decode(reader, activePowerMinPhaseC); case Attributes::ActivePowerMaxPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, activePowerMaxPhaseC)); - break; + return DataModel::Decode(reader, activePowerMaxPhaseC); case Attributes::ReactivePowerPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, reactivePowerPhaseC)); - break; + return DataModel::Decode(reader, reactivePowerPhaseC); case Attributes::ApparentPowerPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, apparentPowerPhaseC)); - break; + return DataModel::Decode(reader, apparentPowerPhaseC); case Attributes::PowerFactorPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, powerFactorPhaseC)); - break; + return DataModel::Decode(reader, powerFactorPhaseC); case Attributes::AverageRmsVoltageMeasurementPeriodPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsVoltageMeasurementPeriodPhaseC)); - break; + return DataModel::Decode(reader, averageRmsVoltageMeasurementPeriodPhaseC); case Attributes::AverageRmsOverVoltageCounterPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsOverVoltageCounterPhaseC)); - break; + return DataModel::Decode(reader, averageRmsOverVoltageCounterPhaseC); case Attributes::AverageRmsUnderVoltageCounterPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, averageRmsUnderVoltageCounterPhaseC)); - break; + return DataModel::Decode(reader, averageRmsUnderVoltageCounterPhaseC); case Attributes::RmsExtremeOverVoltagePeriodPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeOverVoltagePeriodPhaseC)); - break; + return DataModel::Decode(reader, rmsExtremeOverVoltagePeriodPhaseC); case Attributes::RmsExtremeUnderVoltagePeriodPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsExtremeUnderVoltagePeriodPhaseC)); - break; + return DataModel::Decode(reader, rmsExtremeUnderVoltagePeriodPhaseC); case Attributes::RmsVoltageSagPeriodPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSagPeriodPhaseC)); - break; + return DataModel::Decode(reader, rmsVoltageSagPeriodPhaseC); case Attributes::RmsVoltageSwellPeriodPhaseC::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rmsVoltageSwellPeriodPhaseC)); - break; + return DataModel::Decode(reader, rmsVoltageSwellPeriodPhaseC); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -22827,52 +20514,56 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kA): - ReturnErrorOnFailure(DataModel::Decode(reader, a)); - break; - case to_underlying(Fields::kB): - ReturnErrorOnFailure(DataModel::Decode(reader, b)); - break; - case to_underlying(Fields::kC): - ReturnErrorOnFailure(DataModel::Decode(reader, c)); - break; - case to_underlying(Fields::kD): - ReturnErrorOnFailure(DataModel::Decode(reader, d)); - break; - case to_underlying(Fields::kE): - ReturnErrorOnFailure(DataModel::Decode(reader, e)); - break; - case to_underlying(Fields::kF): - ReturnErrorOnFailure(DataModel::Decode(reader, f)); - break; - case to_underlying(Fields::kG): - ReturnErrorOnFailure(DataModel::Decode(reader, g)); - break; - case to_underlying(Fields::kH): - ReturnErrorOnFailure(DataModel::Decode(reader, h)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kA)) + { + err = DataModel::Decode(reader, a); + } + else if (__context_tag == to_underlying(Fields::kB)) + { + err = DataModel::Decode(reader, b); + } + else if (__context_tag == to_underlying(Fields::kC)) + { + err = DataModel::Decode(reader, c); + } + else if (__context_tag == to_underlying(Fields::kD)) + { + err = DataModel::Decode(reader, d); + } + else if (__context_tag == to_underlying(Fields::kE)) + { + err = DataModel::Decode(reader, e); + } + else if (__context_tag == to_underlying(Fields::kF)) + { + err = DataModel::Decode(reader, f); + } + else if (__context_tag == to_underlying(Fields::kG)) + { + err = DataModel::Decode(reader, g); + } + else if (__context_tag == to_underlying(Fields::kH)) + { + err = DataModel::Decode(reader, h); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace SimpleStruct @@ -22935,52 +20626,56 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kFabricSensitiveInt8u): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricSensitiveInt8u)); - break; - case to_underlying(Fields::kOptionalFabricSensitiveInt8u): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalFabricSensitiveInt8u)); - break; - case to_underlying(Fields::kNullableFabricSensitiveInt8u): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableFabricSensitiveInt8u)); - break; - case to_underlying(Fields::kNullableOptionalFabricSensitiveInt8u): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalFabricSensitiveInt8u)); - break; - case to_underlying(Fields::kFabricSensitiveCharString): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricSensitiveCharString)); - break; - case to_underlying(Fields::kFabricSensitiveStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricSensitiveStruct)); - break; - case to_underlying(Fields::kFabricSensitiveInt8uList): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricSensitiveInt8uList)); - break; - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kFabricSensitiveInt8u)) + { + err = DataModel::Decode(reader, fabricSensitiveInt8u); + } + else if (__context_tag == to_underlying(Fields::kOptionalFabricSensitiveInt8u)) + { + err = DataModel::Decode(reader, optionalFabricSensitiveInt8u); + } + else if (__context_tag == to_underlying(Fields::kNullableFabricSensitiveInt8u)) + { + err = DataModel::Decode(reader, nullableFabricSensitiveInt8u); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalFabricSensitiveInt8u)) + { + err = DataModel::Decode(reader, nullableOptionalFabricSensitiveInt8u); + } + else if (__context_tag == to_underlying(Fields::kFabricSensitiveCharString)) + { + err = DataModel::Decode(reader, fabricSensitiveCharString); + } + else if (__context_tag == to_underlying(Fields::kFabricSensitiveStruct)) + { + err = DataModel::Decode(reader, fabricSensitiveStruct); + } + else if (__context_tag == to_underlying(Fields::kFabricSensitiveInt8uList)) + { + err = DataModel::Decode(reader, fabricSensitiveInt8uList); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace TestFabricScoped @@ -23007,64 +20702,72 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kNullableInt): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt)); - break; - case to_underlying(Fields::kOptionalInt): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalInt)); - break; - case to_underlying(Fields::kNullableOptionalInt): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalInt)); - break; - case to_underlying(Fields::kNullableString): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableString)); - break; - case to_underlying(Fields::kOptionalString): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalString)); - break; - case to_underlying(Fields::kNullableOptionalString): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalString)); - break; - case to_underlying(Fields::kNullableStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStruct)); - break; - case to_underlying(Fields::kOptionalStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalStruct)); - break; - case to_underlying(Fields::kNullableOptionalStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStruct)); - break; - case to_underlying(Fields::kNullableList): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableList)); - break; - case to_underlying(Fields::kOptionalList): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalList)); - break; - case to_underlying(Fields::kNullableOptionalList): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalList)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); - return CHIP_NO_ERROR; + if (__context_tag == to_underlying(Fields::kNullableInt)) + { + err = DataModel::Decode(reader, nullableInt); + } + else if (__context_tag == to_underlying(Fields::kOptionalInt)) + { + err = DataModel::Decode(reader, optionalInt); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalInt)) + { + err = DataModel::Decode(reader, nullableOptionalInt); + } + else if (__context_tag == to_underlying(Fields::kNullableString)) + { + err = DataModel::Decode(reader, nullableString); + } + else if (__context_tag == to_underlying(Fields::kOptionalString)) + { + err = DataModel::Decode(reader, optionalString); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalString)) + { + err = DataModel::Decode(reader, nullableOptionalString); + } + else if (__context_tag == to_underlying(Fields::kNullableStruct)) + { + err = DataModel::Decode(reader, nullableStruct); + } + else if (__context_tag == to_underlying(Fields::kOptionalStruct)) + { + err = DataModel::Decode(reader, optionalStruct); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStruct)) + { + err = DataModel::Decode(reader, nullableOptionalStruct); + } + else if (__context_tag == to_underlying(Fields::kNullableList)) + { + err = DataModel::Decode(reader, nullableList); + } + else if (__context_tag == to_underlying(Fields::kOptionalList)) + { + err = DataModel::Decode(reader, optionalList); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalList)) + { + err = DataModel::Decode(reader, nullableOptionalList); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace NullablesAndOptionalsStruct @@ -23082,37 +20785,36 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kA)) { - continue; + err = DataModel::Decode(reader, a); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kB)) + { + err = DataModel::Decode(reader, b); + } + else if (__context_tag == to_underlying(Fields::kC)) + { + err = DataModel::Decode(reader, c); + } + else { - case to_underlying(Fields::kA): - ReturnErrorOnFailure(DataModel::Decode(reader, a)); - break; - case to_underlying(Fields::kB): - ReturnErrorOnFailure(DataModel::Decode(reader, b)); - break; - case to_underlying(Fields::kC): - ReturnErrorOnFailure(DataModel::Decode(reader, c)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NestedStruct @@ -23134,49 +20836,52 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kA)) { - continue; + err = DataModel::Decode(reader, a); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kB)) + { + err = DataModel::Decode(reader, b); + } + else if (__context_tag == to_underlying(Fields::kC)) + { + err = DataModel::Decode(reader, c); + } + else if (__context_tag == to_underlying(Fields::kD)) + { + err = DataModel::Decode(reader, d); + } + else if (__context_tag == to_underlying(Fields::kE)) + { + err = DataModel::Decode(reader, e); + } + else if (__context_tag == to_underlying(Fields::kF)) + { + err = DataModel::Decode(reader, f); + } + else if (__context_tag == to_underlying(Fields::kG)) + { + err = DataModel::Decode(reader, g); + } + else { - case to_underlying(Fields::kA): - ReturnErrorOnFailure(DataModel::Decode(reader, a)); - break; - case to_underlying(Fields::kB): - ReturnErrorOnFailure(DataModel::Decode(reader, b)); - break; - case to_underlying(Fields::kC): - ReturnErrorOnFailure(DataModel::Decode(reader, c)); - break; - case to_underlying(Fields::kD): - ReturnErrorOnFailure(DataModel::Decode(reader, d)); - break; - case to_underlying(Fields::kE): - ReturnErrorOnFailure(DataModel::Decode(reader, e)); - break; - case to_underlying(Fields::kF): - ReturnErrorOnFailure(DataModel::Decode(reader, f)); - break; - case to_underlying(Fields::kG): - ReturnErrorOnFailure(DataModel::Decode(reader, g)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace NestedStructList @@ -23192,31 +20897,28 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kA)) + { + err = DataModel::Decode(reader, a); + } + else { - case to_underlying(Fields::kA): - ReturnErrorOnFailure(DataModel::Decode(reader, a)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace DoubleNestedStructList @@ -23233,34 +20935,32 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - CHIP_ERROR err = CHIP_NO_ERROR; - TLV::TLVType outer; - VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); - err = reader.EnterContainer(outer); - ReturnErrorOnFailure(err); - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMember1)) + { + err = DataModel::Decode(reader, member1); + } + else if (__context_tag == to_underlying(Fields::kMember2)) + { + err = DataModel::Decode(reader, member2); + } + else { - case to_underlying(Fields::kMember1): - ReturnErrorOnFailure(DataModel::Decode(reader, member1)); - break; - case to_underlying(Fields::kMember2): - ReturnErrorOnFailure(DataModel::Decode(reader, member2)); - break; - default: - break; } - } - - VerifyOrReturnError(err == CHIP_END_OF_TLV, err); - ReturnErrorOnFailure(reader.ExitContainer(outer)); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestListStructOctet @@ -23272,31 +20972,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Test. namespace TestSpecificResponse { @@ -23305,34 +20994,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReturnValue), returnValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReturnValue)) + { + err = DataModel::Decode(reader, returnValue); + } + else { - case to_underlying(Fields::kReturnValue): - ReturnErrorOnFailure(DataModel::Decode(reader, returnValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestSpecificResponse. namespace TestNotHandled { @@ -23340,31 +21028,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace TestNotHandled. namespace TestAddArgumentsResponse { @@ -23373,34 +21050,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReturnValue), returnValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReturnValue)) { - continue; + err = DataModel::Decode(reader, returnValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kReturnValue): - ReturnErrorOnFailure(DataModel::Decode(reader, returnValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestAddArgumentsResponse. namespace TestSpecific { @@ -23408,31 +21084,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace TestSpecific. namespace TestSimpleArgumentResponse { @@ -23441,34 +21106,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReturnValue), returnValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReturnValue)) { - continue; + err = DataModel::Decode(reader, returnValue); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kReturnValue): - ReturnErrorOnFailure(DataModel::Decode(reader, returnValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestSimpleArgumentResponse. namespace TestUnknownCommand { @@ -23476,31 +21140,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace TestUnknownCommand. namespace TestStructArrayArgumentResponse { @@ -23514,49 +21167,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg4), arg4)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg5), arg5)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg6), arg6)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else if (__context_tag == to_underlying(Fields::kArg3)) + { + err = DataModel::Decode(reader, arg3); + } + else if (__context_tag == to_underlying(Fields::kArg4)) + { + err = DataModel::Decode(reader, arg4); + } + else if (__context_tag == to_underlying(Fields::kArg5)) + { + err = DataModel::Decode(reader, arg5); + } + else if (__context_tag == to_underlying(Fields::kArg6)) + { + err = DataModel::Decode(reader, arg6); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - case to_underlying(Fields::kArg3): - ReturnErrorOnFailure(DataModel::Decode(reader, arg3)); - break; - case to_underlying(Fields::kArg4): - ReturnErrorOnFailure(DataModel::Decode(reader, arg4)); - break; - case to_underlying(Fields::kArg5): - ReturnErrorOnFailure(DataModel::Decode(reader, arg5)); - break; - case to_underlying(Fields::kArg6): - ReturnErrorOnFailure(DataModel::Decode(reader, arg6)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestStructArrayArgumentResponse. namespace TestAddArguments { @@ -23566,37 +21223,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg2), arg2)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestAddArguments. namespace TestListInt8UReverseResponse { @@ -23605,34 +21262,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestListInt8UReverseResponse. namespace TestSimpleArgumentRequest { @@ -23641,34 +21297,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestSimpleArgumentRequest. namespace TestEnumsResponse { @@ -23678,37 +21333,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg2), arg2)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEnumsResponse. namespace TestStructArrayArgumentRequest { @@ -23722,49 +21377,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg4), arg4)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg5), arg5)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg6), arg6)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else if (__context_tag == to_underlying(Fields::kArg3)) + { + err = DataModel::Decode(reader, arg3); + } + else if (__context_tag == to_underlying(Fields::kArg4)) + { + err = DataModel::Decode(reader, arg4); + } + else if (__context_tag == to_underlying(Fields::kArg5)) + { + err = DataModel::Decode(reader, arg5); + } + else if (__context_tag == to_underlying(Fields::kArg6)) + { + err = DataModel::Decode(reader, arg6); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - case to_underlying(Fields::kArg3): - ReturnErrorOnFailure(DataModel::Decode(reader, arg3)); - break; - case to_underlying(Fields::kArg4): - ReturnErrorOnFailure(DataModel::Decode(reader, arg4)); - break; - case to_underlying(Fields::kArg5): - ReturnErrorOnFailure(DataModel::Decode(reader, arg5)); - break; - case to_underlying(Fields::kArg6): - ReturnErrorOnFailure(DataModel::Decode(reader, arg6)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestStructArrayArgumentRequest. namespace TestNullableOptionalResponse { @@ -23776,43 +21435,45 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kWasNull), wasNull)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kValue), value)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOriginalValue), originalValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kWasPresent)) + { + err = DataModel::Decode(reader, wasPresent); + } + else if (__context_tag == to_underlying(Fields::kWasNull)) + { + err = DataModel::Decode(reader, wasNull); + } + else if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else if (__context_tag == to_underlying(Fields::kOriginalValue)) + { + err = DataModel::Decode(reader, originalValue); + } + else { - case to_underlying(Fields::kWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, wasPresent)); - break; - case to_underlying(Fields::kWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, wasNull)); - break; - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - case to_underlying(Fields::kOriginalValue): - ReturnErrorOnFailure(DataModel::Decode(reader, originalValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestNullableOptionalResponse. namespace TestStructArgumentRequest { @@ -23821,34 +21482,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestStructArgumentRequest. namespace TestComplexNullableOptionalResponse { @@ -23895,115 +21555,141 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNullableOptionalListWasNull), nullableOptionalListWasNull)); ReturnErrorOnFailure( DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNullableOptionalListValue), nullableOptionalListValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kNullableIntWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableIntWasNull)); - break; - case to_underlying(Fields::kNullableIntValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableIntValue)); - break; - case to_underlying(Fields::kOptionalIntWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalIntWasPresent)); - break; - case to_underlying(Fields::kOptionalIntValue): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalIntValue)); - break; - case to_underlying(Fields::kNullableOptionalIntWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalIntWasPresent)); - break; - case to_underlying(Fields::kNullableOptionalIntWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalIntWasNull)); - break; - case to_underlying(Fields::kNullableOptionalIntValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalIntValue)); - break; - case to_underlying(Fields::kNullableStringWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStringWasNull)); - break; - case to_underlying(Fields::kNullableStringValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStringValue)); - break; - case to_underlying(Fields::kOptionalStringWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalStringWasPresent)); - break; - case to_underlying(Fields::kOptionalStringValue): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalStringValue)); - break; - case to_underlying(Fields::kNullableOptionalStringWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStringWasPresent)); - break; - case to_underlying(Fields::kNullableOptionalStringWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStringWasNull)); - break; - case to_underlying(Fields::kNullableOptionalStringValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStringValue)); - break; - case to_underlying(Fields::kNullableStructWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStructWasNull)); - break; - case to_underlying(Fields::kNullableStructValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStructValue)); - break; - case to_underlying(Fields::kOptionalStructWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalStructWasPresent)); - break; - case to_underlying(Fields::kOptionalStructValue): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalStructValue)); - break; - case to_underlying(Fields::kNullableOptionalStructWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStructWasPresent)); - break; - case to_underlying(Fields::kNullableOptionalStructWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStructWasNull)); - break; - case to_underlying(Fields::kNullableOptionalStructValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStructValue)); - break; - case to_underlying(Fields::kNullableListWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableListWasNull)); - break; - case to_underlying(Fields::kNullableListValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableListValue)); - break; - case to_underlying(Fields::kOptionalListWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalListWasPresent)); - break; - case to_underlying(Fields::kOptionalListValue): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalListValue)); - break; - case to_underlying(Fields::kNullableOptionalListWasPresent): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalListWasPresent)); - break; - case to_underlying(Fields::kNullableOptionalListWasNull): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalListWasNull)); - break; - case to_underlying(Fields::kNullableOptionalListValue): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalListValue)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNullableIntWasNull)) + { + err = DataModel::Decode(reader, nullableIntWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableIntValue)) + { + err = DataModel::Decode(reader, nullableIntValue); + } + else if (__context_tag == to_underlying(Fields::kOptionalIntWasPresent)) + { + err = DataModel::Decode(reader, optionalIntWasPresent); + } + else if (__context_tag == to_underlying(Fields::kOptionalIntValue)) + { + err = DataModel::Decode(reader, optionalIntValue); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalIntWasPresent)) + { + err = DataModel::Decode(reader, nullableOptionalIntWasPresent); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalIntWasNull)) + { + err = DataModel::Decode(reader, nullableOptionalIntWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalIntValue)) + { + err = DataModel::Decode(reader, nullableOptionalIntValue); + } + else if (__context_tag == to_underlying(Fields::kNullableStringWasNull)) + { + err = DataModel::Decode(reader, nullableStringWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableStringValue)) + { + err = DataModel::Decode(reader, nullableStringValue); + } + else if (__context_tag == to_underlying(Fields::kOptionalStringWasPresent)) + { + err = DataModel::Decode(reader, optionalStringWasPresent); + } + else if (__context_tag == to_underlying(Fields::kOptionalStringValue)) + { + err = DataModel::Decode(reader, optionalStringValue); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStringWasPresent)) + { + err = DataModel::Decode(reader, nullableOptionalStringWasPresent); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStringWasNull)) + { + err = DataModel::Decode(reader, nullableOptionalStringWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStringValue)) + { + err = DataModel::Decode(reader, nullableOptionalStringValue); + } + else if (__context_tag == to_underlying(Fields::kNullableStructWasNull)) + { + err = DataModel::Decode(reader, nullableStructWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableStructValue)) + { + err = DataModel::Decode(reader, nullableStructValue); + } + else if (__context_tag == to_underlying(Fields::kOptionalStructWasPresent)) + { + err = DataModel::Decode(reader, optionalStructWasPresent); + } + else if (__context_tag == to_underlying(Fields::kOptionalStructValue)) + { + err = DataModel::Decode(reader, optionalStructValue); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStructWasPresent)) + { + err = DataModel::Decode(reader, nullableOptionalStructWasPresent); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStructWasNull)) + { + err = DataModel::Decode(reader, nullableOptionalStructWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStructValue)) + { + err = DataModel::Decode(reader, nullableOptionalStructValue); + } + else if (__context_tag == to_underlying(Fields::kNullableListWasNull)) + { + err = DataModel::Decode(reader, nullableListWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableListValue)) + { + err = DataModel::Decode(reader, nullableListValue); + } + else if (__context_tag == to_underlying(Fields::kOptionalListWasPresent)) + { + err = DataModel::Decode(reader, optionalListWasPresent); + } + else if (__context_tag == to_underlying(Fields::kOptionalListValue)) + { + err = DataModel::Decode(reader, optionalListValue); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalListWasPresent)) + { + err = DataModel::Decode(reader, nullableOptionalListWasPresent); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalListWasNull)) + { + err = DataModel::Decode(reader, nullableOptionalListWasNull); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalListValue)) + { + err = DataModel::Decode(reader, nullableOptionalListValue); + } + else + { } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestComplexNullableOptionalResponse. namespace TestNestedStructArgumentRequest { @@ -24012,34 +21698,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestNestedStructArgumentRequest. namespace BooleanResponse { @@ -24048,34 +21733,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kValue), value)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace BooleanResponse. namespace TestListStructArgumentRequest { @@ -24084,34 +21768,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestListStructArgumentRequest. namespace SimpleStructResponse { @@ -24120,34 +21803,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SimpleStructResponse. namespace TestListInt8UArgumentRequest { @@ -24156,34 +21838,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestListInt8UArgumentRequest. namespace TestEmitTestEventResponse { @@ -24192,34 +21873,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kValue), value)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEmitTestEventResponse. namespace TestNestedStructListArgumentRequest { @@ -24228,34 +21908,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestNestedStructListArgumentRequest. namespace TestEmitTestFabricScopedEventResponse { @@ -24264,34 +21943,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kValue), value)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kValue)) + { + err = DataModel::Decode(reader, value); + } + else { - case to_underlying(Fields::kValue): - ReturnErrorOnFailure(DataModel::Decode(reader, value)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEmitTestFabricScopedEventResponse. namespace TestListNestedStructListArgumentRequest { @@ -24300,34 +21978,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestListNestedStructListArgumentRequest. namespace TestListInt8UReverseRequest { @@ -24336,34 +22013,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestListInt8UReverseRequest. namespace TestEnumsRequest { @@ -24373,37 +22049,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg2), arg2)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEnumsRequest. namespace TestNullableOptionalRequest { @@ -24412,34 +22088,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestNullableOptionalRequest. namespace TestComplexNullableOptionalRequest { @@ -24459,67 +22134,77 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNullableList), nullableList)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kOptionalList), optionalList)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNullableOptionalList), nullableOptionalList)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) - { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) - { - case to_underlying(Fields::kNullableInt): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt)); - break; - case to_underlying(Fields::kOptionalInt): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalInt)); - break; - case to_underlying(Fields::kNullableOptionalInt): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalInt)); - break; - case to_underlying(Fields::kNullableString): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableString)); - break; - case to_underlying(Fields::kOptionalString): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalString)); - break; - case to_underlying(Fields::kNullableOptionalString): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalString)); - break; - case to_underlying(Fields::kNullableStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStruct)); - break; - case to_underlying(Fields::kOptionalStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalStruct)); - break; - case to_underlying(Fields::kNullableOptionalStruct): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalStruct)); - break; - case to_underlying(Fields::kNullableList): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableList)); - break; - case to_underlying(Fields::kOptionalList): - ReturnErrorOnFailure(DataModel::Decode(reader, optionalList)); - break; - case to_underlying(Fields::kNullableOptionalList): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOptionalList)); - break; - default: - break; + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kNullableInt)) + { + err = DataModel::Decode(reader, nullableInt); + } + else if (__context_tag == to_underlying(Fields::kOptionalInt)) + { + err = DataModel::Decode(reader, optionalInt); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalInt)) + { + err = DataModel::Decode(reader, nullableOptionalInt); + } + else if (__context_tag == to_underlying(Fields::kNullableString)) + { + err = DataModel::Decode(reader, nullableString); + } + else if (__context_tag == to_underlying(Fields::kOptionalString)) + { + err = DataModel::Decode(reader, optionalString); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalString)) + { + err = DataModel::Decode(reader, nullableOptionalString); + } + else if (__context_tag == to_underlying(Fields::kNullableStruct)) + { + err = DataModel::Decode(reader, nullableStruct); + } + else if (__context_tag == to_underlying(Fields::kOptionalStruct)) + { + err = DataModel::Decode(reader, optionalStruct); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalStruct)) + { + err = DataModel::Decode(reader, nullableOptionalStruct); + } + else if (__context_tag == to_underlying(Fields::kNullableList)) + { + err = DataModel::Decode(reader, nullableList); + } + else if (__context_tag == to_underlying(Fields::kOptionalList)) + { + err = DataModel::Decode(reader, optionalList); + } + else if (__context_tag == to_underlying(Fields::kNullableOptionalList)) + { + err = DataModel::Decode(reader, nullableOptionalList); + } + else + { + } + + ReturnErrorOnFailure(err); + } } } // namespace TestComplexNullableOptionalRequest. namespace SimpleStructEchoRequest { @@ -24528,34 +22213,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) { - continue; + err = DataModel::Decode(reader, arg1); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace SimpleStructEchoRequest. namespace TimedInvokeRequest { @@ -24563,31 +22247,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } - } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + } } } // namespace TimedInvokeRequest. namespace TestSimpleOptionalArgumentRequest { @@ -24596,34 +22269,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestSimpleOptionalArgumentRequest. namespace TestEmitTestEventRequest { @@ -24634,40 +22306,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg2), arg2)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg3), arg3)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else if (__context_tag == to_underlying(Fields::kArg3)) + { + err = DataModel::Decode(reader, arg3); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - case to_underlying(Fields::kArg3): - ReturnErrorOnFailure(DataModel::Decode(reader, arg3)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEmitTestEventRequest. namespace TestEmitTestFabricScopedEventRequest { @@ -24676,34 +22349,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEmitTestFabricScopedEventRequest. } // namespace Commands @@ -24714,274 +22386,184 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::Boolean::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, boolean)); - break; + return DataModel::Decode(reader, boolean); case Attributes::Bitmap8::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, bitmap8)); - break; + return DataModel::Decode(reader, bitmap8); case Attributes::Bitmap16::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, bitmap16)); - break; + return DataModel::Decode(reader, bitmap16); case Attributes::Bitmap32::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, bitmap32)); - break; + return DataModel::Decode(reader, bitmap32); case Attributes::Bitmap64::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, bitmap64)); - break; + return DataModel::Decode(reader, bitmap64); case Attributes::Int8u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int8u)); - break; + return DataModel::Decode(reader, int8u); case Attributes::Int16u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int16u)); - break; + return DataModel::Decode(reader, int16u); case Attributes::Int24u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int24u)); - break; + return DataModel::Decode(reader, int24u); case Attributes::Int32u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int32u)); - break; + return DataModel::Decode(reader, int32u); case Attributes::Int40u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int40u)); - break; + return DataModel::Decode(reader, int40u); case Attributes::Int48u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int48u)); - break; + return DataModel::Decode(reader, int48u); case Attributes::Int56u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int56u)); - break; + return DataModel::Decode(reader, int56u); case Attributes::Int64u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int64u)); - break; + return DataModel::Decode(reader, int64u); case Attributes::Int8s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int8s)); - break; + return DataModel::Decode(reader, int8s); case Attributes::Int16s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int16s)); - break; + return DataModel::Decode(reader, int16s); case Attributes::Int24s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int24s)); - break; + return DataModel::Decode(reader, int24s); case Attributes::Int32s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int32s)); - break; + return DataModel::Decode(reader, int32s); case Attributes::Int40s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int40s)); - break; + return DataModel::Decode(reader, int40s); case Attributes::Int48s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int48s)); - break; + return DataModel::Decode(reader, int48s); case Attributes::Int56s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int56s)); - break; + return DataModel::Decode(reader, int56s); case Attributes::Int64s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, int64s)); - break; + return DataModel::Decode(reader, int64s); case Attributes::Enum8::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enum8)); - break; + return DataModel::Decode(reader, enum8); case Attributes::Enum16::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enum16)); - break; + return DataModel::Decode(reader, enum16); case Attributes::FloatSingle::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, floatSingle)); - break; + return DataModel::Decode(reader, floatSingle); case Attributes::FloatDouble::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, floatDouble)); - break; + return DataModel::Decode(reader, floatDouble); case Attributes::OctetString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, octetString)); - break; + return DataModel::Decode(reader, octetString); case Attributes::ListInt8u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, listInt8u)); - break; + return DataModel::Decode(reader, listInt8u); case Attributes::ListOctetString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, listOctetString)); - break; + return DataModel::Decode(reader, listOctetString); case Attributes::ListStructOctetString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, listStructOctetString)); - break; + return DataModel::Decode(reader, listStructOctetString); case Attributes::LongOctetString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, longOctetString)); - break; + return DataModel::Decode(reader, longOctetString); case Attributes::CharString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, charString)); - break; + return DataModel::Decode(reader, charString); case Attributes::LongCharString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, longCharString)); - break; + return DataModel::Decode(reader, longCharString); case Attributes::EpochUs::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, epochUs)); - break; + return DataModel::Decode(reader, epochUs); case Attributes::EpochS::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, epochS)); - break; + return DataModel::Decode(reader, epochS); case Attributes::VendorId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorId)); - break; + return DataModel::Decode(reader, vendorId); case Attributes::ListNullablesAndOptionalsStruct::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, listNullablesAndOptionalsStruct)); - break; + return DataModel::Decode(reader, listNullablesAndOptionalsStruct); case Attributes::EnumAttr::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, enumAttr)); - break; + return DataModel::Decode(reader, enumAttr); case Attributes::StructAttr::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, structAttr)); - break; + return DataModel::Decode(reader, structAttr); case Attributes::RangeRestrictedInt8u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rangeRestrictedInt8u)); - break; + return DataModel::Decode(reader, rangeRestrictedInt8u); case Attributes::RangeRestrictedInt8s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rangeRestrictedInt8s)); - break; + return DataModel::Decode(reader, rangeRestrictedInt8s); case Attributes::RangeRestrictedInt16u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rangeRestrictedInt16u)); - break; + return DataModel::Decode(reader, rangeRestrictedInt16u); case Attributes::RangeRestrictedInt16s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, rangeRestrictedInt16s)); - break; + return DataModel::Decode(reader, rangeRestrictedInt16s); case Attributes::ListLongOctetString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, listLongOctetString)); - break; + return DataModel::Decode(reader, listLongOctetString); case Attributes::ListFabricScoped::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, listFabricScoped)); - break; + return DataModel::Decode(reader, listFabricScoped); case Attributes::TimedWriteBoolean::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, timedWriteBoolean)); - break; + return DataModel::Decode(reader, timedWriteBoolean); case Attributes::GeneralErrorBoolean::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generalErrorBoolean)); - break; + return DataModel::Decode(reader, generalErrorBoolean); case Attributes::ClusterErrorBoolean::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterErrorBoolean)); - break; + return DataModel::Decode(reader, clusterErrorBoolean); case Attributes::Unsupported::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, unsupported)); - break; + return DataModel::Decode(reader, unsupported); case Attributes::NullableBoolean::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableBoolean)); - break; + return DataModel::Decode(reader, nullableBoolean); case Attributes::NullableBitmap8::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableBitmap8)); - break; + return DataModel::Decode(reader, nullableBitmap8); case Attributes::NullableBitmap16::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableBitmap16)); - break; + return DataModel::Decode(reader, nullableBitmap16); case Attributes::NullableBitmap32::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableBitmap32)); - break; + return DataModel::Decode(reader, nullableBitmap32); case Attributes::NullableBitmap64::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableBitmap64)); - break; + return DataModel::Decode(reader, nullableBitmap64); case Attributes::NullableInt8u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt8u)); - break; + return DataModel::Decode(reader, nullableInt8u); case Attributes::NullableInt16u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt16u)); - break; + return DataModel::Decode(reader, nullableInt16u); case Attributes::NullableInt24u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt24u)); - break; + return DataModel::Decode(reader, nullableInt24u); case Attributes::NullableInt32u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt32u)); - break; + return DataModel::Decode(reader, nullableInt32u); case Attributes::NullableInt40u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt40u)); - break; + return DataModel::Decode(reader, nullableInt40u); case Attributes::NullableInt48u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt48u)); - break; + return DataModel::Decode(reader, nullableInt48u); case Attributes::NullableInt56u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt56u)); - break; + return DataModel::Decode(reader, nullableInt56u); case Attributes::NullableInt64u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt64u)); - break; + return DataModel::Decode(reader, nullableInt64u); case Attributes::NullableInt8s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt8s)); - break; + return DataModel::Decode(reader, nullableInt8s); case Attributes::NullableInt16s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt16s)); - break; + return DataModel::Decode(reader, nullableInt16s); case Attributes::NullableInt24s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt24s)); - break; + return DataModel::Decode(reader, nullableInt24s); case Attributes::NullableInt32s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt32s)); - break; + return DataModel::Decode(reader, nullableInt32s); case Attributes::NullableInt40s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt40s)); - break; + return DataModel::Decode(reader, nullableInt40s); case Attributes::NullableInt48s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt48s)); - break; + return DataModel::Decode(reader, nullableInt48s); case Attributes::NullableInt56s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt56s)); - break; + return DataModel::Decode(reader, nullableInt56s); case Attributes::NullableInt64s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableInt64s)); - break; + return DataModel::Decode(reader, nullableInt64s); case Attributes::NullableEnum8::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableEnum8)); - break; + return DataModel::Decode(reader, nullableEnum8); case Attributes::NullableEnum16::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableEnum16)); - break; + return DataModel::Decode(reader, nullableEnum16); case Attributes::NullableFloatSingle::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableFloatSingle)); - break; + return DataModel::Decode(reader, nullableFloatSingle); case Attributes::NullableFloatDouble::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableFloatDouble)); - break; + return DataModel::Decode(reader, nullableFloatDouble); case Attributes::NullableOctetString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableOctetString)); - break; + return DataModel::Decode(reader, nullableOctetString); case Attributes::NullableCharString::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableCharString)); - break; + return DataModel::Decode(reader, nullableCharString); case Attributes::NullableEnumAttr::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableEnumAttr)); - break; + return DataModel::Decode(reader, nullableEnumAttr); case Attributes::NullableStruct::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableStruct)); - break; + return DataModel::Decode(reader, nullableStruct); case Attributes::NullableRangeRestrictedInt8u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableRangeRestrictedInt8u)); - break; + return DataModel::Decode(reader, nullableRangeRestrictedInt8u); case Attributes::NullableRangeRestrictedInt8s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableRangeRestrictedInt8s)); - break; + return DataModel::Decode(reader, nullableRangeRestrictedInt8s); case Attributes::NullableRangeRestrictedInt16u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableRangeRestrictedInt16u)); - break; + return DataModel::Decode(reader, nullableRangeRestrictedInt16u); case Attributes::NullableRangeRestrictedInt16s::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, nullableRangeRestrictedInt16s)); - break; + return DataModel::Decode(reader, nullableRangeRestrictedInt16s); case Attributes::WriteOnlyInt8u::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, writeOnlyInt8u)); - break; + return DataModel::Decode(reader, writeOnlyInt8u); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -24997,49 +22579,53 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg4), arg4)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg5), arg5)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg6), arg6)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else if (__context_tag == to_underlying(Fields::kArg3)) + { + err = DataModel::Decode(reader, arg3); + } + else if (__context_tag == to_underlying(Fields::kArg4)) + { + err = DataModel::Decode(reader, arg4); + } + else if (__context_tag == to_underlying(Fields::kArg5)) + { + err = DataModel::Decode(reader, arg5); + } + else if (__context_tag == to_underlying(Fields::kArg6)) + { + err = DataModel::Decode(reader, arg6); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - case to_underlying(Fields::kArg3): - ReturnErrorOnFailure(DataModel::Decode(reader, arg3)); - break; - case to_underlying(Fields::kArg4): - ReturnErrorOnFailure(DataModel::Decode(reader, arg4)); - break; - case to_underlying(Fields::kArg5): - ReturnErrorOnFailure(DataModel::Decode(reader, arg5)); - break; - case to_underlying(Fields::kArg6): - ReturnErrorOnFailure(DataModel::Decode(reader, arg6)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestEvent. namespace TestFabricScopedEvent { @@ -25048,34 +22634,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kFabricIndex)) { - continue; + err = DataModel::Decode(reader, fabricIndex); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else { - case to_underlying(Fields::kFabricIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace TestFabricScopedEvent. } // namespace Events @@ -25094,46 +22679,49 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNumCallsToSkip), numCallsToSkip)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kNumCallsToFail), numCallsToFail)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kTakeMutex), takeMutex)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kType)) { - continue; + err = DataModel::Decode(reader, type); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kId)) + { + err = DataModel::Decode(reader, id); + } + else if (__context_tag == to_underlying(Fields::kNumCallsToSkip)) + { + err = DataModel::Decode(reader, numCallsToSkip); + } + else if (__context_tag == to_underlying(Fields::kNumCallsToFail)) + { + err = DataModel::Decode(reader, numCallsToFail); + } + else if (__context_tag == to_underlying(Fields::kTakeMutex)) + { + err = DataModel::Decode(reader, takeMutex); + } + else { - case to_underlying(Fields::kType): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; - case to_underlying(Fields::kId): - ReturnErrorOnFailure(DataModel::Decode(reader, id)); - break; - case to_underlying(Fields::kNumCallsToSkip): - ReturnErrorOnFailure(DataModel::Decode(reader, numCallsToSkip)); - break; - case to_underlying(Fields::kNumCallsToFail): - ReturnErrorOnFailure(DataModel::Decode(reader, numCallsToFail)); - break; - case to_underlying(Fields::kTakeMutex): - ReturnErrorOnFailure(DataModel::Decode(reader, takeMutex)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace FailAtFault. namespace FailRandomlyAtFault { @@ -25144,40 +22732,41 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kType), type)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kId), id)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPercentage), percentage)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kType)) { - continue; + err = DataModel::Decode(reader, type); } - switch (TLV::TagNumFromTag(reader.GetTag())) + else if (__context_tag == to_underlying(Fields::kId)) + { + err = DataModel::Decode(reader, id); + } + else if (__context_tag == to_underlying(Fields::kPercentage)) + { + err = DataModel::Decode(reader, percentage); + } + else { - case to_underlying(Fields::kType): - ReturnErrorOnFailure(DataModel::Decode(reader, type)); - break; - case to_underlying(Fields::kId): - ReturnErrorOnFailure(DataModel::Decode(reader, id)); - break; - case to_underlying(Fields::kPercentage): - ReturnErrorOnFailure(DataModel::Decode(reader, percentage)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace FailRandomlyAtFault. } // namespace Commands @@ -25188,28 +22777,20 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes @@ -25224,31 +22805,20 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) - { - continue; - } - switch (TLV::TagNumFromTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - default: - break; + return std::get(__element); } } - - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; } } // namespace Ping. namespace AddArgumentsResponse { @@ -25257,34 +22827,33 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const TLV::TLVType outer; ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReturnValue), returnValue)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kReturnValue)) + { + err = DataModel::Decode(reader, returnValue); + } + else { - case to_underlying(Fields::kReturnValue): - ReturnErrorOnFailure(DataModel::Decode(reader, returnValue)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddArgumentsResponse. namespace AddArguments { @@ -25294,37 +22863,37 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg1), arg1)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kArg2), arg2)); - ReturnErrorOnFailure(aWriter.EndContainer(outer)); - return CHIP_NO_ERROR; + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { - TLV::TLVType outer; - ReturnErrorOnFailure(chip::app::Clusters::detail::FlightCheckDecodeAndEnterStruct(reader, outer)); - - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = reader.Next()) == CHIP_NO_ERROR) + detail::StructDecodeIterator __iterator(reader); + while (true) { - if (!TLV::IsContextTag(reader.GetTag())) + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) { - continue; + return std::get(__element); } - switch (TLV::TagNumFromTag(reader.GetTag())) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kArg1)) + { + err = DataModel::Decode(reader, arg1); + } + else if (__context_tag == to_underlying(Fields::kArg2)) + { + err = DataModel::Decode(reader, arg2); + } + else { - case to_underlying(Fields::kArg1): - ReturnErrorOnFailure(DataModel::Decode(reader, arg1)); - break; - case to_underlying(Fields::kArg2): - ReturnErrorOnFailure(DataModel::Decode(reader, arg2)); - break; - default: - break; } - } - chip::app::Clusters::detail::ExitStructAfterDecode(reader, outer); - return CHIP_NO_ERROR; + ReturnErrorOnFailure(err); + } } } // namespace AddArguments. } // namespace Commands @@ -25335,31 +22904,22 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre switch (path.mAttributeId) { case Attributes::FlipFlop::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, flipFlop)); - break; + return DataModel::Decode(reader, flipFlop); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); - break; + return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptedCommandList)); - break; + return DataModel::Decode(reader, acceptedCommandList); case Attributes::EventList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, eventList)); - break; + return DataModel::Decode(reader, eventList); case Attributes::AttributeList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); - break; + return DataModel::Decode(reader, attributeList); case Attributes::FeatureMap::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, featureMap)); - break; + return DataModel::Decode(reader, featureMap); case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, clusterRevision)); - break; + return DataModel::Decode(reader, clusterRevision); default: - break; + return CHIP_NO_ERROR; } - - return CHIP_NO_ERROR; } } // namespace Attributes