From 15460247489e99c949bb4378f9fc7035dd55d074 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 17 May 2023 15:39:47 -0400 Subject: [PATCH] Improve handling of single structs associated with many clusters. (#26495) Instead of having a single set of types under "namespace detail" plus namespace aliases, have actual distinct types in the distinct cluster namespaces, with a common super-class in the detail namespace to improve code sharing. This still leaves the fields enums as an alias of the detail bits, but people are unlikely to be dispatching to overloads on the type of that fields enum. --- .../templates/ComplexArgumentParser-src.zapt | 8 - .../templates/ComplexArgumentParser.zapt | 8 - .../logging/DataModelLogger-src.zapt | 8 - .../templates/logging/DataModelLogger.zapt | 8 - .../templates/app/cluster-objects.zapt | 19 +- .../zap-generated/cluster-objects.h | 52 ++++- .../cluster/ComplexArgumentParser.cpp | 182 ++++++++++++------ .../cluster/ComplexArgumentParser.h | 29 ++- .../cluster/logging/DataModelLogger.cpp | 151 ++++++++++----- .../cluster/logging/DataModelLogger.h | 18 +- 10 files changed, 321 insertions(+), 162 deletions(-) diff --git a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt index f9b0f4bef764c5..1726283f2ef9b7 100644 --- a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt +++ b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt @@ -2,16 +2,8 @@ #include -{{#zcl_structs}} -{{#if has_more_than_one_cluster}} -{{> struct_parser_impl namespace="detail"}} -{{/if}} -{{/zcl_structs}} - {{#zcl_clusters}} {{#zcl_structs}} -{{#unless has_more_than_one_cluster}} {{> struct_parser_impl namespace=(as_camel_cased ../name false)}} -{{/unless}} {{/zcl_structs}} {{/zcl_clusters}} diff --git a/examples/chip-tool/templates/ComplexArgumentParser.zapt b/examples/chip-tool/templates/ComplexArgumentParser.zapt index 7364b243188333..82f6ebfe152c57 100644 --- a/examples/chip-tool/templates/ComplexArgumentParser.zapt +++ b/examples/chip-tool/templates/ComplexArgumentParser.zapt @@ -5,16 +5,8 @@ #include #include -{{#zcl_structs}} -{{#if has_more_than_one_cluster}} -{{> struct_parser_decl namespace="detail"}} -{{/if}} -{{/zcl_structs}} - {{#zcl_clusters}} {{#zcl_structs}} -{{#unless has_more_than_one_cluster}} {{> struct_parser_decl namespace=(as_camel_cased ../name false)}} -{{/unless}} {{/zcl_structs}} {{/zcl_clusters}} diff --git a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt index 167021f49577d2..5a918bdd5f13cb 100644 --- a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt +++ b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt @@ -4,17 +4,9 @@ using namespace chip::app::Clusters; -{{#zcl_structs}} -{{#if has_more_than_one_cluster}} -{{> struct_logger_impl namespace="detail"}} -{{/if}} -{{/zcl_structs}} - {{#zcl_clusters}} {{#zcl_structs}} -{{#unless has_more_than_one_cluster}} {{> struct_logger_impl namespace=(as_camel_cased ../name false)}} -{{/unless}} {{/zcl_structs}} {{/zcl_clusters}} diff --git a/examples/chip-tool/templates/logging/DataModelLogger.zapt b/examples/chip-tool/templates/logging/DataModelLogger.zapt index befe9d4210ce07..1dec72eb32520d 100644 --- a/examples/chip-tool/templates/logging/DataModelLogger.zapt +++ b/examples/chip-tool/templates/logging/DataModelLogger.zapt @@ -3,17 +3,9 @@ #include #include -{{#zcl_structs}} -{{#if has_more_than_one_cluster}} -{{> struct_logger_decl namespace="detail"}} -{{/if}} -{{/zcl_structs}} - {{#zcl_clusters}} {{#zcl_structs}} -{{#unless has_more_than_one_cluster}} {{> struct_logger_decl namespace=(as_camel_cased ../name false)}} -{{/unless}} {{/zcl_structs}} {{/zcl_clusters}} diff --git a/src/app/zap-templates/templates/app/cluster-objects.zapt b/src/app/zap-templates/templates/app/cluster-objects.zapt index 0ed26f740fa34d..e8ffcc3b9bc2a7 100644 --- a/src/app/zap-templates/templates/app/cluster-objects.zapt +++ b/src/app/zap-templates/templates/app/cluster-objects.zapt @@ -54,7 +54,24 @@ namespace {{asUpperCamelCase name}} { namespace Structs { {{/first}} {{#if has_more_than_one_cluster}} -namespace {{asUpperCamelCase name}} = Clusters::detail::Structs::{{asUpperCamelCase name}}; +namespace {{asUpperCamelCase name}} { + +using Fields = Clusters::detail::Structs::{{asUpperCamelCase name}}::Fields; + +struct Type : public Clusters::detail::Structs::{{asUpperCamelCase name}}::Type +{ +}; + +{{#if struct_contains_array}} +struct DecodableType : public Clusters::detail::Structs::{{asUpperCamelCase name}}::DecodableType +{ +}; +{{else}} +using DecodableType = Type; +{{/if}} + +} // namespace {{asUpperCamelCase name}} + {{else}} {{> cluster_objects_struct header=true}} {{/if}} diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 627433159099d5..703cec6ef621c1 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -13175,7 +13175,18 @@ struct TypeInfo } // namespace GroupKeyManagement namespace FixedLabel { namespace Structs { -namespace LabelStruct = Clusters::detail::Structs::LabelStruct; +namespace LabelStruct { + +using Fields = Clusters::detail::Structs::LabelStruct::Fields; + +struct Type : public Clusters::detail::Structs::LabelStruct::Type +{ +}; + +using DecodableType = Type; + +} // namespace LabelStruct + } // namespace Structs namespace Attributes { @@ -13251,7 +13262,18 @@ struct TypeInfo } // namespace FixedLabel namespace UserLabel { namespace Structs { -namespace LabelStruct = Clusters::detail::Structs::LabelStruct; +namespace LabelStruct { + +using Fields = Clusters::detail::Structs::LabelStruct::Fields; + +struct Type : public Clusters::detail::Structs::LabelStruct::Type +{ +}; + +using DecodableType = Type; + +} // namespace LabelStruct + } // namespace Structs namespace Attributes { @@ -26006,7 +26028,18 @@ struct TypeInfo } // namespace AudioOutput namespace ApplicationLauncher { namespace Structs { -namespace ApplicationStruct = Clusters::detail::Structs::ApplicationStruct; +namespace ApplicationStruct { + +using Fields = Clusters::detail::Structs::ApplicationStruct::Fields; + +struct Type : public Clusters::detail::Structs::ApplicationStruct::Type +{ +}; + +using DecodableType = Type; + +} // namespace ApplicationStruct + namespace ApplicationEPStruct { enum class Fields : uint8_t { @@ -26281,7 +26314,18 @@ struct TypeInfo } // namespace ApplicationLauncher namespace ApplicationBasic { namespace Structs { -namespace ApplicationStruct = Clusters::detail::Structs::ApplicationStruct; +namespace ApplicationStruct { + +using Fields = Clusters::detail::Structs::ApplicationStruct::Fields; + +struct Type : public Clusters::detail::Structs::ApplicationStruct::Type +{ +}; + +using DecodableType = Type; + +} // namespace ApplicationStruct + } // namespace Structs namespace Attributes { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 57b7ee1203a6f8..5c53b15986c458 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -19,66 +19,6 @@ #include -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationStruct.catalogVendorID", "catalogVendorID", - value.isMember("catalogVendorID"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationStruct.applicationID", "applicationID", - value.isMember("applicationID"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "catalogVendorID"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.catalogVendorID, value["catalogVendorID"])); - valueCopy.removeMember("catalogVendorID"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "applicationID"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.applicationID, value["applicationID"])); - valueCopy.removeMember("applicationID"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.catalogVendorID); - ComplexArgumentParser::Finalize(request.applicationID); -} - -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::LabelStruct::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.label", "label", value.isMember("label"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.value", "value", value.isMember("value"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); - valueCopy.removeMember("label"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); - valueCopy.removeMember("value"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::LabelStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.label); - ComplexArgumentParser::Finalize(request.value); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type & request, Json::Value & value) @@ -1766,6 +1706,64 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::GroupKeyManagement::St ComplexArgumentParser::Finalize(request.epochStartTime2); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::FixedLabel::Structs::LabelStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.label", "label", value.isMember("label"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.value", "value", value.isMember("value"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); + valueCopy.removeMember("label"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + valueCopy.removeMember("value"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::FixedLabel::Structs::LabelStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.label); + ComplexArgumentParser::Finalize(request.value); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::UserLabel::Structs::LabelStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.label", "label", value.isMember("label"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.value", "value", value.isMember("value"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); + valueCopy.removeMember("label"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + valueCopy.removeMember("value"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::UserLabel::Structs::LabelStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.label); + ComplexArgumentParser::Finalize(request.value); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::Type & request, Json::Value & value) @@ -2434,6 +2432,38 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::AudioOutput::Structs:: ComplexArgumentParser::Finalize(request.name); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationStruct.catalogVendorID", "catalogVendorID", + value.isMember("catalogVendorID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationStruct.applicationID", "applicationID", + value.isMember("applicationID"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "catalogVendorID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.catalogVendorID, value["catalogVendorID"])); + valueCopy.removeMember("catalogVendorID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "applicationID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.applicationID, value["applicationID"])); + valueCopy.removeMember("applicationID"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.catalogVendorID); + ComplexArgumentParser::Finalize(request.applicationID); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::Type & request, Json::Value & value) @@ -2467,6 +2497,38 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ApplicationLauncher::S ComplexArgumentParser::Finalize(request.endpoint); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationStruct.catalogVendorID", "catalogVendorID", + value.isMember("catalogVendorID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationStruct.applicationID", "applicationID", + value.isMember("applicationID"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "catalogVendorID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.catalogVendorID, value["catalogVendorID"])); + valueCopy.removeMember("catalogVendorID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "applicationID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.applicationID, value["applicationID"])); + valueCopy.removeMember("applicationID"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.catalogVendorID); + ComplexArgumentParser::Finalize(request.applicationID); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type & request, Json::Value & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 6d5368acc56cfa..9336e56a89d5e9 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -22,15 +22,6 @@ #include #include -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request); - -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::LabelStruct::Type & request, Json::Value & value); - -static void Finalize(chip::app::Clusters::detail::Structs::LabelStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type & request, Json::Value & value); @@ -216,6 +207,16 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::GroupKeyManagem static void Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::FixedLabel::Structs::LabelStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::FixedLabel::Structs::LabelStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::UserLabel::Structs::LabelStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::UserLabel::Structs::LabelStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::Type & request, Json::Value & value); @@ -303,11 +304,21 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AudioOutput::St static void Finalize(chip::app::Clusters::AudioOutput::Structs::OutputInfoStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::Type & request, Json::Value & value); static void Finalize(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 596663cfbc6c31..57fcae98c7fddd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -21,56 +21,6 @@ using namespace chip::app::Clusters; -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("CatalogVendorID", indent + 1, value.catalogVendorID); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CatalogVendorID'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("ApplicationID", indent + 1, value.applicationID); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ApplicationID'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::LabelStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("Label", indent + 1, value.label); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Label'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("Value", indent + 1, value.value); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Value'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Scenes::Structs::AttributeValuePair::DecodableType & value) { @@ -1609,6 +1559,56 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::FixedLabel::Structs::LabelStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Label", indent + 1, value.label); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Label'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Value", indent + 1, value.value); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Value'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::UserLabel::Structs::LabelStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Label", indent + 1, value.label); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Label'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Value", indent + 1, value.value); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Value'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType & value) @@ -2185,6 +2185,32 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("CatalogVendorID", indent + 1, value.catalogVendorID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CatalogVendorID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ApplicationID", indent + 1, value.applicationID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ApplicationID'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::DecodableType & value) @@ -2211,6 +2237,31 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("CatalogVendorID", indent + 1, value.catalogVendorID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'CatalogVendorID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ApplicationID", indent + 1, value.applicationID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ApplicationID'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Structs::SimpleStruct::DecodableType & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 4ca2cb87965695..7d96f2afdd379c 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -20,12 +20,6 @@ #include #include -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value); - -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::detail::Structs::LabelStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Scenes::Structs::AttributeValuePair::DecodableType & value); @@ -137,6 +131,12 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::FixedLabel::Structs::LabelStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::UserLabel::Structs::LabelStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType & value); @@ -188,9 +188,15 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AudioOutput::Structs::OutputInfoStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Structs::SimpleStruct::DecodableType & value);