From 750f9765c6cef3724b15d359c7e0d8579948606b Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <vnicolas@apple.com> Date: Wed, 26 Jan 2022 17:30:01 +0100 Subject: [PATCH] [chip-tool] Support complex types (as command argument or as writeable attribute) (#13761) * [chip-tool] Add complex types supports * Update generated code --- examples/chip-tool/BUILD.gn | 1 + .../commands/clusters/ComplexArgument.h | 295 +++ .../chip-tool/commands/common/Command.cpp | 16 + examples/chip-tool/commands/common/Command.h | 5 +- .../templates/ComplexArgumentParser-src.zapt | 39 + .../templates/ComplexArgumentParser.zapt | 7 + examples/chip-tool/templates/commands.zapt | 44 +- examples/chip-tool/templates/templates.json | 10 + .../zap-templates/common/ClustersHelper.js | 2 + .../zap-generated/cluster/Commands.h | 355 ++- .../cluster/ComplexArgumentParser.cpp | 1969 +++++++++++++++++ .../cluster/ComplexArgumentParser.h | 240 ++ 12 files changed, 2910 insertions(+), 73 deletions(-) create mode 100644 examples/chip-tool/commands/clusters/ComplexArgument.h create mode 100644 examples/chip-tool/templates/ComplexArgumentParser-src.zapt create mode 100644 examples/chip-tool/templates/ComplexArgumentParser.zapt create mode 100644 zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp create mode 100644 zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 32facb3e632d00..5996eb38344774 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -39,6 +39,7 @@ static_library("chip-tool-utils") { sources = [ "${chip_root}/src/app/tests/suites/include/ConstraintsChecker.h", "${chip_root}/src/app/tests/suites/include/ValueChecker.h", + "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp", "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp", "commands/clusters/ModelCommand.cpp", "commands/common/CHIPCommand.cpp", diff --git a/examples/chip-tool/commands/clusters/ComplexArgument.h b/examples/chip-tool/commands/clusters/ComplexArgument.h new file mode 100644 index 00000000000000..fd06b458f69ce5 --- /dev/null +++ b/examples/chip-tool/commands/clusters/ComplexArgument.h @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include <app-common/zap-generated/cluster-objects.h> +#include <app/data-model/List.h> +#include <app/data-model/Nullable.h> +#include <json/json.h> +#include <lib/core/Optional.h> +#include <lib/support/BytesToHex.h> +#include <lib/support/SafeInt.h> + +constexpr uint8_t kMaxLabelLength = 100; + +class ComplexArgumentParser +{ +public: + ComplexArgumentParser() {} + + template <typename T, + typename std::enable_if_t<std::is_integral<T>::value && !std::is_signed<T>::value && + !std::is_same<std::remove_cv_t<std::remove_reference_t<T>>, bool>::value, + int> = 0> + static CHIP_ERROR Setup(const char * label, T & request, Json::Value value) + { + if (!value.isNumeric() || !chip::CanCastTo<T>(value.asLargestUInt())) + { + ChipLogError(chipTool, "Error while encoding %s as an unsigned integer.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + request = static_cast<T>(value.asUInt()); + return CHIP_NO_ERROR; + } + + template <typename T, std::enable_if_t<std::is_signed<T>::value, bool> = true> + static CHIP_ERROR Setup(const char * label, T & request, Json::Value value) + { + if (!value.isNumeric() || !chip::CanCastTo<T>(value.asLargestInt())) + { + ChipLogError(chipTool, "Error while encoding %s as an unsigned integer.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + request = static_cast<T>(value.asInt()); + return CHIP_NO_ERROR; + } + + template <typename T, typename std::enable_if_t<std::is_enum<T>::value, int> = 0> + static CHIP_ERROR Setup(const char * label, T & request, Json::Value value) + { + std::underlying_type_t<T> requestValue; + ReturnErrorOnFailure(ComplexArgumentParser::Setup(label, requestValue, value)); + + request = static_cast<T>(requestValue); + return CHIP_NO_ERROR; + } + + template <typename T> + static CHIP_ERROR Setup(const char * label, chip::BitFlags<T> & request, Json::Value & value) + { + T requestValue; + ReturnErrorOnFailure(ComplexArgumentParser::Setup(label, requestValue, value)); + + request = chip::BitFlags<T>(requestValue); + return CHIP_NO_ERROR; + } + + template <typename T> + static CHIP_ERROR Setup(const char * label, chip::Optional<T> & request, Json::Value & value) + { + T requestValue; + ReturnErrorOnFailure(ComplexArgumentParser::Setup(label, requestValue, value)); + + request = chip::Optional<T>(requestValue); + return CHIP_NO_ERROR; + } + + template <typename T> + static CHIP_ERROR Setup(const char * label, chip::app::DataModel::Nullable<T> & request, Json::Value & value) + { + if (value.isNull()) + { + request.SetNull(); + return CHIP_NO_ERROR; + } + + T requestValue; + ReturnErrorOnFailure(ComplexArgumentParser::Setup(label, requestValue, value)); + + request = chip::app::DataModel::Nullable<T>(requestValue); + return CHIP_NO_ERROR; + } + + template <typename T> + static CHIP_ERROR Setup(const char * label, chip::app::DataModel::List<T> & request, Json::Value & value) + { + if (!value.isArray()) + { + ChipLogError(chipTool, "Error while encoding %s as an array.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + auto content = static_cast<typename std::remove_const<T>::type *>(chip::Platform::MemoryCalloc(value.size(), sizeof(T))); + + Json::ArrayIndex size = value.size(); + for (Json::ArrayIndex i = 0; i < size; i++) + { + char labelWithIndex[kMaxLabelLength]; + snprintf(labelWithIndex, sizeof(labelWithIndex), "%s[%d]", label, i); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithIndex, content[i], value[i])); + } + + request = chip::app::DataModel::List<T>(content, value.size()); + return CHIP_NO_ERROR; + } + + static CHIP_ERROR Setup(const char * label, chip::ByteSpan & request, Json::Value & value) + { + if (!value.isString()) + { + ChipLogError(chipTool, "Error while encoding %s as an octet string: Not a string.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + if (strlen(value.asCString()) % 2 != 0) + { + ChipLogError(chipTool, "Error while encoding %s as an octet string: Odd number of characters.", label); + return CHIP_ERROR_INVALID_STRING_LENGTH; + } + + size_t size = strlen(value.asCString()); + auto buffer = static_cast<uint8_t *>(chip::Platform::MemoryCalloc(size / 2, sizeof(uint8_t))); + size_t octetCount = chip::Encoding::HexToBytes(value.asCString(), size, buffer, size / 2); + + request = chip::ByteSpan(buffer, octetCount); + return CHIP_NO_ERROR; + } + + static CHIP_ERROR Setup(const char * label, chip::CharSpan & request, Json::Value & value) + { + if (!value.isString()) + { + ChipLogError(chipTool, "Error while encoding %s as a string: Not a string.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + size_t size = strlen(value.asCString()); + auto buffer = static_cast<char *>(chip::Platform::MemoryCalloc(size, sizeof(char))); + strncpy(buffer, value.asCString(), size); + + request = chip::CharSpan(buffer, size); + return CHIP_NO_ERROR; + } + + static CHIP_ERROR Setup(const char * label, float & request, Json::Value & value) + { + if (!value.isNumeric()) + { + ChipLogError(chipTool, "Error while encoding %s as a float: Not a number.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + request = static_cast<float>(value.asFloat()); + return CHIP_NO_ERROR; + } + + static CHIP_ERROR Setup(const char * label, double & request, Json::Value & value) + { + if (!value.isNumeric()) + { + ChipLogError(chipTool, "Error while encoding %s as a double: Not a number.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + request = static_cast<double>(value.asDouble()); + return CHIP_NO_ERROR; + } + + static CHIP_ERROR Setup(const char * label, bool & request, Json::Value & value) + { + if (!value.isBool()) + { + ChipLogError(chipTool, "Error while encoding %s as a boolean: Not a boolean.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + request = value.asBool(); + return CHIP_NO_ERROR; + } + + static CHIP_ERROR EnsureMemberExist(const char * label, bool hasMember) + { + if (hasMember) + { + return CHIP_NO_ERROR; + } + + ChipLogError(chipTool, "%s is required.", label); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + template <typename T> + static void Finalize(T & request) + { + // Nothing to do + } + + template <typename T> + static void Finalize(chip::Optional<T> & request) + { + VerifyOrReturn(request.HasValue()); + ComplexArgumentParser::Finalize(request.Value()); + } + + template <typename T> + static void Finalize(chip::app::DataModel::Nullable<T> & request) + { + VerifyOrReturn(!request.IsNull()); + ComplexArgumentParser::Finalize(request.Value()); + } + + static void Finalize(chip::ByteSpan & request) + { + VerifyOrReturn(request.data() != nullptr); + chip::Platform::MemoryFree(reinterpret_cast<void *>(const_cast<uint8_t *>(request.data()))); + } + + static void Finalize(chip::CharSpan & request) + { + VerifyOrReturn(request.data() != nullptr); + chip::Platform::MemoryFree(reinterpret_cast<void *>(const_cast<char *>(request.data()))); + } + + template <typename T> + static void Finalize(chip::app::DataModel::List<T> & request) + { + VerifyOrReturn(request.data() != nullptr); + + size_t size = request.size(); + auto data = const_cast<typename std::remove_const<T>::type *>(request.data()); + for (size_t i = 0; i < size; i++) + { + Finalize(data[i]); + } + + chip::Platform::MemoryFree(reinterpret_cast<void *>(data)); + } + +#include <zap-generated/cluster/ComplexArgumentParser.h> +}; + +class ComplexArgument +{ +public: + virtual ~ComplexArgument() {} + + virtual CHIP_ERROR Parse(const char * label, const char * json) = 0; +}; + +template <typename T> +class TypedComplexArgument : public ComplexArgument +{ +public: + TypedComplexArgument(T * request) : mRequest(request) {} + ~TypedComplexArgument() { ComplexArgumentParser::Finalize(*mRequest); } + + CHIP_ERROR Parse(const char * label, const char * json) + { + Json::Value value; + Json::Reader reader; + reader.parse(json, value); + + return ComplexArgumentParser::Setup(label, *mRequest, value); + } + +private: + T * mRequest; +}; diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 9d3b862d56ac2a..4f91b7301911f9 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -183,6 +183,11 @@ bool Command::InitArgument(size_t argIndex, char * argValue) Argument arg = mArgs.at(argIndex); switch (arg.type) { + case ArgumentType::Complex: { + auto complexArgument = static_cast<ComplexArgument *>(arg.value); + return CHIP_NO_ERROR == complexArgument->Parse(arg.name, argValue); + } + case ArgumentType::Attribute: { if (arg.isOptional() || arg.isNullable()) { @@ -479,6 +484,17 @@ size_t Command::AddArgument(const char * name, AddressWithInterface * out, uint8 return AddArgumentToList(std::move(arg)); } +size_t Command::AddArgument(const char * name, ComplexArgument * value) +{ + Argument arg; + arg.type = ArgumentType::Complex; + arg.name = name; + arg.value = static_cast<void *>(value); + arg.flags = 0; + + return AddArgumentToList(std::move(arg)); +} + size_t Command::AddArgument(const char * name, float min, float max, float * out, uint8_t flags) { Argument arg; diff --git a/examples/chip-tool/commands/common/Command.h b/examples/chip-tool/commands/common/Command.h index b6a0021c30b221..9fc024e2952ed0 100644 --- a/examples/chip-tool/commands/common/Command.h +++ b/examples/chip-tool/commands/common/Command.h @@ -19,6 +19,7 @@ #pragma once #include <app/data-model/Nullable.h> +#include <commands/clusters/ComplexArgument.h> #include <controller/CHIPDeviceController.h> #include <inet/InetInterface.h> #include <lib/core/Optional.h> @@ -65,7 +66,8 @@ enum ArgumentType CharString, OctetString, Attribute, - Address + Address, + Complex }; struct Argument @@ -124,6 +126,7 @@ class Command size_t AddArgument(const char * name, chip::ByteSpan * value, uint8_t flags = 0); size_t AddArgument(const char * name, chip::Span<const char> * value, uint8_t flags = 0); size_t AddArgument(const char * name, AddressWithInterface * out, uint8_t flags = 0); + size_t AddArgument(const char * name, ComplexArgument * value); size_t AddArgument(const char * name, int64_t min, uint64_t max, bool * out, uint8_t flags = 0) { return AddArgument(name, min, max, reinterpret_cast<void *>(out), Boolean, flags); diff --git a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt new file mode 100644 index 00000000000000..c9fc765aa48122 --- /dev/null +++ b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt @@ -0,0 +1,39 @@ +{{> header}} + +#include <commands/clusters/ComplexArgument.h> + +{{#structs_with_cluster_name}} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, {{zapTypeToEncodableClusterObjectType name ns=clusterName}} & request, Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + {{#zcl_struct_items}} + {{#unless isOptional}} + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("{{parent.name}}.{{asLowerCamelCase label}}", value.isMember("{{asLowerCamelCase label}}"))); + {{/unless}} + {{/zcl_struct_items}} + + char labelWithMember[kMaxLabelLength]; + {{#zcl_struct_items}} + {{#if isOptional}} + if (value.isMember("{{asLowerCamelCase label}}")) + { + {{/if}} + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "{{asLowerCamelCase label}}"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.{{asLowerCamelCase label}}, value["{{asLowerCamelCase label}}"])); + {{#if isOptional}} + } + {{/if}} + + {{/zcl_struct_items}} + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize({{zapTypeToEncodableClusterObjectType name ns=clusterName}} & request) +{ + {{#zcl_struct_items}} + ComplexArgumentParser::Finalize(request.{{asLowerCamelCase label}}); + {{/zcl_struct_items}} +} +{{/structs_with_cluster_name}} + diff --git a/examples/chip-tool/templates/ComplexArgumentParser.zapt b/examples/chip-tool/templates/ComplexArgumentParser.zapt new file mode 100644 index 00000000000000..9597dc57fcbdab --- /dev/null +++ b/examples/chip-tool/templates/ComplexArgumentParser.zapt @@ -0,0 +1,7 @@ +{{> header}} + +{{#structs_with_cluster_name}} +static CHIP_ERROR Setup(const char * label, {{zapTypeToEncodableClusterObjectType name ns=clusterName}} & request, Json::Value & value); + +static void Finalize({{zapTypeToEncodableClusterObjectType name ns=clusterName}} & request); +{{/structs_with_cluster_name}} diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index 3cf8df0a85c825..f221de19e27b69 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -9,6 +9,7 @@ #include <app-common/zap-generated/cluster-objects.h> #include <app/data-model/DecodableList.h> #include <app/data-model/Nullable.h> +#include <commands/clusters/ComplexArgument.h> #include <commands/clusters/DataModelLogger.h> #include <commands/clusters/ModelCommand.h> #include <commands/common/CommandInvoker.h> @@ -86,14 +87,12 @@ static void On{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}Success(v class {{asUpperCamelCase clusterName}}{{asUpperCamelCase name}}: public ModelCommand { public: - {{asUpperCamelCase clusterName}}{{asUpperCamelCase name}}(): ModelCommand("{{asDelimitedCommand name}}") + {{asUpperCamelCase clusterName}}{{asUpperCamelCase name}}(): ModelCommand("{{asDelimitedCommand name}}"){{#chip_cluster_command_arguments}}{{#if isComplex}}, mComplex_{{asUpperCamelCase label}}(&mRequest.{{asLowerCamelCase label}}){{/if}}{{/chip_cluster_command_arguments}} { {{#chip_cluster_command_arguments}} {{~#*inline "field"}}mRequest.{{asLowerCamelCase label}}{{/inline~}} - {{#if isArray}} - // {{label}} Array parsing is not supported yet - {{else if isStruct}} - // {{label}} Struct parsing is not supported yet + {{#if isComplex}} + AddArgument("{{asUpperCamelCase label}}", &mComplex_{{asUpperCamelCase label}}); {{else if (isString type)}} AddArgument("{{asUpperCamelCase label}}", &{{>field}}); {{else}} @@ -112,18 +111,16 @@ public: { ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %" PRIu16, endpointId); - {{#chip_cluster_command_non_expanded_arguments}} - {{#if isArray}} - {{! TODO Implement complex types parsing in order to properly set the request parameters }} - mRequest.{{asLowerCamelCase label}} = {{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}(); - {{/if}} - {{/chip_cluster_command_non_expanded_arguments}} - return chip::Controller::InvokeCommand(device, this, {{#if hasSpecificResponse}}On{{asUpperCamelCase parent.name}}{{asUpperCamelCase response.name}}Success{{else}}OnDefaultSuccess{{/if}}, OnDefaultFailure, endpointId, mRequest, mTimedInteractionTimeoutMs); } private: chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type mRequest; + {{#chip_cluster_command_arguments}} + {{#if isComplex}} + TypedComplexArgument<{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}> mComplex_{{asUpperCamelCase label}}; + {{/if}} + {{/chip_cluster_command_arguments}} }; {{/chip_cluster_commands}} @@ -248,19 +245,14 @@ public: }; {{#if isWritableAttribute}} -{{! No list support for writing yet. Need to figure out how to represent the - values. }} -{{#unless isArray}} class Write{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand { public: - Write{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}(): ModelCommand("write") + Write{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}(): ModelCommand("write"){{#if isComplex}}, mComplex(&mValue){{/if}} { AddArgument("attr-name", "{{asDelimitedCommand (asUpperCamelCase name)}}"); - {{#if isArray}} - // {{label}} Array parsing is not supported yet - {{else if isStruct}} - // {{label}} Struct parsing is not supported yet + {{#if isComplex}} + AddArgument("attr-value", &mComplex); {{else if (isString type)}} AddArgument("attr-value", &mValue); {{else}} @@ -269,9 +261,7 @@ public: ModelCommand::AddArguments(); } - ~Write{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}() - { - } + ~Write{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}() {} CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override { @@ -284,9 +274,11 @@ public: private: {{zapTypeToEncodableClusterObjectType type ns=parent.name}} mValue; +{{#if isComplex}} + TypedComplexArgument<{{zapTypeToEncodableClusterObjectType type ns=parent.name}}> mComplex; +{{/if}} }; -{{/unless}} {{/if}} {{#if isReportableAttribute}} class Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand @@ -354,11 +346,7 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{#unless (isStrEqual chipCallback.name "Unsupported")}} make_unique<Read{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}>(), // {{#if isWritableAttribute}} - {{! No list support for writing yet. Need to figure out how to - represent the values. }} - {{#unless isArray}} make_unique<Write{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}>(), // - {{/unless}} {{/if}} {{#if isReportableAttribute}} make_unique<Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}>(), // diff --git a/examples/chip-tool/templates/templates.json b/examples/chip-tool/templates/templates.json index b3037a53973030..8a39d5b2da4800 100644 --- a/examples/chip-tool/templates/templates.json +++ b/examples/chip-tool/templates/templates.json @@ -53,6 +53,16 @@ "name": "Data Model Logger", "output": "cluster/logging/DataModelLogger.cpp" }, + { + "path": "ComplexArgumentParser.zapt", + "name": "Complex Argument Parser header", + "output": "cluster/ComplexArgumentParser.h" + }, + { + "path": "ComplexArgumentParser-src.zapt", + "name": "Complex Argument Parser", + "output": "cluster/ComplexArgumentParser.cpp" + }, { "path": "tests-commands.zapt", "name": "Tests Commands header", diff --git a/src/app/zap-templates/common/ClustersHelper.js b/src/app/zap-templates/common/ClustersHelper.js index 929e2c747166dd..6d456903da5245 100644 --- a/src/app/zap-templates/common/ClustersHelper.js +++ b/src/app/zap-templates/common/ClustersHelper.js @@ -399,6 +399,7 @@ function enhancedCommands(commands, types) commands.forEach(command => { command.arguments.forEach(argument => { enhancedItem(argument, types); + argument.isComplex = argument.isList || argument.isStruct || argument.isArray; }); }); @@ -475,6 +476,7 @@ function enhancedAttributes(attributes, globalAttributes, types) attribute.isWritableAttribute = attribute.isWritable === 1; attribute.isReportableAttribute = attribute.includedReportable === 1; attribute.chipCallback = asChipCallback(attribute); + attribute.isComplex = attribute.isList || attribute.isStruct || attribute.isArray; }); attributes.forEach(attribute => { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index b160e1591446ac..e1bef349eb5d04 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -26,6 +26,7 @@ #include <app-common/zap-generated/cluster-objects.h> #include <app/data-model/DecodableList.h> #include <app/data-model/Nullable.h> +#include <commands/clusters/ComplexArgument.h> #include <commands/clusters/DataModelLogger.h> #include <commands/clusters/ModelCommand.h> #include <commands/common/CommandInvoker.h> @@ -1285,6 +1286,34 @@ class ReadAccessControlAcl : public ModelCommand } }; +class WriteAccessControlAcl : public ModelCommand +{ +public: + WriteAccessControlAcl() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "acl"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteAccessControlAcl() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000001F) WriteAttribute (0x00000000) on endpoint %" PRIu16, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::AccessControl::Attributes::Acl::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type> mValue; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type>> + mComplex; +}; + class ReportAccessControlAcl : public ModelCommand { public: @@ -1363,6 +1392,34 @@ class ReadAccessControlExtension : public ModelCommand } }; +class WriteAccessControlExtension : public ModelCommand +{ +public: + WriteAccessControlExtension() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "extension"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteAccessControlExtension() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000001F) WriteAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::AccessControl::Attributes::Extension::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type> mValue; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type>> + mComplex; +}; + class ReportAccessControlExtension : public ModelCommand { public: @@ -2921,9 +2978,9 @@ class ReportApplicationBasicClusterRevision : public ModelCommand class ApplicationLauncherHideAppRequest : public ModelCommand { public: - ApplicationLauncherHideAppRequest() : ModelCommand("hide-app-request") + ApplicationLauncherHideAppRequest() : ModelCommand("hide-app-request"), mComplex_Application(&mRequest.application) { - // application Struct parsing is not supported yet + AddArgument("Application", &mComplex_Application); ModelCommand::AddArguments(); } @@ -2937,6 +2994,8 @@ class ApplicationLauncherHideAppRequest : public ModelCommand private: chip::app::Clusters::ApplicationLauncher::Commands::HideAppRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type> + mComplex_Application; }; /* @@ -2945,10 +3004,10 @@ class ApplicationLauncherHideAppRequest : public ModelCommand class ApplicationLauncherLaunchAppRequest : public ModelCommand { public: - ApplicationLauncherLaunchAppRequest() : ModelCommand("launch-app-request") + ApplicationLauncherLaunchAppRequest() : ModelCommand("launch-app-request"), mComplex_Application(&mRequest.application) { AddArgument("Data", &mRequest.data); - // application Struct parsing is not supported yet + AddArgument("Application", &mComplex_Application); ModelCommand::AddArguments(); } @@ -2962,6 +3021,8 @@ class ApplicationLauncherLaunchAppRequest : public ModelCommand private: chip::app::Clusters::ApplicationLauncher::Commands::LaunchAppRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type> + mComplex_Application; }; /* @@ -2970,9 +3031,9 @@ class ApplicationLauncherLaunchAppRequest : public ModelCommand class ApplicationLauncherStopAppRequest : public ModelCommand { public: - ApplicationLauncherStopAppRequest() : ModelCommand("stop-app-request") + ApplicationLauncherStopAppRequest() : ModelCommand("stop-app-request"), mComplex_Application(&mRequest.application) { - // application Struct parsing is not supported yet + AddArgument("Application", &mComplex_Application); ModelCommand::AddArguments(); } @@ -2986,6 +3047,8 @@ class ApplicationLauncherStopAppRequest : public ModelCommand private: chip::app::Clusters::ApplicationLauncher::Commands::StopAppRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type> + mComplex_Application; }; /* @@ -13104,11 +13167,11 @@ class ReportColorControlClusterRevision : public ModelCommand class ContentLauncherLaunchContentRequest : public ModelCommand { public: - ContentLauncherLaunchContentRequest() : ModelCommand("launch-content-request") + ContentLauncherLaunchContentRequest() : ModelCommand("launch-content-request"), mComplex_Search(&mRequest.search) { AddArgument("AutoPlay", 0, 1, &mRequest.autoPlay); AddArgument("Data", &mRequest.data); - // search Array parsing is not supported yet + AddArgument("Search", &mComplex_Search); ModelCommand::AddArguments(); } @@ -13122,6 +13185,8 @@ class ContentLauncherLaunchContentRequest : public ModelCommand private: chip::app::Clusters::ContentLauncher::Commands::LaunchContentRequest::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type>> + mComplex_Search; }; /* @@ -13130,11 +13195,12 @@ class ContentLauncherLaunchContentRequest : public ModelCommand class ContentLauncherLaunchURLRequest : public ModelCommand { public: - ContentLauncherLaunchURLRequest() : ModelCommand("launch-urlrequest") + ContentLauncherLaunchURLRequest() : + ModelCommand("launch-urlrequest"), mComplex_BrandingInformation(&mRequest.brandingInformation) { AddArgument("ContentURL", &mRequest.contentURL); AddArgument("DisplayString", &mRequest.displayString); - // brandingInformation Struct parsing is not supported yet + AddArgument("BrandingInformation", &mComplex_BrandingInformation); ModelCommand::AddArguments(); } @@ -13148,6 +13214,7 @@ class ContentLauncherLaunchURLRequest : public ModelCommand private: chip::app::Clusters::ContentLauncher::Commands::LaunchURLRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type> mComplex_BrandingInformation; }; /* @@ -14075,9 +14142,9 @@ class ReportDiagnosticLogsAttributeList : public ModelCommand class DoorLockClearCredential : public ModelCommand { public: - DoorLockClearCredential() : ModelCommand("clear-credential") + DoorLockClearCredential() : ModelCommand("clear-credential"), mComplex_Credential(&mRequest.credential) { - // credential Struct parsing is not supported yet + AddArgument("Credential", &mComplex_Credential); ModelCommand::AddArguments(); } @@ -14091,6 +14158,7 @@ class DoorLockClearCredential : public ModelCommand private: chip::app::Clusters::DoorLock::Commands::ClearCredential::Type mRequest; + TypedComplexArgument<chip::app::Clusters::DoorLock::Structs::DlCredential::Type> mComplex_Credential; }; /* @@ -14123,9 +14191,9 @@ class DoorLockClearUser : public ModelCommand class DoorLockGetCredentialStatus : public ModelCommand { public: - DoorLockGetCredentialStatus() : ModelCommand("get-credential-status") + DoorLockGetCredentialStatus() : ModelCommand("get-credential-status"), mComplex_Credential(&mRequest.credential) { - // credential Struct parsing is not supported yet + AddArgument("Credential", &mComplex_Credential); ModelCommand::AddArguments(); } @@ -14139,6 +14207,7 @@ class DoorLockGetCredentialStatus : public ModelCommand private: chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type mRequest; + TypedComplexArgument<chip::app::Clusters::DoorLock::Structs::DlCredential::Type> mComplex_Credential; }; /* @@ -14195,11 +14264,11 @@ class DoorLockLockDoor : public ModelCommand class DoorLockSetCredential : public ModelCommand { public: - DoorLockSetCredential() : ModelCommand("set-credential") + DoorLockSetCredential() : ModelCommand("set-credential"), mComplex_Credential(&mRequest.credential) { AddArgument("OperationType", 0, UINT8_MAX, reinterpret_cast<std::underlying_type_t<decltype(mRequest.operationType)> *>(&mRequest.operationType)); - // credential Struct parsing is not supported yet + AddArgument("Credential", &mComplex_Credential); AddArgument("CredentialData", &mRequest.credentialData); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); AddArgument("UserStatus", 0, UINT8_MAX, @@ -14217,6 +14286,7 @@ class DoorLockSetCredential : public ModelCommand private: chip::app::Clusters::DoorLock::Commands::SetCredential::Type mRequest; + TypedComplexArgument<chip::app::Clusters::DoorLock::Structs::DlCredential::Type> mComplex_Credential; }; /* @@ -20307,9 +20377,10 @@ class GroupKeyManagementKeySetRead : public ModelCommand class GroupKeyManagementKeySetReadAllIndices : public ModelCommand { public: - GroupKeyManagementKeySetReadAllIndices() : ModelCommand("key-set-read-all-indices") + GroupKeyManagementKeySetReadAllIndices() : + ModelCommand("key-set-read-all-indices"), mComplex_GroupKeySetIDs(&mRequest.groupKeySetIDs) { - // groupKeySetIDs Array parsing is not supported yet + AddArgument("GroupKeySetIDs", &mComplex_GroupKeySetIDs); ModelCommand::AddArguments(); } @@ -20323,6 +20394,7 @@ class GroupKeyManagementKeySetReadAllIndices : public ModelCommand private: chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const uint16_t>> mComplex_GroupKeySetIDs; }; /* @@ -20355,9 +20427,9 @@ class GroupKeyManagementKeySetRemove : public ModelCommand class GroupKeyManagementKeySetWrite : public ModelCommand { public: - GroupKeyManagementKeySetWrite() : ModelCommand("key-set-write") + GroupKeyManagementKeySetWrite() : ModelCommand("key-set-write"), mComplex_GroupKeySet(&mRequest.groupKeySet) { - // groupKeySet Struct parsing is not supported yet + AddArgument("GroupKeySet", &mComplex_GroupKeySet); ModelCommand::AddArguments(); } @@ -20371,6 +20443,7 @@ class GroupKeyManagementKeySetWrite : public ModelCommand private: chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type mRequest; + TypedComplexArgument<chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type> mComplex_GroupKeySet; }; /* @@ -20892,9 +20965,9 @@ class GroupsAddGroupIfIdentifying : public ModelCommand class GroupsGetGroupMembership : public ModelCommand { public: - GroupsGetGroupMembership() : ModelCommand("get-group-membership") + GroupsGetGroupMembership() : ModelCommand("get-group-membership"), mComplex_GroupList(&mRequest.groupList) { - // groupList Array parsing is not supported yet + AddArgument("GroupList", &mComplex_GroupList); ModelCommand::AddArguments(); } @@ -20908,6 +20981,7 @@ class GroupsGetGroupMembership : public ModelCommand private: chip::app::Clusters::Groups::Commands::GetGroupMembership::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const uint16_t>> mComplex_GroupList; }; /* @@ -27185,12 +27259,12 @@ class OtaSoftwareUpdateProviderNotifyUpdateApplied : public ModelCommand class OtaSoftwareUpdateProviderQueryImage : public ModelCommand { public: - OtaSoftwareUpdateProviderQueryImage() : ModelCommand("query-image") + OtaSoftwareUpdateProviderQueryImage() : ModelCommand("query-image"), mComplex_ProtocolsSupported(&mRequest.protocolsSupported) { AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); AddArgument("ProductId", 0, UINT16_MAX, &mRequest.productId); AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); - // protocolsSupported Array parsing is not supported yet + AddArgument("ProtocolsSupported", &mComplex_ProtocolsSupported); AddArgument("HardwareVersion", 0, UINT16_MAX, &mRequest.hardwareVersion); AddArgument("Location", &mRequest.location); AddArgument("RequestorCanConsent", 0, 1, &mRequest.requestorCanConsent); @@ -27208,6 +27282,8 @@ class OtaSoftwareUpdateProviderQueryImage : public ModelCommand private: chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol>> + mComplex_ProtocolsSupported; }; /* @@ -27657,6 +27733,35 @@ class ReadOtaSoftwareUpdateRequestorDefaultOtaProviders : public ModelCommand } }; +class WriteOtaSoftwareUpdateRequestorDefaultOtaProviders : public ModelCommand +{ +public: + WriteOtaSoftwareUpdateRequestorDefaultOtaProviders() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "default-ota-providers"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteOtaSoftwareUpdateRequestorDefaultOtaProviders() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000002A) WriteAttribute (0x00000000) on endpoint %" PRIu16, endpointId); + + chip::Controller::OtaSoftwareUpdateRequestorCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type> mValue; + TypedComplexArgument< + chip::app::DataModel::List<const chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type>> + mComplex; +}; + class ReportOtaSoftwareUpdateRequestorDefaultOtaProviders : public ModelCommand { public: @@ -35726,13 +35831,13 @@ class ReportRelativeHumidityMeasurementClusterRevision : public ModelCommand class ScenesAddScene : public ModelCommand { public: - ScenesAddScene() : ModelCommand("add-scene") + ScenesAddScene() : ModelCommand("add-scene"), mComplex_ExtensionFieldSets(&mRequest.extensionFieldSets) { AddArgument("GroupId", 0, UINT16_MAX, &mRequest.groupId); AddArgument("SceneId", 0, UINT8_MAX, &mRequest.sceneId); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("SceneName", &mRequest.sceneName); - // extensionFieldSets Array parsing is not supported yet + AddArgument("ExtensionFieldSets", &mComplex_ExtensionFieldSets); ModelCommand::AddArguments(); } @@ -35746,6 +35851,8 @@ class ScenesAddScene : public ModelCommand private: chip::app::Clusters::Scenes::Commands::AddScene::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::Scenes::Structs::SceneExtensionFieldSet::Type>> + mComplex_ExtensionFieldSets; }; /* @@ -38852,9 +38959,9 @@ class ReportTemperatureMeasurementClusterRevision : public ModelCommand class TestClusterSimpleStructEchoRequest : public ModelCommand { public: - TestClusterSimpleStructEchoRequest() : ModelCommand("simple-struct-echo-request") + TestClusterSimpleStructEchoRequest() : ModelCommand("simple-struct-echo-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Struct parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -38868,6 +38975,7 @@ class TestClusterSimpleStructEchoRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::SimpleStructEchoRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type> mComplex_Arg1; }; /* @@ -38972,9 +39080,9 @@ class TestClusterTestEnumsRequest : public ModelCommand class TestClusterTestListInt8UArgumentRequest : public ModelCommand { public: - TestClusterTestListInt8UArgumentRequest() : ModelCommand("test-list-int8uargument-request") + TestClusterTestListInt8UArgumentRequest() : ModelCommand("test-list-int8uargument-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Array parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -38988,6 +39096,7 @@ class TestClusterTestListInt8UArgumentRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const uint8_t>> mComplex_Arg1; }; /* @@ -38996,9 +39105,9 @@ class TestClusterTestListInt8UArgumentRequest : public ModelCommand class TestClusterTestListInt8UReverseRequest : public ModelCommand { public: - TestClusterTestListInt8UReverseRequest() : ModelCommand("test-list-int8ureverse-request") + TestClusterTestListInt8UReverseRequest() : ModelCommand("test-list-int8ureverse-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Array parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -39012,6 +39121,7 @@ class TestClusterTestListInt8UReverseRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const uint8_t>> mComplex_Arg1; }; /* @@ -39020,9 +39130,10 @@ class TestClusterTestListInt8UReverseRequest : public ModelCommand class TestClusterTestListNestedStructListArgumentRequest : public ModelCommand { public: - TestClusterTestListNestedStructListArgumentRequest() : ModelCommand("test-list-nested-struct-list-argument-request") + TestClusterTestListNestedStructListArgumentRequest() : + ModelCommand("test-list-nested-struct-list-argument-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Array parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -39036,6 +39147,8 @@ class TestClusterTestListNestedStructListArgumentRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestListNestedStructListArgumentRequest::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::TestCluster::Structs::NestedStructList::Type>> + mComplex_Arg1; }; /* @@ -39044,9 +39157,9 @@ class TestClusterTestListNestedStructListArgumentRequest : public ModelCommand class TestClusterTestListStructArgumentRequest : public ModelCommand { public: - TestClusterTestListStructArgumentRequest() : ModelCommand("test-list-struct-argument-request") + TestClusterTestListStructArgumentRequest() : ModelCommand("test-list-struct-argument-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Array parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -39060,6 +39173,8 @@ class TestClusterTestListStructArgumentRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type>> + mComplex_Arg1; }; /* @@ -39068,9 +39183,10 @@ class TestClusterTestListStructArgumentRequest : public ModelCommand class TestClusterTestNestedStructArgumentRequest : public ModelCommand { public: - TestClusterTestNestedStructArgumentRequest() : ModelCommand("test-nested-struct-argument-request") + TestClusterTestNestedStructArgumentRequest() : + ModelCommand("test-nested-struct-argument-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Struct parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -39084,6 +39200,7 @@ class TestClusterTestNestedStructArgumentRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestNestedStructArgumentRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::TestCluster::Structs::NestedStruct::Type> mComplex_Arg1; }; /* @@ -39092,9 +39209,10 @@ class TestClusterTestNestedStructArgumentRequest : public ModelCommand class TestClusterTestNestedStructListArgumentRequest : public ModelCommand { public: - TestClusterTestNestedStructListArgumentRequest() : ModelCommand("test-nested-struct-list-argument-request") + TestClusterTestNestedStructListArgumentRequest() : + ModelCommand("test-nested-struct-list-argument-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Struct parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -39108,6 +39226,7 @@ class TestClusterTestNestedStructListArgumentRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestNestedStructListArgumentRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::TestCluster::Structs::NestedStructList::Type> mComplex_Arg1; }; /* @@ -39204,9 +39323,9 @@ class TestClusterTestSpecific : public ModelCommand class TestClusterTestStructArgumentRequest : public ModelCommand { public: - TestClusterTestStructArgumentRequest() : ModelCommand("test-struct-argument-request") + TestClusterTestStructArgumentRequest() : ModelCommand("test-struct-argument-request"), mComplex_Arg1(&mRequest.arg1) { - // arg1 Struct parsing is not supported yet + AddArgument("Arg1", &mComplex_Arg1); ModelCommand::AddArguments(); } @@ -39220,6 +39339,7 @@ class TestClusterTestStructArgumentRequest : public ModelCommand private: chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type mRequest; + TypedComplexArgument<chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type> mComplex_Arg1; }; /* @@ -41852,6 +41972,33 @@ class ReadTestClusterListInt8u : public ModelCommand } }; +class WriteTestClusterListInt8u : public ModelCommand +{ +public: + WriteTestClusterListInt8u() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "list-int8u"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterListInt8u() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000001A) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::TestCluster::Attributes::ListInt8u::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const uint8_t> mValue; + TypedComplexArgument<chip::app::DataModel::List<const uint8_t>> mComplex; +}; + class ReportTestClusterListInt8u : public ModelCommand { public: @@ -41924,6 +42071,33 @@ class ReadTestClusterListOctetString : public ModelCommand } }; +class WriteTestClusterListOctetString : public ModelCommand +{ +public: + WriteTestClusterListOctetString() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "list-octet-string"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterListOctetString() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000001B) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::TestCluster::Attributes::ListOctetString::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::ByteSpan> mValue; + TypedComplexArgument<chip::app::DataModel::List<const chip::ByteSpan>> mComplex; +}; + class ReportTestClusterListOctetString : public ModelCommand { public: @@ -41999,6 +42173,34 @@ class ReadTestClusterListStructOctetString : public ModelCommand } }; +class WriteTestClusterListStructOctetString : public ModelCommand +{ +public: + WriteTestClusterListStructOctetString() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "list-struct-octet-string"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterListStructOctetString() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000001C) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::TestCluster::Attributes::ListStructOctetString::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type> mValue; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type>> + mComplex; +}; + class ReportTestClusterListStructOctetString : public ModelCommand { public: @@ -42659,6 +42861,35 @@ class ReadTestClusterListNullablesAndOptionalsStruct : public ModelCommand } }; +class WriteTestClusterListNullablesAndOptionalsStruct : public ModelCommand +{ +public: + WriteTestClusterListNullablesAndOptionalsStruct() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "list-nullables-and-optionals-struct"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterListNullablesAndOptionalsStruct() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00000023) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::TestCluster::Attributes::ListNullablesAndOptionalsStruct::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::Type> mValue; + TypedComplexArgument< + chip::app::DataModel::List<const chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::Type>> + mComplex; +}; + class ReportTestClusterListNullablesAndOptionalsStruct : public ModelCommand { public: @@ -47045,7 +47276,7 @@ class ThermostatGetWeeklySchedule : public ModelCommand class ThermostatSetWeeklySchedule : public ModelCommand { public: - ThermostatSetWeeklySchedule() : ModelCommand("set-weekly-schedule") + ThermostatSetWeeklySchedule() : ModelCommand("set-weekly-schedule"), mComplex_Payload(&mRequest.payload) { AddArgument("NumberOfTransitionsForSequence", 0, UINT8_MAX, &mRequest.numberOfTransitionsForSequence); AddArgument( @@ -47054,7 +47285,7 @@ class ThermostatSetWeeklySchedule : public ModelCommand AddArgument("ModeForSequence", 0, UINT8_MAX, reinterpret_cast<std::underlying_type_t<chip::app::Clusters::Thermostat::ModeForSequence> *>( &mRequest.modeForSequence)); - // payload Array parsing is not supported yet + AddArgument("Payload", &mComplex_Payload); ModelCommand::AddArguments(); } @@ -47068,6 +47299,7 @@ class ThermostatSetWeeklySchedule : public ModelCommand private: chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Type mRequest; + TypedComplexArgument<chip::app::DataModel::List<const uint8_t>> mComplex_Payload; }; /* @@ -54606,6 +54838,33 @@ class ReadUserLabelLabelList : public ModelCommand } }; +class WriteUserLabelLabelList : public ModelCommand +{ +public: + WriteUserLabelLabelList() : ModelCommand("write"), mComplex(&mValue) + { + AddArgument("attr-name", "label-list"); + AddArgument("attr-value", &mComplex); + ModelCommand::AddArguments(); + } + + ~WriteUserLabelLabelList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000041) WriteAttribute (0x00000000) on endpoint %" PRIu16, endpointId); + + chip::Controller::UserLabelCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute<chip::app::Clusters::UserLabel::Attributes::LabelList::TypeInfo>( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::List<const chip::app::Clusters::UserLabel::Structs::LabelStruct::Type> mValue; + TypedComplexArgument<chip::app::DataModel::List<const chip::app::Clusters::UserLabel::Structs::LabelStruct::Type>> mComplex; +}; + class ReportUserLabelLabelList : public ModelCommand { public: @@ -58116,8 +58375,10 @@ void registerClusterAccessControl(Commands & commands) commands_list clusterCommands = { make_unique<ReadAccessControlAcl>(), // + make_unique<WriteAccessControlAcl>(), // make_unique<ReportAccessControlAcl>(), // make_unique<ReadAccessControlExtension>(), // + make_unique<WriteAccessControlExtension>(), // make_unique<ReportAccessControlExtension>(), // make_unique<ReadAccessControlAttributeList>(), // make_unique<ReportAccessControlAttributeList>(), // @@ -59210,6 +59471,7 @@ void registerClusterOtaSoftwareUpdateRequestor(Commands & commands) commands_list clusterCommands = { make_unique<OtaSoftwareUpdateRequestorAnnounceOtaProvider>(), // make_unique<ReadOtaSoftwareUpdateRequestorDefaultOtaProviders>(), // + make_unique<WriteOtaSoftwareUpdateRequestorDefaultOtaProviders>(), // make_unique<ReportOtaSoftwareUpdateRequestorDefaultOtaProviders>(), // make_unique<ReadOtaSoftwareUpdateRequestorUpdatePossible>(), // make_unique<ReportOtaSoftwareUpdateRequestorUpdatePossible>(), // @@ -59757,10 +60019,13 @@ void registerClusterTestCluster(Commands & commands) make_unique<WriteTestClusterOctetString>(), // make_unique<ReportTestClusterOctetString>(), // make_unique<ReadTestClusterListInt8u>(), // + make_unique<WriteTestClusterListInt8u>(), // make_unique<ReportTestClusterListInt8u>(), // make_unique<ReadTestClusterListOctetString>(), // + make_unique<WriteTestClusterListOctetString>(), // make_unique<ReportTestClusterListOctetString>(), // make_unique<ReadTestClusterListStructOctetString>(), // + make_unique<WriteTestClusterListStructOctetString>(), // make_unique<ReportTestClusterListStructOctetString>(), // make_unique<ReadTestClusterLongOctetString>(), // make_unique<WriteTestClusterLongOctetString>(), // @@ -59781,6 +60046,7 @@ void registerClusterTestCluster(Commands & commands) make_unique<WriteTestClusterVendorId>(), // make_unique<ReportTestClusterVendorId>(), // make_unique<ReadTestClusterListNullablesAndOptionalsStruct>(), // + make_unique<WriteTestClusterListNullablesAndOptionalsStruct>(), // make_unique<ReportTestClusterListNullablesAndOptionalsStruct>(), // make_unique<ReadTestClusterEnumAttr>(), // make_unique<WriteTestClusterEnumAttr>(), // @@ -60171,6 +60437,7 @@ void registerClusterUserLabel(Commands & commands) commands_list clusterCommands = { make_unique<ReadUserLabelLabelList>(), // + make_unique<WriteUserLabelLabelList>(), // make_unique<ReportUserLabelLabelList>(), // make_unique<ReadUserLabelClusterRevision>(), // make_unique<ReportUserLabelClusterRevision>(), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp new file mode 100644 index 00000000000000..0328a0cbe543ad --- /dev/null +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -0,0 +1,1969 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include <commands/clusters/ComplexArgument.h> + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.privilege", value.isMember("privilege"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.authMode", value.isMember("authMode"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.subjects", value.isMember("subjects"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessControlEntry.targets", value.isMember("targets"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "privilege"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.privilege, value["privilege"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "authMode"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.authMode, value["authMode"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "subjects"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.subjects, value["subjects"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "targets"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.targets, value["targets"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.privilege); + ComplexArgumentParser::Finalize(request.authMode); + ComplexArgumentParser::Finalize(request.subjects); + ComplexArgumentParser::Finalize(request.targets); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::BridgedActions::Structs::ActionStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ActionStruct.actionID", value.isMember("actionID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ActionStruct.name", value.isMember("name"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ActionStruct.type", value.isMember("type"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ActionStruct.endpointListID", value.isMember("endpointListID"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ActionStruct.supportedCommands", value.isMember("supportedCommands"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ActionStruct.status", value.isMember("status"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "actionID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.actionID, value["actionID"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "type"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.type, value["type"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpointListID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpointListID, value["endpointListID"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "supportedCommands"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.supportedCommands, value["supportedCommands"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "status"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.status, value["status"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::BridgedActions::Structs::ActionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.actionID); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.type); + ComplexArgumentParser::Finalize(request.endpointListID); + ComplexArgumentParser::Finalize(request.supportedCommands); + ComplexArgumentParser::Finalize(request.status); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ContentLauncher::Structs::AdditionalInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AdditionalInfo.name", value.isMember("name"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AdditionalInfo.value", value.isMember("value"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentLauncher::Structs::AdditionalInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.value); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ApplicationBasicApplication.catalogVendorId", value.isMember("catalogVendorId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ApplicationBasicApplication.applicationId", value.isMember("applicationId"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "catalogVendorId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.catalogVendorId, value["catalogVendorId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "applicationId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.applicationId, value["applicationId"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::Type & request) +{ + ComplexArgumentParser::Finalize(request.catalogVendorId); + ComplexArgumentParser::Finalize(request.applicationId); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationEP.application", value.isMember("application"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationEP.endpoint", value.isMember("endpoint"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "application"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.application, value["application"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type & request) +{ + ComplexArgumentParser::Finalize(request.application); + ComplexArgumentParser::Finalize(request.endpoint); +} +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ApplicationLauncherApplication.catalogVendorId", + value.isMember("catalogVendorId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ApplicationLauncherApplication.applicationId", value.isMember("applicationId"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "catalogVendorId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.catalogVendorId, value["catalogVendorId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "applicationId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.applicationId, value["applicationId"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type & request) +{ + ComplexArgumentParser::Finalize(request.catalogVendorId); + ComplexArgumentParser::Finalize(request.applicationId); +} +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfoType::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BasicCommissioningInfoType.failSafeExpiryLengthMs", + value.isMember("failSafeExpiryLengthMs"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "failSafeExpiryLengthMs"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.failSafeExpiryLengthMs, value["failSafeExpiryLengthMs"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfoType::Type & request) +{ + ComplexArgumentParser::Finalize(request.failSafeExpiryLengthMs); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("BrandingInformation.providerName", value.isMember("providerName"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BrandingInformation.background", value.isMember("background"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BrandingInformation.logo", value.isMember("logo"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("BrandingInformation.progressBar", value.isMember("progressBar"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BrandingInformation.splash", value.isMember("splash"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("BrandingInformation.waterMark", value.isMember("waterMark"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "providerName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.providerName, value["providerName"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "background"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.background, value["background"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "logo"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.logo, value["logo"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "progressBar"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.progressBar, value["progressBar"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "splash"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.splash, value["splash"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "waterMark"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.waterMark, value["waterMark"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type & request) +{ + ComplexArgumentParser::Finalize(request.providerName); + ComplexArgumentParser::Finalize(request.background); + ComplexArgumentParser::Finalize(request.logo); + ComplexArgumentParser::Finalize(request.progressBar); + ComplexArgumentParser::Finalize(request.splash); + ComplexArgumentParser::Finalize(request.waterMark); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Channel::Structs::ChannelInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChannelInfo.majorNumber", value.isMember("majorNumber"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChannelInfo.minorNumber", value.isMember("minorNumber"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChannelInfo.name", value.isMember("name"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChannelInfo.callSign", value.isMember("callSign"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ChannelInfo.affiliateCallSign", value.isMember("affiliateCallSign"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "majorNumber"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.majorNumber, value["majorNumber"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minorNumber"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minorNumber, value["minorNumber"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "callSign"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.callSign, value["callSign"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "affiliateCallSign"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.affiliateCallSign, value["affiliateCallSign"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Channel::Structs::ChannelInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.majorNumber); + ComplexArgumentParser::Finalize(request.minorNumber); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.callSign); + ComplexArgumentParser::Finalize(request.affiliateCallSign); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ContentSearch.parameterList", value.isMember("parameterList"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "parameterList"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.parameterList, value["parameterList"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type & request) +{ + ComplexArgumentParser::Finalize(request.parameterList); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Descriptor::Structs::DeviceType::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DeviceType.type", value.isMember("type"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DeviceType.revision", value.isMember("revision"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "type"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.type, value["type"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "revision"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.revision, value["revision"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Descriptor::Structs::DeviceType::Type & request) +{ + ComplexArgumentParser::Finalize(request.type); + ComplexArgumentParser::Finalize(request.revision); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ContentLauncher::Structs::Dimension::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Dimension.width", value.isMember("width"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Dimension.height", value.isMember("height"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Dimension.metric", value.isMember("metric"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "width"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.width, value["width"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "height"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.height, value["height"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "metric"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.metric, value["metric"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentLauncher::Structs::Dimension::Type & request) +{ + ComplexArgumentParser::Finalize(request.width); + ComplexArgumentParser::Finalize(request.height); + ComplexArgumentParser::Finalize(request.metric); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::DoorLock::Structs::DlCredential::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DlCredential.credentialType", value.isMember("credentialType"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DlCredential.credentialIndex", value.isMember("credentialIndex"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "credentialType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.credentialType, value["credentialType"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "credentialIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.credentialIndex, value["credentialIndex"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::DoorLock::Structs::DlCredential::Type & request) +{ + ComplexArgumentParser::Finalize(request.credentialType); + ComplexArgumentParser::Finalize(request.credentialIndex); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("DoubleNestedStructList.a", value.isMember("a"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "a"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.a, value["a"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::Type & request) +{ + ComplexArgumentParser::Finalize(request.a); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::BridgedActions::Structs::EndpointListStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("EndpointListStruct.endpointListID", value.isMember("endpointListID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EndpointListStruct.name", value.isMember("name"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EndpointListStruct.type", value.isMember("type"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EndpointListStruct.endpoints", value.isMember("endpoints"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpointListID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpointListID, value["endpointListID"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "type"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.type, value["type"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoints"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoints, value["endpoints"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::BridgedActions::Structs::EndpointListStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.endpointListID); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.type); + ComplexArgumentParser::Finalize(request.endpoints); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ExtensionEntry.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ExtensionEntry.data", value.isMember("data"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "data"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.data, value["data"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.data); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.rootPublicKey", value.isMember("rootPublicKey"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.vendorId", value.isMember("vendorId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.fabricId", value.isMember("fabricId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.nodeId", value.isMember("nodeId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricDescriptor.label", value.isMember("label"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rootPublicKey"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rootPublicKey, value["rootPublicKey"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "vendorId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.vendorId, value["vendorId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricId, value["fabricId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nodeId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nodeId, value["nodeId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.rootPublicKey); + ComplexArgumentParser::Finalize(request.vendorId); + ComplexArgumentParser::Finalize(request.fabricId); + ComplexArgumentParser::Finalize(request.nodeId); + ComplexArgumentParser::Finalize(request.label); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::GroupKeyManagement::Structs::GroupInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupInfo.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupInfo.groupId", value.isMember("groupId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupInfo.endpoints", value.isMember("endpoints"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupInfo.groupName", value.isMember("groupName"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupId, value["groupId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoints"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoints, value["endpoints"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupName, value["groupName"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.groupId); + ComplexArgumentParser::Finalize(request.endpoints); + ComplexArgumentParser::Finalize(request.groupName); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKey.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKey.groupId", value.isMember("groupId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKey.groupKeySetID", value.isMember("groupKeySetID"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupId, value["groupId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupKeySetID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupKeySetID, value["groupKeySetID"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.groupId); + ComplexArgumentParser::Finalize(request.groupKeySetID); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKeySet.groupKeySetID", value.isMember("groupKeySetID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKeySet.securityPolicy", value.isMember("securityPolicy"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKeySet.epochKey0", value.isMember("epochKey0"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("GroupKeySet.epochStartTime0", value.isMember("epochStartTime0"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKeySet.epochKey1", value.isMember("epochKey1"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("GroupKeySet.epochStartTime1", value.isMember("epochStartTime1"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("GroupKeySet.epochKey2", value.isMember("epochKey2"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("GroupKeySet.epochStartTime2", value.isMember("epochStartTime2"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "groupKeySetID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.groupKeySetID, value["groupKeySetID"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "securityPolicy"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.securityPolicy, value["securityPolicy"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "epochKey0"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.epochKey0, value["epochKey0"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "epochStartTime0"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.epochStartTime0, value["epochStartTime0"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "epochKey1"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.epochKey1, value["epochKey1"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "epochStartTime1"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.epochStartTime1, value["epochStartTime1"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "epochKey2"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.epochKey2, value["epochKey2"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "epochStartTime2"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.epochStartTime2, value["epochStartTime2"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type & request) +{ + ComplexArgumentParser::Finalize(request.groupKeySetID); + ComplexArgumentParser::Finalize(request.securityPolicy); + ComplexArgumentParser::Finalize(request.epochKey0); + ComplexArgumentParser::Finalize(request.epochStartTime0); + ComplexArgumentParser::Finalize(request.epochKey1); + ComplexArgumentParser::Finalize(request.epochStartTime1); + ComplexArgumentParser::Finalize(request.epochKey2); + ComplexArgumentParser::Finalize(request.epochStartTime2); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::IasAce::Structs::IasAceZoneStatusResult::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("IasAceZoneStatusResult.zoneId", value.isMember("zoneId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("IasAceZoneStatusResult.zoneStatus", value.isMember("zoneStatus"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "zoneId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.zoneId, value["zoneId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "zoneStatus"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.zoneStatus, value["zoneStatus"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::IasAce::Structs::IasAceZoneStatusResult::Type & request) +{ + ComplexArgumentParser::Finalize(request.zoneId); + ComplexArgumentParser::Finalize(request.zoneStatus); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::MediaInput::Structs::InputInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("InputInfo.index", value.isMember("index"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("InputInfo.inputType", value.isMember("inputType"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("InputInfo.name", value.isMember("name"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("InputInfo.description", value.isMember("description"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "index"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.index, value["index"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "inputType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.inputType, value["inputType"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "description"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.description, value["description"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::MediaInput::Structs::InputInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.index); + ComplexArgumentParser::Finalize(request.inputType); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.description); +} +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); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.label", value.isMember("label"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LabelStruct.value", value.isMember("value"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + + return CHIP_NO_ERROR; +} + +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::Channel::Structs::LineupInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LineupInfo.operatorName", value.isMember("operatorName"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LineupInfo.lineupName", value.isMember("lineupName"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LineupInfo.postalCode", value.isMember("postalCode"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LineupInfo.lineupInfoType", value.isMember("lineupInfoType"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "operatorName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.operatorName, value["operatorName"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "lineupName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.lineupName, value["lineupName"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "postalCode"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.postalCode, value["postalCode"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "lineupInfoType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.lineupInfoType, value["lineupInfoType"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Channel::Structs::LineupInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.operatorName); + ComplexArgumentParser::Finalize(request.lineupName); + ComplexArgumentParser::Finalize(request.postalCode); + ComplexArgumentParser::Finalize(request.lineupInfoType); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ModeOptionStruct.label", value.isMember("label"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ModeOptionStruct.mode", value.isMember("mode"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ModeOptionStruct.semanticTag", value.isMember("semanticTag"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "label"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.label, value["label"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "mode"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.mode, value["mode"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "semanticTag"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.semanticTag, value["semanticTag"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.label); + ComplexArgumentParser::Finalize(request.mode); + ComplexArgumentParser::Finalize(request.semanticTag); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::OperationalCredentials::Structs::NOCStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NOCStruct.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NOCStruct.noc", value.isMember("noc"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NOCStruct.icac", value.isMember("icac"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "noc"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.noc, value["noc"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "icac"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.icac, value["icac"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::OperationalCredentials::Structs::NOCStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.noc); + ComplexArgumentParser::Finalize(request.icac); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.extAddress", value.isMember("extAddress"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.age", value.isMember("age"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.rloc16", value.isMember("rloc16"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NeighborTable.linkFrameCounter", value.isMember("linkFrameCounter"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NeighborTable.mleFrameCounter", value.isMember("mleFrameCounter"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.lqi", value.isMember("lqi"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.averageRssi", value.isMember("averageRssi"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.lastRssi", value.isMember("lastRssi"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NeighborTable.frameErrorRate", value.isMember("frameErrorRate"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NeighborTable.messageErrorRate", value.isMember("messageErrorRate"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.rxOnWhenIdle", value.isMember("rxOnWhenIdle"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NeighborTable.fullThreadDevice", value.isMember("fullThreadDevice"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NeighborTable.fullNetworkData", value.isMember("fullNetworkData"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NeighborTable.isChild", value.isMember("isChild"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extAddress"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.extAddress, value["extAddress"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "age"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.age, value["age"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rloc16"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rloc16, value["rloc16"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "linkFrameCounter"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.linkFrameCounter, value["linkFrameCounter"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "mleFrameCounter"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.mleFrameCounter, value["mleFrameCounter"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "lqi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.lqi, value["lqi"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "averageRssi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.averageRssi, value["averageRssi"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "lastRssi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.lastRssi, value["lastRssi"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "frameErrorRate"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.frameErrorRate, value["frameErrorRate"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "messageErrorRate"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.messageErrorRate, value["messageErrorRate"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rxOnWhenIdle"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rxOnWhenIdle, value["rxOnWhenIdle"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fullThreadDevice"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fullThreadDevice, value["fullThreadDevice"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fullNetworkData"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fullNetworkData, value["fullNetworkData"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "isChild"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.isChild, value["isChild"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::Type & request) +{ + ComplexArgumentParser::Finalize(request.extAddress); + ComplexArgumentParser::Finalize(request.age); + ComplexArgumentParser::Finalize(request.rloc16); + ComplexArgumentParser::Finalize(request.linkFrameCounter); + ComplexArgumentParser::Finalize(request.mleFrameCounter); + ComplexArgumentParser::Finalize(request.lqi); + ComplexArgumentParser::Finalize(request.averageRssi); + ComplexArgumentParser::Finalize(request.lastRssi); + ComplexArgumentParser::Finalize(request.frameErrorRate); + ComplexArgumentParser::Finalize(request.messageErrorRate); + ComplexArgumentParser::Finalize(request.rxOnWhenIdle); + ComplexArgumentParser::Finalize(request.fullThreadDevice); + ComplexArgumentParser::Finalize(request.fullNetworkData); + ComplexArgumentParser::Finalize(request.isChild); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::TestCluster::Structs::NestedStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStruct.a", value.isMember("a"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStruct.b", value.isMember("b"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStruct.c", value.isMember("c"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "a"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.a, value["a"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "b"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.b, value["b"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "c"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.c, value["c"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::NestedStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.a); + ComplexArgumentParser::Finalize(request.b); + ComplexArgumentParser::Finalize(request.c); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TestCluster::Structs::NestedStructList::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.a", value.isMember("a"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.b", value.isMember("b"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.c", value.isMember("c"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.d", value.isMember("d"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.e", value.isMember("e"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.f", value.isMember("f"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NestedStructList.g", value.isMember("g"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "a"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.a, value["a"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "b"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.b, value["b"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "c"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.c, value["c"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "d"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.d, value["d"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "e"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.e, value["e"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "f"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.f, value["f"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "g"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.g, value["g"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::NestedStructList::Type & request) +{ + ComplexArgumentParser::Finalize(request.a); + ComplexArgumentParser::Finalize(request.b); + ComplexArgumentParser::Finalize(request.c); + ComplexArgumentParser::Finalize(request.d); + ComplexArgumentParser::Finalize(request.e); + ComplexArgumentParser::Finalize(request.f); + ComplexArgumentParser::Finalize(request.g); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::NetworkCommissioning::Structs::NetworkInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NetworkInfo.networkID", value.isMember("networkID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NetworkInfo.connected", value.isMember("connected"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "networkID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.networkID, value["networkID"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "connected"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.connected, value["connected"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::NetworkCommissioning::Structs::NetworkInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.networkID); + ComplexArgumentParser::Finalize(request.connected); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NetworkInterfaceType.name", value.isMember("name"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NetworkInterfaceType.fabricConnected", value.isMember("fabricConnected"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NetworkInterfaceType.offPremiseServicesReachableIPv4", + value.isMember("offPremiseServicesReachableIPv4"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NetworkInterfaceType.offPremiseServicesReachableIPv6", + value.isMember("offPremiseServicesReachableIPv6"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NetworkInterfaceType.hardwareAddress", value.isMember("hardwareAddress"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("NetworkInterfaceType.type", value.isMember("type"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricConnected"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricConnected, value["fabricConnected"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "offPremiseServicesReachableIPv4"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.offPremiseServicesReachableIPv4, + value["offPremiseServicesReachableIPv4"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "offPremiseServicesReachableIPv6"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.offPremiseServicesReachableIPv6, + value["offPremiseServicesReachableIPv6"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "hardwareAddress"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.hardwareAddress, value["hardwareAddress"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "type"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.type, value["type"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::Type & request) +{ + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.fabricConnected); + ComplexArgumentParser::Finalize(request.offPremiseServicesReachableIPv4); + ComplexArgumentParser::Finalize(request.offPremiseServicesReachableIPv6); + ComplexArgumentParser::Finalize(request.hardwareAddress); + ComplexArgumentParser::Finalize(request.type); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NullablesAndOptionalsStruct.nullableInt", value.isMember("nullableInt"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NullablesAndOptionalsStruct.nullableString", value.isMember("nullableString"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NullablesAndOptionalsStruct.nullableStruct", value.isMember("nullableStruct"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("NullablesAndOptionalsStruct.nullableList", value.isMember("nullableList"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableInt"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nullableInt, value["nullableInt"])); + + if (value.isMember("optionalInt")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "optionalInt"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.optionalInt, value["optionalInt"])); + } + + if (value.isMember("nullableOptionalInt")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableOptionalInt"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.nullableOptionalInt, value["nullableOptionalInt"])); + } + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableString"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nullableString, value["nullableString"])); + + if (value.isMember("optionalString")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "optionalString"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.optionalString, value["optionalString"])); + } + + if (value.isMember("nullableOptionalString")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableOptionalString"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.nullableOptionalString, value["nullableOptionalString"])); + } + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableStruct"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nullableStruct, value["nullableStruct"])); + + if (value.isMember("optionalStruct")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "optionalStruct"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.optionalStruct, value["optionalStruct"])); + } + + if (value.isMember("nullableOptionalStruct")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableOptionalStruct"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.nullableOptionalStruct, value["nullableOptionalStruct"])); + } + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableList"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nullableList, value["nullableList"])); + + if (value.isMember("optionalList")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "optionalList"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.optionalList, value["optionalList"])); + } + + if (value.isMember("nullableOptionalList")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nullableOptionalList"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.nullableOptionalList, value["nullableOptionalList"])); + } + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.nullableInt); + ComplexArgumentParser::Finalize(request.optionalInt); + ComplexArgumentParser::Finalize(request.nullableOptionalInt); + ComplexArgumentParser::Finalize(request.nullableString); + ComplexArgumentParser::Finalize(request.optionalString); + ComplexArgumentParser::Finalize(request.nullableOptionalString); + ComplexArgumentParser::Finalize(request.nullableStruct); + ComplexArgumentParser::Finalize(request.optionalStruct); + ComplexArgumentParser::Finalize(request.nullableOptionalStruct); + ComplexArgumentParser::Finalize(request.nullableList); + ComplexArgumentParser::Finalize(request.optionalList); + ComplexArgumentParser::Finalize(request.nullableOptionalList); +} +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.activeTimestampPresent", + value.isMember("activeTimestampPresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.pendingTimestampPresent", + value.isMember("pendingTimestampPresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.masterKeyPresent", + value.isMember("masterKeyPresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.networkNamePresent", + value.isMember("networkNamePresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.extendedPanIdPresent", + value.isMember("extendedPanIdPresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.meshLocalPrefixPresent", + value.isMember("meshLocalPrefixPresent"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.delayPresent", value.isMember("delayPresent"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.panIdPresent", value.isMember("panIdPresent"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.channelPresent", value.isMember("channelPresent"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.pskcPresent", value.isMember("pskcPresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.securityPolicyPresent", + value.isMember("securityPolicyPresent"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OperationalDatasetComponents.channelMaskPresent", + value.isMember("channelMaskPresent"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "activeTimestampPresent"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.activeTimestampPresent, value["activeTimestampPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "pendingTimestampPresent"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.pendingTimestampPresent, value["pendingTimestampPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "masterKeyPresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.masterKeyPresent, value["masterKeyPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "networkNamePresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.networkNamePresent, value["networkNamePresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extendedPanIdPresent"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.extendedPanIdPresent, value["extendedPanIdPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "meshLocalPrefixPresent"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.meshLocalPrefixPresent, value["meshLocalPrefixPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "delayPresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.delayPresent, value["delayPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "panIdPresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.panIdPresent, value["panIdPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "channelPresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.channelPresent, value["channelPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "pskcPresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.pskcPresent, value["pskcPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "securityPolicyPresent"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.securityPolicyPresent, value["securityPolicyPresent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "channelMaskPresent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.channelMaskPresent, value["channelMaskPresent"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::Type & request) +{ + ComplexArgumentParser::Finalize(request.activeTimestampPresent); + ComplexArgumentParser::Finalize(request.pendingTimestampPresent); + ComplexArgumentParser::Finalize(request.masterKeyPresent); + ComplexArgumentParser::Finalize(request.networkNamePresent); + ComplexArgumentParser::Finalize(request.extendedPanIdPresent); + ComplexArgumentParser::Finalize(request.meshLocalPrefixPresent); + ComplexArgumentParser::Finalize(request.delayPresent); + ComplexArgumentParser::Finalize(request.panIdPresent); + ComplexArgumentParser::Finalize(request.channelPresent); + ComplexArgumentParser::Finalize(request.pskcPresent); + ComplexArgumentParser::Finalize(request.securityPolicyPresent); + ComplexArgumentParser::Finalize(request.channelMaskPresent); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::AudioOutput::Structs::OutputInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OutputInfo.index", value.isMember("index"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OutputInfo.outputType", value.isMember("outputType"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("OutputInfo.name", value.isMember("name"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "index"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.index, value["index"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "outputType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.outputType, value["outputType"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::AudioOutput::Structs::OutputInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.index); + ComplexArgumentParser::Finalize(request.outputType); + ComplexArgumentParser::Finalize(request.name); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ContentLauncher::Structs::Parameter::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Parameter.type", value.isMember("type"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Parameter.value", value.isMember("value"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Parameter.externalIDList", value.isMember("externalIDList"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "type"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.type, value["type"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "externalIDList"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.externalIDList, value["externalIDList"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentLauncher::Structs::Parameter::Type & request) +{ + ComplexArgumentParser::Finalize(request.type); + ComplexArgumentParser::Finalize(request.value); + ComplexArgumentParser::Finalize(request.externalIDList); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::MediaPlayback::Structs::PlaybackPosition::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("PlaybackPosition.updatedAt", value.isMember("updatedAt"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("PlaybackPosition.position", value.isMember("position"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "updatedAt"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.updatedAt, value["updatedAt"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "position"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.position, value["position"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::MediaPlayback::Structs::PlaybackPosition::Type & request) +{ + ComplexArgumentParser::Finalize(request.updatedAt); + ComplexArgumentParser::Finalize(request.position); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::PowerProfile::Structs::PowerProfileRecord::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PowerProfileRecord.powerProfileId", value.isMember("powerProfileId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PowerProfileRecord.energyPhaseId", value.isMember("energyPhaseId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("PowerProfileRecord.powerProfileRemoteControl", + value.isMember("powerProfileRemoteControl"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("PowerProfileRecord.powerProfileState", value.isMember("powerProfileState"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "powerProfileId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.powerProfileId, value["powerProfileId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "energyPhaseId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.energyPhaseId, value["energyPhaseId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "powerProfileRemoteControl"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.powerProfileRemoteControl, value["powerProfileRemoteControl"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "powerProfileState"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.powerProfileState, value["powerProfileState"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::PowerProfile::Structs::PowerProfileRecord::Type & request) +{ + ComplexArgumentParser::Finalize(request.powerProfileId); + ComplexArgumentParser::Finalize(request.energyPhaseId); + ComplexArgumentParser::Finalize(request.powerProfileRemoteControl); + ComplexArgumentParser::Finalize(request.powerProfileState); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ProviderLocation.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ProviderLocation.providerNodeID", value.isMember("providerNodeID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ProviderLocation.endpoint", value.isMember("endpoint"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "providerNodeID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.providerNodeID, value["providerNodeID"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.providerNodeID); + ComplexArgumentParser::Finalize(request.endpoint); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.extAddress", value.isMember("extAddress"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.rloc16", value.isMember("rloc16"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.routerId", value.isMember("routerId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.nextHop", value.isMember("nextHop"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.pathCost", value.isMember("pathCost"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.LQIIn", value.isMember("LQIIn"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.LQIOut", value.isMember("LQIOut"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.age", value.isMember("age"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.allocated", value.isMember("allocated"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("RouteTable.linkEstablished", value.isMember("linkEstablished"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extAddress"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.extAddress, value["extAddress"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rloc16"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rloc16, value["rloc16"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "routerId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.routerId, value["routerId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nextHop"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nextHop, value["nextHop"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "pathCost"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.pathCost, value["pathCost"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "LQIIn"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.LQIIn, value["LQIIn"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "LQIOut"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.LQIOut, value["LQIOut"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "age"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.age, value["age"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "allocated"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.allocated, value["allocated"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "linkEstablished"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.linkEstablished, value["linkEstablished"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::Type & request) +{ + ComplexArgumentParser::Finalize(request.extAddress); + ComplexArgumentParser::Finalize(request.rloc16); + ComplexArgumentParser::Finalize(request.routerId); + ComplexArgumentParser::Finalize(request.nextHop); + ComplexArgumentParser::Finalize(request.pathCost); + ComplexArgumentParser::Finalize(request.LQIIn); + ComplexArgumentParser::Finalize(request.LQIOut); + ComplexArgumentParser::Finalize(request.age); + ComplexArgumentParser::Finalize(request.allocated); + ComplexArgumentParser::Finalize(request.linkEstablished); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::Scenes::Structs::SceneExtensionFieldSet::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SceneExtensionFieldSet.clusterId", value.isMember("clusterId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SceneExtensionFieldSet.length", value.isMember("length"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SceneExtensionFieldSet.value", value.isMember("value"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "clusterId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.clusterId, value["clusterId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "length"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.length, value["length"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Scenes::Structs::SceneExtensionFieldSet::Type & request) +{ + ComplexArgumentParser::Finalize(request.clusterId); + ComplexArgumentParser::Finalize(request.length); + ComplexArgumentParser::Finalize(request.value); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::PowerProfile::Structs::ScheduledPhase::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ScheduledPhase.energyPhaseId", value.isMember("energyPhaseId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ScheduledPhase.scheduledTime", value.isMember("scheduledTime"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "energyPhaseId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.energyPhaseId, value["energyPhaseId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "scheduledTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.scheduledTime, value["scheduledTime"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::PowerProfile::Structs::ScheduledPhase::Type & request) +{ + ComplexArgumentParser::Finalize(request.energyPhaseId); + ComplexArgumentParser::Finalize(request.scheduledTime); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::SecurityPolicy::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SecurityPolicy.rotationTime", value.isMember("rotationTime"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SecurityPolicy.flags", value.isMember("flags"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rotationTime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rotationTime, value["rotationTime"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "flags"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.flags, value["flags"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::SecurityPolicy::Type & request) +{ + ComplexArgumentParser::Finalize(request.rotationTime); + ComplexArgumentParser::Finalize(request.flags); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ModeSelect::Structs::SemanticTag::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SemanticTag.mfgCode", value.isMember("mfgCode"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SemanticTag.value", value.isMember("value"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "mfgCode"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.mfgCode, value["mfgCode"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "value"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.value, value["value"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ModeSelect::Structs::SemanticTag::Type & request) +{ + ComplexArgumentParser::Finalize(request.mfgCode); + ComplexArgumentParser::Finalize(request.value); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.a", value.isMember("a"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.b", value.isMember("b"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.c", value.isMember("c"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.d", value.isMember("d"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.e", value.isMember("e"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.f", value.isMember("f"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.g", value.isMember("g"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SimpleStruct.h", value.isMember("h"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "a"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.a, value["a"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "b"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.b, value["b"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "c"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.c, value["c"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "d"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.d, value["d"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "e"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.e, value["e"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "f"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.f, value["f"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "g"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.g, value["g"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "h"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.h, value["h"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.a); + ComplexArgumentParser::Finalize(request.b); + ComplexArgumentParser::Finalize(request.c); + ComplexArgumentParser::Finalize(request.d); + ComplexArgumentParser::Finalize(request.e); + ComplexArgumentParser::Finalize(request.f); + ComplexArgumentParser::Finalize(request.g); + ComplexArgumentParser::Finalize(request.h); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::SoftwareDiagnostics::Structs::SoftwareFaultStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SoftwareFaultStruct.id", value.isMember("id"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SoftwareFaultStruct.name", value.isMember("name"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("SoftwareFaultStruct.faultRecording", value.isMember("faultRecording"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "id"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.id, value["id"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "faultRecording"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.faultRecording, value["faultRecording"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::SoftwareDiagnostics::Structs::SoftwareFaultStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.id); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.faultRecording); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ContentLauncher::Structs::StyleInformation::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("StyleInformation.imageUrl", value.isMember("imageUrl"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("StyleInformation.color", value.isMember("color"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("StyleInformation.size", value.isMember("size"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "imageUrl"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.imageUrl, value["imageUrl"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "color"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.color, value["color"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "size"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.size, value["size"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentLauncher::Structs::StyleInformation::Type & request) +{ + ComplexArgumentParser::Finalize(request.imageUrl); + ComplexArgumentParser::Finalize(request.color); + ComplexArgumentParser::Finalize(request.size); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::AccessControl::Structs::Target::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Target.cluster", value.isMember("cluster"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Target.endpoint", value.isMember("endpoint"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("Target.deviceType", value.isMember("deviceType"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "cluster"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.cluster, value["cluster"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.deviceType, value["deviceType"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::Target::Type & request) +{ + ComplexArgumentParser::Finalize(request.cluster); + ComplexArgumentParser::Finalize(request.endpoint); + ComplexArgumentParser::Finalize(request.deviceType); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TargetNavigator::Structs::TargetInfo::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TargetInfo.identifier", value.isMember("identifier"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TargetInfo.name", value.isMember("name"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "identifier"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.identifier, value["identifier"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TargetNavigator::Structs::TargetInfo::Type & request) +{ + ComplexArgumentParser::Finalize(request.identifier); + ComplexArgumentParser::Finalize(request.name); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TestCluster::Structs::TestFabricScoped::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TestFabricScoped.fabricIndex", value.isMember("fabricIndex"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::TestFabricScoped::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TestListStructOctet.fabricIndex", value.isMember("fabricIndex"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TestListStructOctet.operationalCert", value.isMember("operationalCert"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "operationalCert"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.operationalCert, value["operationalCert"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.operationalCert); +} +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::NetworkCommissioning::Structs::ThreadInterfaceScanResult::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.panId", value.isMember("panId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.extendedPanId", value.isMember("extendedPanId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.networkName", value.isMember("networkName"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.channel", value.isMember("channel"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.version", value.isMember("version"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.extendedAddress", value.isMember("extendedAddress"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.rssi", value.isMember("rssi"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadInterfaceScanResult.lqi", value.isMember("lqi"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "panId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.panId, value["panId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extendedPanId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.extendedPanId, value["extendedPanId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "networkName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.networkName, value["networkName"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "channel"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.channel, value["channel"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "version"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.version, value["version"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extendedAddress"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.extendedAddress, value["extendedAddress"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rssi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rssi, value["rssi"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "lqi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.lqi, value["lqi"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::NetworkCommissioning::Structs::ThreadInterfaceScanResult::Type & request) +{ + ComplexArgumentParser::Finalize(request.panId); + ComplexArgumentParser::Finalize(request.extendedPanId); + ComplexArgumentParser::Finalize(request.networkName); + ComplexArgumentParser::Finalize(request.channel); + ComplexArgumentParser::Finalize(request.version); + ComplexArgumentParser::Finalize(request.extendedAddress); + ComplexArgumentParser::Finalize(request.rssi); + ComplexArgumentParser::Finalize(request.lqi); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadMetrics.id", value.isMember("id"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadMetrics.name", value.isMember("name"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadMetrics.stackFreeCurrent", value.isMember("stackFreeCurrent"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("ThreadMetrics.stackFreeMinimum", value.isMember("stackFreeMinimum"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadMetrics.stackSize", value.isMember("stackSize"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "id"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.id, value["id"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "stackFreeCurrent"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.stackFreeCurrent, value["stackFreeCurrent"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "stackFreeMinimum"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.stackFreeMinimum, value["stackFreeMinimum"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "stackSize"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.stackSize, value["stackSize"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::Type & request) +{ + ComplexArgumentParser::Finalize(request.id); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.stackFreeCurrent); + ComplexArgumentParser::Finalize(request.stackFreeMinimum); + ComplexArgumentParser::Finalize(request.stackSize); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::PowerProfile::Structs::TransferredPhase::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TransferredPhase.energyPhaseId", value.isMember("energyPhaseId"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TransferredPhase.macroPhaseId", value.isMember("macroPhaseId"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TransferredPhase.expectedDuration", value.isMember("expectedDuration"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TransferredPhase.peakPower", value.isMember("peakPower"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TransferredPhase.energy", value.isMember("energy"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TransferredPhase.maxActivationDelay", value.isMember("maxActivationDelay"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "energyPhaseId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.energyPhaseId, value["energyPhaseId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "macroPhaseId"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.macroPhaseId, value["macroPhaseId"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "expectedDuration"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.expectedDuration, value["expectedDuration"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "peakPower"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.peakPower, value["peakPower"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "energy"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.energy, value["energy"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxActivationDelay"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxActivationDelay, value["maxActivationDelay"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::PowerProfile::Structs::TransferredPhase::Type & request) +{ + ComplexArgumentParser::Finalize(request.energyPhaseId); + ComplexArgumentParser::Finalize(request.macroPhaseId); + ComplexArgumentParser::Finalize(request.expectedDuration); + ComplexArgumentParser::Finalize(request.peakPower); + ComplexArgumentParser::Finalize(request.energy); + ComplexArgumentParser::Finalize(request.maxActivationDelay); +} +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiInterfaceScanResult.security", value.isMember("security"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiInterfaceScanResult.ssid", value.isMember("ssid"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiInterfaceScanResult.bssid", value.isMember("bssid"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiInterfaceScanResult.channel", value.isMember("channel"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiInterfaceScanResult.wiFiBand", value.isMember("wiFiBand"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("WiFiInterfaceScanResult.rssi", value.isMember("rssi"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "security"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.security, value["security"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "ssid"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.ssid, value["ssid"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "bssid"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.bssid, value["bssid"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "channel"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.channel, value["channel"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "wiFiBand"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.wiFiBand, value["wiFiBand"])); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rssi"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rssi, value["rssi"])); + + return CHIP_NO_ERROR; +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type & request) +{ + ComplexArgumentParser::Finalize(request.security); + ComplexArgumentParser::Finalize(request.ssid); + ComplexArgumentParser::Finalize(request.bssid); + ComplexArgumentParser::Finalize(request.channel); + ComplexArgumentParser::Finalize(request.wiFiBand); + ComplexArgumentParser::Finalize(request.rssi); +} diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h new file mode 100644 index 00000000000000..e32f501d990916 --- /dev/null +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -0,0 +1,240 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AccessControl::Structs::AccessControlEntry::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::BridgedActions::Structs::ActionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::BridgedActions::Structs::ActionStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentLauncher::Structs::AdditionalInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ContentLauncher::Structs::AdditionalInfo::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEP::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ApplicationLauncher::Structs::ApplicationLauncherApplication::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfoType::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfoType::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Channel::Structs::ChannelInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Channel::Structs::ChannelInfo::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Descriptor::Structs::DeviceType::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Descriptor::Structs::DeviceType::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentLauncher::Structs::Dimension::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ContentLauncher::Structs::Dimension::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DoorLock::Structs::DlCredential::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::DoorLock::Structs::DlCredential::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::DoubleNestedStructList::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::BridgedActions::Structs::EndpointListStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::BridgedActions::Structs::EndpointListStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AccessControl::Structs::ExtensionEntry::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::GroupKeyManagement::Structs::GroupInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupInfo::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::IasAce::Structs::IasAceZoneStatusResult::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::IasAce::Structs::IasAceZoneStatusResult::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::MediaInput::Structs::InputInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::MediaInput::Structs::InputInfo::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::Channel::Structs::LineupInfo::Type & request, Json::Value & value); + +static void Finalize(chip::app::Clusters::Channel::Structs::LineupInfo::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::OperationalCredentials::Structs::NOCStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::OperationalCredentials::Structs::NOCStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::NestedStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::NestedStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::NestedStructList::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::NestedStructList::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::NetworkCommissioning::Structs::NetworkInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::NetworkCommissioning::Structs::NetworkInfo::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AudioOutput::Structs::OutputInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AudioOutput::Structs::OutputInfo::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentLauncher::Structs::Parameter::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ContentLauncher::Structs::Parameter::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::MediaPlayback::Structs::PlaybackPosition::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::MediaPlayback::Structs::PlaybackPosition::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::PowerProfile::Structs::PowerProfileRecord::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::PowerProfile::Structs::PowerProfileRecord::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Scenes::Structs::SceneExtensionFieldSet::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Scenes::Structs::SceneExtensionFieldSet::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::PowerProfile::Structs::ScheduledPhase::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::PowerProfile::Structs::ScheduledPhase::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ThreadNetworkDiagnostics::Structs::SecurityPolicy::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ThreadNetworkDiagnostics::Structs::SecurityPolicy::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ModeSelect::Structs::SemanticTag::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ModeSelect::Structs::SemanticTag::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::SoftwareDiagnostics::Structs::SoftwareFaultStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::SoftwareDiagnostics::Structs::SoftwareFaultStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentLauncher::Structs::StyleInformation::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ContentLauncher::Structs::StyleInformation::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AccessControl::Structs::Target::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AccessControl::Structs::Target::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TargetNavigator::Structs::TargetInfo::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TargetNavigator::Structs::TargetInfo::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::TestFabricScoped::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::TestFabricScoped::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TestCluster::Structs::TestListStructOctet::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::NetworkCommissioning::Structs::ThreadInterfaceScanResult::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::NetworkCommissioning::Structs::ThreadInterfaceScanResult::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::PowerProfile::Structs::TransferredPhase::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::PowerProfile::Structs::TransferredPhase::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::NetworkCommissioning::Structs::WiFiInterfaceScanResult::Type & request);