From 10749168f5dc43a3a907896ea7db98f30e5a3086 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Wed, 9 Feb 2022 23:07:01 +0100 Subject: [PATCH] Update TV SDK, mac address bug addressed and synced content launch xml files per spec. (#14961) * Update XML files to match the spec & Tests * Run zap regen script * Update code * Restyle fix --- .../android/java/ContentLauncherManager.cpp | 5 +- .../android/java/ContentLauncherManager.h | 10 +- examples/tv-app/linux/BUILD.gn | 19 +++ .../linux/include/channel/ChannelManager.cpp | 22 +-- .../ContentLauncherManager.cpp | 10 +- .../content-launcher/ContentLauncherManager.h | 9 +- .../TargetNavigatorManager.cpp | 4 +- .../include/wake-on-lan/WakeOnLanManager.cpp | 15 ++ examples/tv-app/tv-common/tv-app.matter | 2 +- .../tv-casting-common/tv-casting-app.matter | 2 +- .../content-launch-delegate.h | 8 +- .../content-launch-server.cpp | 21 ++- .../suites/TV_ContentLauncherCluster.yaml | 12 +- .../chip/content-launch-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../java/zap-generated/CHIPClusters-JNI.cpp | 144 +++++++----------- .../chip/devicecontroller/ChipClusters.java | 6 +- .../devicecontroller/ClusterInfoMapping.java | 2 +- .../python/chip/clusters/Objects.py | 4 +- .../CHIP/zap-generated/CHIPClustersObjc.mm | 91 +++++------ .../zap-generated/CHIPCommandPayloadsObjc.h | 2 +- .../zap-generated/CHIPCommandPayloadsObjc.mm | 2 +- .../zap-generated/cluster-objects.h | 4 +- .../zap-generated/cluster/Commands.h | 3 +- .../chip-tool/zap-generated/test/Commands.h | 16 +- 25 files changed, 214 insertions(+), 203 deletions(-) diff --git a/examples/tv-app/android/java/ContentLauncherManager.cpp b/examples/tv-app/android/java/ContentLauncherManager.cpp index 3537e723195f47..219cac94f5b47e 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -27,6 +27,7 @@ using namespace std; using namespace chip; +using namespace chip::app::DataModel; using namespace chip::app::Clusters::ContentLauncher; void emberAfContentLauncherClusterInitCallback(EndpointId endpoint) @@ -44,7 +45,7 @@ void ContentLauncherManager::NewManager(jint endpoint, jobject manager) } void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper & helper, - const std::list & parameterList, bool autoplay, + const DecodableList & parameterList, bool autoplay, const chip::CharSpan & data) { Commands::LaunchResponse::Type response; @@ -99,7 +100,7 @@ void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper & helper, const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - const std::list & brandingInformation) + const BrandingInformationType & brandingInformation) { Commands::LaunchResponse::Type response; CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/examples/tv-app/android/java/ContentLauncherManager.h b/examples/tv-app/android/java/ContentLauncherManager.h index 2c942e1b2911b0..a034afddf86fce 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.h +++ b/examples/tv-app/android/java/ContentLauncherManager.h @@ -24,13 +24,14 @@ #include #include #include -#include using chip::CharSpan; using chip::app::AttributeValueEncoder; using chip::app::CommandResponseHelper; using ContentLauncherDelegate = chip::app::Clusters::ContentLauncher::Delegate; using LaunchResponseType = chip::app::Clusters::ContentLauncher::Commands::LaunchResponse::Type; +using ParameterType = chip::app::Clusters::ContentLauncher::Structs::Parameter::DecodableType; +using BrandingInformationType = chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type; class ContentLauncherManager : public ContentLauncherDelegate { @@ -38,10 +39,11 @@ class ContentLauncherManager : public ContentLauncherDelegate static void NewManager(jint endpoint, jobject manager); void InitializeWithObjects(jobject managerObject); - void HandleLaunchContent(CommandResponseHelper & helper, const std::list & parameterList, - bool autoplay, const CharSpan & data) override; + void HandleLaunchContent(CommandResponseHelper & helper, + const chip::app::DataModel::DecodableList & parameterList, bool autoplay, + const CharSpan & data) override; void HandleLaunchUrl(CommandResponseHelper & helper, const CharSpan & contentUrl, - const CharSpan & displayString, const std::list & brandingInformation) override; + const CharSpan & displayString, const BrandingInformationType & brandingInformation) override; CHIP_ERROR HandleGetAcceptHeaderList(AttributeValueEncoder & aEncoder) override; uint32_t HandleGetSupportedStreamingProtocols() override; diff --git a/examples/tv-app/linux/BUILD.gn b/examples/tv-app/linux/BUILD.gn index bbdaa76c154c84..58c0a2773f2350 100644 --- a/examples/tv-app/linux/BUILD.gn +++ b/examples/tv-app/linux/BUILD.gn @@ -20,6 +20,23 @@ import("${chip_root}/build/chip/tools.gni") assert(chip_build_tools) +declare_args() { + # Enable Wake on LAN cluster + chip_enable_wake_on_lan = false +} + +config("config") { + include_dirs = [ + ".", + "${chip_root}/zzz_generated/chip-tv-app", + "${chip_root}/src/lib", + ] + + defines = [ "CHIP_ENABLE_WAKE_ON_LAN=${chip_enable_wake_on_lan}" ] + + cflags = [ "-Wconversion" ] +} + executable("chip-tv-app") { sources = [ "${chip_root}/examples/tv-app/tv-common/include/CHIPProjectAppConfig.h", @@ -66,6 +83,8 @@ executable("chip-tv-app") { cflags = [ "-Wconversion" ] + public_configs = [ ":config" ] + if (chip_build_libshell) { cflags += [ "-DENABLE_CHIP_SHELL" ] } diff --git a/examples/tv-app/linux/include/channel/ChannelManager.cpp b/examples/tv-app/linux/include/channel/ChannelManager.cpp index 66e5d4a972b8a1..3c743987ab3380 100644 --- a/examples/tv-app/linux/include/channel/ChannelManager.cpp +++ b/examples/tv-app/linux/include/channel/ChannelManager.cpp @@ -30,9 +30,9 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder for (int i = 0; i < maximumVectorSize; ++i) { chip::app::Clusters::Channel::Structs::ChannelInfo::Type channelInfo; - channelInfo.affiliateCallSign = Optional(chip::CharSpan::fromCharString("exampleASign")); - channelInfo.callSign = Optional(chip::CharSpan::fromCharString("exampleCSign")); - channelInfo.name = Optional(chip::CharSpan::fromCharString("exampleName")); + channelInfo.affiliateCallSign = MakeOptional(chip::CharSpan::fromCharString("exampleASign")); + channelInfo.callSign = MakeOptional(chip::CharSpan::fromCharString("exampleCSign")); + channelInfo.name = MakeOptional(chip::CharSpan::fromCharString("exampleName")); channelInfo.majorNumber = static_cast(1 + i); channelInfo.minorNumber = static_cast(2 + i); @@ -47,8 +47,8 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder) { chip::app::Clusters::Channel::Structs::LineupInfo::Type lineup; lineup.operatorName = chip::CharSpan::fromCharString("operatorName"); - lineup.lineupName = Optional(chip::CharSpan::fromCharString("lineupName")); - lineup.postalCode = Optional(chip::CharSpan::fromCharString("postalCode")); + lineup.lineupName = MakeOptional(chip::CharSpan::fromCharString("lineupName")); + lineup.postalCode = MakeOptional(chip::CharSpan::fromCharString("postalCode")); lineup.lineupInfoType = chip::app::Clusters::Channel::LineupInfoTypeEnum::kMso; return aEncoder.Encode(lineup); @@ -57,9 +57,9 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder) CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEncoder) { chip::app::Clusters::Channel::Structs::ChannelInfo::Type currentChannel; - currentChannel.affiliateCallSign = Optional(chip::CharSpan::fromCharString("exampleASign")); - currentChannel.callSign = Optional(chip::CharSpan::fromCharString("exampleCSign")); - currentChannel.name = Optional(chip::CharSpan::fromCharString("exampleName")); + currentChannel.affiliateCallSign = MakeOptional(chip::CharSpan::fromCharString("exampleASign")); + currentChannel.callSign = MakeOptional(chip::CharSpan::fromCharString("exampleCSign")); + currentChannel.name = MakeOptional(chip::CharSpan::fromCharString("exampleName")); currentChannel.majorNumber = 1; currentChannel.minorNumber = 0; @@ -71,9 +71,9 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper(chip::CharSpan::fromCharString("name")); - response.channelMatch.callSign = Optional(chip::CharSpan::fromCharString("callSign")); - response.channelMatch.affiliateCallSign = Optional(chip::CharSpan::fromCharString("affiliateCallSign")); + response.channelMatch.name = MakeOptional(chip::CharSpan::fromCharString("name")); + response.channelMatch.callSign = MakeOptional(chip::CharSpan::fromCharString("callSign")); + response.channelMatch.affiliateCallSign = MakeOptional(chip::CharSpan::fromCharString("affiliateCallSign")); response.errorType = chip::app::Clusters::Channel::ErrorTypeEnum::kMultipleMatches; helper.Success(response); diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp index 82b3b76b6fc7df..8c6abf7418ad4f 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp @@ -21,6 +21,7 @@ using namespace std; using namespace chip::app; using namespace chip::app::Clusters; +using namespace chip::app::DataModel; using namespace chip::app::Clusters::ContentLauncher; ContentLauncherManager::ContentLauncherManager(list acceptHeaderList, uint32_t supportedStreamingProtocols) @@ -30,20 +31,21 @@ ContentLauncherManager::ContentLauncherManager(list acceptHeaderLis } void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper & helper, - const list & parameterList, bool autoplay, const CharSpan & data) + const DecodableList & parameterList, bool autoplay, + const CharSpan & data) { ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchContent for endpoint %d", mEndpointId); string dataString(data.data(), data.size()); LaunchResponseType response; // TODO: Insert code here - response.data = chip::Optional(CharSpan::fromCharString("exampleData")); + response.data = chip::MakeOptional(CharSpan::fromCharString("exampleData")); response.status = ContentLauncher::StatusEnum::kSuccess; helper.Success(response); } void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelper & helper, const CharSpan & contentUrl, - const CharSpan & displayString, const list & brandingInformation) + const CharSpan & displayString, const BrandingInformationType & brandingInformation) { ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchUrl"); @@ -52,7 +54,7 @@ void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelper(CharSpan::fromCharString("exampleData")); + response.data = chip::MakeOptional(CharSpan::fromCharString("exampleData")); response.status = ContentLauncher::StatusEnum::kSuccess; helper.Success(response); } diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h index c8389c6074f193..0ed3f40038871f 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h @@ -26,6 +26,8 @@ using chip::app::AttributeValueEncoder; using chip::app::CommandResponseHelper; using ContentLauncherDelegate = chip::app::Clusters::ContentLauncher::Delegate; using LaunchResponseType = chip::app::Clusters::ContentLauncher::Commands::LaunchResponse::Type; +using ParameterType = chip::app::Clusters::ContentLauncher::Structs::Parameter::DecodableType; +using BrandingInformationType = chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type; class ContentLauncherManager : public ContentLauncherDelegate { @@ -33,10 +35,11 @@ class ContentLauncherManager : public ContentLauncherDelegate ContentLauncherManager() : ContentLauncherManager({ "example", "example" }, 0){}; ContentLauncherManager(std::list acceptHeaderList, uint32_t supportedStreamingProtocols); - void HandleLaunchContent(CommandResponseHelper & helper, const std::list & parameterList, - bool autoplay, const CharSpan & data) override; + void HandleLaunchContent(CommandResponseHelper & helper, + const chip::app::DataModel::DecodableList & parameterList, bool autoplay, + const CharSpan & data) override; void HandleLaunchUrl(CommandResponseHelper & helper, const CharSpan & contentUrl, - const CharSpan & displayString, const std::list & brandingInformation) override; + const CharSpan & displayString, const BrandingInformationType & brandingInformation) override; CHIP_ERROR HandleGetAcceptHeaderList(AttributeValueEncoder & aEncoder) override; uint32_t HandleGetSupportedStreamingProtocols() override; diff --git a/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp b/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp index a3236c7228ddfe..d0ae459e56fc07 100644 --- a/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp +++ b/examples/tv-app/linux/include/target-navigator/TargetNavigatorManager.cpp @@ -55,14 +55,14 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper mTargets.size()) { - response.data = chip::Optional(CharSpan::fromCharString("error")); + response.data = chip::MakeOptional(CharSpan::fromCharString("error")); response.status = StatusEnum::kTargetNotFound; helper.Success(response); return; } mCurrentTarget = static_cast(target); - response.data = chip::Optional(CharSpan::fromCharString("data response")); + response.data = chip::MakeOptional(CharSpan::fromCharString("data response")); response.status = StatusEnum::kSuccess; helper.Success(response); } diff --git a/examples/tv-app/linux/include/wake-on-lan/WakeOnLanManager.cpp b/examples/tv-app/linux/include/wake-on-lan/WakeOnLanManager.cpp index 84c2accd25ff17..1f50d300edfa16 100644 --- a/examples/tv-app/linux/include/wake-on-lan/WakeOnLanManager.cpp +++ b/examples/tv-app/linux/include/wake-on-lan/WakeOnLanManager.cpp @@ -17,11 +17,26 @@ */ #include "WakeOnLanManager.h" +#include +#include +#include using namespace chip; using namespace chip::app::Clusters::WakeOnLan; +std::string getMacAddress() +{ + std::ifstream input("/sys/class/net/eth0/address"); + std::string line; + std::getline(input, line); + return line; +} + CHIP_ERROR WakeOnLanManager::HandleGetMacAddress(chip::app::AttributeValueEncoder & aEncoder) { +#if CHIP_ENABLE_WAKE_ON_LAN + return aEncoder.Encode(CharSpan::fromCharString(getMacAddress().c_str())); +#else return aEncoder.Encode(CharSpan::fromCharString("00:00:00:00:00")); +#endif // CHIP_ENABLE_WAKE_ON_LAN } diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index a7a071df4d6097..d3c11fe959eff7 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -450,7 +450,7 @@ server cluster ContentLauncher = 1290 { readonly global attribute int16u clusterRevision = 65533; request struct LaunchContentRequestRequest { - ContentSearch search[] = 0; + ContentSearch search = 0; BOOLEAN autoPlay = 1; optional CHAR_STRING data = 2; } diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index d244ec49ccf8ab..475aa6ba2e3e2e 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -692,7 +692,7 @@ client cluster ContentLauncher = 1290 { readonly global attribute int16u clusterRevision = 65533; request struct LaunchContentRequestRequest { - ContentSearch search[] = 0; + ContentSearch search = 0; BOOLEAN autoPlay = 1; optional CHAR_STRING data = 2; } diff --git a/src/app/clusters/content-launch-server/content-launch-delegate.h b/src/app/clusters/content-launch-server/content-launch-delegate.h index a8b6e955344dfb..5fb6e02e5450e3 100644 --- a/src/app/clusters/content-launch-server/content-launch-delegate.h +++ b/src/app/clusters/content-launch-server/content-launch-delegate.h @@ -31,6 +31,9 @@ namespace app { namespace Clusters { namespace ContentLauncher { +using BrandingInformation = chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type; +using Parameter = chip::app::Clusters::ContentLauncher::Structs::Parameter::DecodableType; + /** @brief * Defines methods for implementing application-specific logic for the Content Launcher Cluster. */ @@ -38,10 +41,11 @@ class Delegate { public: virtual void HandleLaunchContent(CommandResponseHelper & helper, - const std::list & parameterList, bool autoplay, const CharSpan & data) = 0; + const DataModel::DecodableList & parameterList, bool autoplay, + const CharSpan & data) = 0; virtual void HandleLaunchUrl(CommandResponseHelper & helper, const CharSpan & contentUrl, - const CharSpan & displayString, const std::list & brandingInformation) = 0; + const CharSpan & displayString, const BrandingInformation & brandingInformation) = 0; virtual CHIP_ERROR HandleGetAcceptHeaderList(app::AttributeValueEncoder & aEncoder) = 0; diff --git a/src/app/clusters/content-launch-server/content-launch-server.cpp b/src/app/clusters/content-launch-server/content-launch-server.cpp index 62efa5d61834c5..73e529f77dc1af 100644 --- a/src/app/clusters/content-launch-server/content-launch-server.cpp +++ b/src/app/clusters/content-launch-server/content-launch-server.cpp @@ -193,18 +193,16 @@ bool emberAfContentLauncherClusterLaunchContentRequestCallback( CHIP_ERROR err = CHIP_NO_ERROR; EndpointId endpoint = commandPath.mEndpointId; - auto & autoplay = commandData.autoPlay; - auto & data = commandData.data; - // TODO: Decode the parameter and pass it to delegate - // auto searchIterator = commandData.search.begin(); - std::list parameterList; + auto & autoplay = commandData.autoPlay; + auto & data = commandData.data; + auto & decodableParameterList = commandData.search.parameterList; app::CommandResponseHelper responder(commandObj, commandPath); Delegate * delegate = GetDelegate(endpoint); VerifyOrExit(isDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); { - delegate->HandleLaunchContent(responder, parameterList, autoplay, data.HasValue() ? data.Value() : CharSpan()); + delegate->HandleLaunchContent(responder, decodableParameterList, autoplay, data.HasValue() ? data.Value() : CharSpan()); } exit: @@ -229,11 +227,9 @@ bool emberAfContentLauncherClusterLaunchURLRequestCallback( CHIP_ERROR err = CHIP_NO_ERROR; EndpointId endpoint = commandPath.mEndpointId; - auto & contentUrl = commandData.contentURL; - auto & displayString = commandData.displayString; - // TODO: Decode the parameter and pass it to delegate - // auto brandingInformationIterator = commandData.brandingInformation.begin(); - std::list brandingInformationList; + auto & contentUrl = commandData.contentURL; + auto & displayString = commandData.displayString; + auto & brandingInformation = commandData.brandingInformation; app::CommandResponseHelper responder(commandObj, commandPath); @@ -241,7 +237,8 @@ bool emberAfContentLauncherClusterLaunchURLRequestCallback( VerifyOrExit(isDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); { delegate->HandleLaunchUrl(responder, contentUrl, displayString.HasValue() ? displayString.Value() : CharSpan(), - brandingInformationList); + brandingInformation.HasValue() ? brandingInformation.Value() + : chip::app::Clusters::ContentLauncher::BrandingInformation()); } exit: diff --git a/src/app/tests/suites/TV_ContentLauncherCluster.yaml b/src/app/tests/suites/TV_ContentLauncherCluster.yaml index 26c9eff68d165b..773c3998aee0a5 100644 --- a/src/app/tests/suites/TV_ContentLauncherCluster.yaml +++ b/src/app/tests/suites/TV_ContentLauncherCluster.yaml @@ -46,9 +46,15 @@ tests: - name: "search" value: { - type: 1, - value: "exampleValue", - externalIDList: [{ name: "name", value: "value" }], + parameterList: + [ + { + type: 1, + value: "exampleValue", + externalIDList: + [{ name: "name", value: "value" }], + }, + ], } response: values: diff --git a/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml index 69b5f117abbcfb..5c332185e119ac 100644 --- a/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml @@ -31,7 +31,7 @@ limitations under the License. Upon receipt, this SHALL launch the specified content with optional search criteria. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index fd543624842f09..cff8148d004dff 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -981,7 +981,7 @@ client cluster ContentLauncher = 1290 { readonly global attribute int16u clusterRevision = 65533; request struct LaunchContentRequestRequest { - ContentSearch search[] = 0; + ContentSearch search = 0; BOOLEAN autoPlay = 1; optional CHAR_STRING data = 2; } diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index a730e1b9f13372..5a6d8b10345af0 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -9469,108 +9469,80 @@ JNI_METHOD(void, ContentLauncherCluster, launchContentRequest) std::vector> cleanupByteArrays; std::vector> cleanupStrings; + jobject search_parameterListItem_0; + chip::JniReferences::GetInstance().GetObjectField(search, "parameterList", "Ljava/util/ArrayList;", search_parameterListItem_0); { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - jint searchSize; - chip::JniReferences::GetInstance().GetArrayListSize(search, searchSize); - if (searchSize != 0) + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + jint search_parameterListItem_0Size; + chip::JniReferences::GetInstance().GetArrayListSize(search_parameterListItem_0, search_parameterListItem_0Size); + if (search_parameterListItem_0Size != 0) { - auto * listHolder_0 = new ListHolder(searchSize); - listFreer.add(listHolder_0); + auto * listHolder_1 = new ListHolder(search_parameterListItem_0Size); + listFreer.add(listHolder_1); - for (size_t i_0 = 0; i_0 < static_cast(searchSize); ++i_0) + for (size_t i_1 = 0; i_1 < static_cast(search_parameterListItem_0Size); ++i_1) { - jobject element_0; - chip::JniReferences::GetInstance().GetArrayListItem(search, i_0, element_0); - jobject element_0_parameterListItem_1; - chip::JniReferences::GetInstance().GetObjectField(element_0, "parameterList", "Ljava/util/ArrayList;", - element_0_parameterListItem_1); + jobject element_1; + chip::JniReferences::GetInstance().GetArrayListItem(search_parameterListItem_0, i_1, element_1); + jobject element_1_typeItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "type", "Ljava/lang/Integer;", element_1_typeItem_2); + listHolder_1->mList[i_1].type = static_castmList[i_1].type)>>( + chip::JniReferences::GetInstance().IntegerToPrimitive(element_1_typeItem_2)); + jobject element_1_valueItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "value", "Ljava/lang/String;", element_1_valueItem_2); + cleanupStrings.push_back( + chip::Platform::MakeUnique(env, static_cast(element_1_valueItem_2))); + listHolder_1->mList[i_1].value = cleanupStrings.back()->charSpan(); + jobject element_1_externalIDListItem_2; + chip::JniReferences::GetInstance().GetObjectField(element_1, "externalIDList", "Ljava/util/Optional;", + element_1_externalIDListItem_2); + if (element_1_externalIDListItem_2 != nullptr) { - using ListType_2 = std::remove_reference_tmList[i_0].parameterList)>; - using ListMemberType_2 = ListMemberTypeGetter::Type; - jint element_0_parameterListItem_1Size; - chip::JniReferences::GetInstance().GetArrayListSize(element_0_parameterListItem_1, - element_0_parameterListItem_1Size); - if (element_0_parameterListItem_1Size != 0) + jobject optionalValue_3; + chip::JniReferences::GetInstance().GetOptionalValue(element_1_externalIDListItem_2, optionalValue_3); + auto & definedValue_3 = listHolder_1->mList[i_1].externalIDList.Emplace(); { - auto * listHolder_2 = new ListHolder(element_0_parameterListItem_1Size); - listFreer.add(listHolder_2); - - for (size_t i_2 = 0; i_2 < static_cast(element_0_parameterListItem_1Size); ++i_2) + using ListType_4 = std::remove_reference_t; + using ListMemberType_4 = ListMemberTypeGetter::Type; + jint optionalValue_3Size; + chip::JniReferences::GetInstance().GetArrayListSize(optionalValue_3, optionalValue_3Size); + if (optionalValue_3Size != 0) { - jobject element_2; - chip::JniReferences::GetInstance().GetArrayListItem(element_0_parameterListItem_1, i_2, element_2); - jobject element_2_typeItem_3; - chip::JniReferences::GetInstance().GetObjectField(element_2, "type", "Ljava/lang/Integer;", - element_2_typeItem_3); - listHolder_2->mList[i_2].type = - static_castmList[i_2].type)>>( - chip::JniReferences::GetInstance().IntegerToPrimitive(element_2_typeItem_3)); - jobject element_2_valueItem_3; - chip::JniReferences::GetInstance().GetObjectField(element_2, "value", "Ljava/lang/String;", - element_2_valueItem_3); - cleanupStrings.push_back( - chip::Platform::MakeUnique(env, static_cast(element_2_valueItem_3))); - listHolder_2->mList[i_2].value = cleanupStrings.back()->charSpan(); - jobject element_2_externalIDListItem_3; - chip::JniReferences::GetInstance().GetObjectField(element_2, "externalIDList", "Ljava/util/Optional;", - element_2_externalIDListItem_3); - if (element_2_externalIDListItem_3 != nullptr) + auto * listHolder_4 = new ListHolder(optionalValue_3Size); + listFreer.add(listHolder_4); + + for (size_t i_4 = 0; i_4 < static_cast(optionalValue_3Size); ++i_4) { - jobject optionalValue_4; - chip::JniReferences::GetInstance().GetOptionalValue(element_2_externalIDListItem_3, - optionalValue_4); - auto & definedValue_4 = listHolder_2->mList[i_2].externalIDList.Emplace(); - { - using ListType_5 = std::remove_reference_t; - using ListMemberType_5 = ListMemberTypeGetter::Type; - jint optionalValue_4Size; - chip::JniReferences::GetInstance().GetArrayListSize(optionalValue_4, optionalValue_4Size); - if (optionalValue_4Size != 0) - { - auto * listHolder_5 = new ListHolder(optionalValue_4Size); - listFreer.add(listHolder_5); - - for (size_t i_5 = 0; i_5 < static_cast(optionalValue_4Size); ++i_5) - { - jobject element_5; - chip::JniReferences::GetInstance().GetArrayListItem(optionalValue_4, i_5, element_5); - jobject element_5_nameItem_6; - chip::JniReferences::GetInstance().GetObjectField( - element_5, "name", "Ljava/lang/String;", element_5_nameItem_6); - cleanupStrings.push_back(chip::Platform::MakeUnique( - env, static_cast(element_5_nameItem_6))); - listHolder_5->mList[i_5].name = cleanupStrings.back()->charSpan(); - jobject element_5_valueItem_6; - chip::JniReferences::GetInstance().GetObjectField( - element_5, "value", "Ljava/lang/String;", element_5_valueItem_6); - cleanupStrings.push_back(chip::Platform::MakeUnique( - env, static_cast(element_5_valueItem_6))); - listHolder_5->mList[i_5].value = cleanupStrings.back()->charSpan(); - } - definedValue_4 = ListType_5(listHolder_5->mList, optionalValue_4Size); - } - else - { - definedValue_4 = ListType_5(); - } - } + jobject element_4; + chip::JniReferences::GetInstance().GetArrayListItem(optionalValue_3, i_4, element_4); + jobject element_4_nameItem_5; + chip::JniReferences::GetInstance().GetObjectField(element_4, "name", "Ljava/lang/String;", + element_4_nameItem_5); + cleanupStrings.push_back(chip::Platform::MakeUnique( + env, static_cast(element_4_nameItem_5))); + listHolder_4->mList[i_4].name = cleanupStrings.back()->charSpan(); + jobject element_4_valueItem_5; + chip::JniReferences::GetInstance().GetObjectField(element_4, "value", "Ljava/lang/String;", + element_4_valueItem_5); + cleanupStrings.push_back(chip::Platform::MakeUnique( + env, static_cast(element_4_valueItem_5))); + listHolder_4->mList[i_4].value = cleanupStrings.back()->charSpan(); } + definedValue_3 = ListType_4(listHolder_4->mList, optionalValue_3Size); + } + else + { + definedValue_3 = ListType_4(); } - listHolder_0->mList[i_0].parameterList = ListType_2(listHolder_2->mList, element_0_parameterListItem_1Size); - } - else - { - listHolder_0->mList[i_0].parameterList = ListType_2(); } } } - request.search = ListType_0(listHolder_0->mList, searchSize); + request.search.parameterList = ListType_1(listHolder_1->mList, search_parameterListItem_0Size); } else { - request.search = ListType_0(); + request.search.parameterList = ListType_1(); } } request.autoPlay = static_cast>( diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 6a98c3f05e9a38..1360fb32c69f8d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -5359,7 +5359,7 @@ public ContentLauncherCluster(long devicePtr, int endpointId) { public void launchContentRequest( LaunchResponseCallback callback, - ArrayList search, + ChipStructs.ContentLauncherClusterContentSearch search, Boolean autoPlay, Optional data) { launchContentRequest(chipClusterPtr, callback, search, autoPlay, data, null); @@ -5367,7 +5367,7 @@ public void launchContentRequest( public void launchContentRequest( LaunchResponseCallback callback, - ArrayList search, + ChipStructs.ContentLauncherClusterContentSearch search, Boolean autoPlay, Optional data, int timedInvokeTimeoutMs) { @@ -5401,7 +5401,7 @@ public void launchURLRequest( private native void launchContentRequest( long chipClusterPtr, LaunchResponseCallback Callback, - ArrayList search, + ChipStructs.ContentLauncherClusterContentSearch search, Boolean autoPlay, Optional data, @Nullable Integer timedInvokeTimeoutMs); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index f2fa8b50cb12c7..51a4cd9294a840 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -9020,7 +9020,7 @@ public Map> getCommandMap() { ((ChipClusters.ContentLauncherCluster) cluster) .launchContentRequest( (ChipClusters.ContentLauncherCluster.LaunchResponseCallback) callback, - (ArrayList) + (ChipStructs.ContentLauncherClusterContentSearch) commandArguments.get("search"), (Boolean) commandArguments.get("autoPlay"), (Optional) commandArguments.get("data")); diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 4d636baef8bb19..e1880bec70f623 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -32939,12 +32939,12 @@ class LaunchContentRequest(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="search", Tag=0, Type=typing.List[ContentLauncher.Structs.ContentSearch]), + ClusterObjectFieldDescriptor(Label="search", Tag=0, Type=ContentLauncher.Structs.ContentSearch), ClusterObjectFieldDescriptor(Label="autoPlay", Tag=1, Type=bool), ClusterObjectFieldDescriptor(Label="data", Tag=2, Type=typing.Optional[str]), ]) - search: 'typing.List[ContentLauncher.Structs.ContentSearch]' = field(default_factory=lambda: []) + search: 'ContentLauncher.Structs.ContentSearch' = field(default_factory=lambda: ContentLauncher.Structs.ContentSearch()) autoPlay: 'bool' = False data: 'typing.Optional[str]' = None diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 9e5de196191128..f6cabdf3ba1f39 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -6960,77 +6960,54 @@ - (void)launchContentRequestWithParams:(CHIPContentLauncherClusterLaunchContentR ListFreer listFreer; ContentLauncher::Commands::LaunchContentRequest::Type request; { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (params.search.count != 0) { - auto * listHolder_0 = new ListHolder(params.search.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + using ListType_1 = std::remove_reference_t; + using ListMemberType_1 = ListMemberTypeGetter::Type; + if (params.search.parameterList.count != 0) { + auto * listHolder_1 = new ListHolder(params.search.parameterList.count); + if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { return; } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < params.search.count; ++i_0) { - if (![params.search[i_0] isKindOfClass:[CHIPContentLauncherClusterContentSearch class]]) { + listFreer.add(listHolder_1); + for (size_t i_1 = 0; i_1 < params.search.parameterList.count; ++i_1) { + if (![params.search.parameterList[i_1] isKindOfClass:[CHIPContentLauncherClusterParameter class]]) { // Wrong kind of value. return; } - auto element_0 = (CHIPContentLauncherClusterContentSearch *) params.search[i_0]; - { - using ListType_2 = std::remove_reference_tmList[i_0].parameterList)>; - using ListMemberType_2 = ListMemberTypeGetter::Type; - if (element_0.parameterList.count != 0) { - auto * listHolder_2 = new ListHolder(element_0.parameterList.count); - if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { - return; - } - listFreer.add(listHolder_2); - for (size_t i_2 = 0; i_2 < element_0.parameterList.count; ++i_2) { - if (![element_0.parameterList[i_2] isKindOfClass:[CHIPContentLauncherClusterParameter class]]) { - // Wrong kind of value. + auto element_1 = (CHIPContentLauncherClusterParameter *) params.search.parameterList[i_1]; + listHolder_1->mList[i_1].type = static_castmList[i_1].type)>>( + element_1.type.unsignedCharValue); + listHolder_1->mList[i_1].value = [self asCharSpan:element_1.value]; + if (element_1.externalIDList != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].externalIDList.Emplace(); + { + using ListType_4 = std::remove_reference_t; + using ListMemberType_4 = ListMemberTypeGetter::Type; + if (element_1.externalIDList.count != 0) { + auto * listHolder_4 = new ListHolder(element_1.externalIDList.count); + if (listHolder_4 == nullptr || listHolder_4->mList == nullptr) { return; } - auto element_2 = (CHIPContentLauncherClusterParameter *) element_0.parameterList[i_2]; - listHolder_2->mList[i_2].type - = static_castmList[i_2].type)>>( - element_2.type.unsignedCharValue); - listHolder_2->mList[i_2].value = [self asCharSpan:element_2.value]; - if (element_2.externalIDList != nil) { - auto & definedValue_4 = listHolder_2->mList[i_2].externalIDList.Emplace(); - { - using ListType_5 = std::remove_reference_t; - using ListMemberType_5 = ListMemberTypeGetter::Type; - if (element_2.externalIDList.count != 0) { - auto * listHolder_5 = new ListHolder(element_2.externalIDList.count); - if (listHolder_5 == nullptr || listHolder_5->mList == nullptr) { - return; - } - listFreer.add(listHolder_5); - for (size_t i_5 = 0; i_5 < element_2.externalIDList.count; ++i_5) { - if (![element_2.externalIDList[i_5] - isKindOfClass:[CHIPContentLauncherClusterAdditionalInfo class]]) { - // Wrong kind of value. - return; - } - auto element_5 - = (CHIPContentLauncherClusterAdditionalInfo *) element_2.externalIDList[i_5]; - listHolder_5->mList[i_5].name = [self asCharSpan:element_5.name]; - listHolder_5->mList[i_5].value = [self asCharSpan:element_5.value]; - } - definedValue_4 = ListType_5(listHolder_5->mList, element_2.externalIDList.count); - } else { - definedValue_4 = ListType_5(); - } + listFreer.add(listHolder_4); + for (size_t i_4 = 0; i_4 < element_1.externalIDList.count; ++i_4) { + if (![element_1.externalIDList[i_4] + isKindOfClass:[CHIPContentLauncherClusterAdditionalInfo class]]) { + // Wrong kind of value. + return; } + auto element_4 = (CHIPContentLauncherClusterAdditionalInfo *) element_1.externalIDList[i_4]; + listHolder_4->mList[i_4].name = [self asCharSpan:element_4.name]; + listHolder_4->mList[i_4].value = [self asCharSpan:element_4.value]; } + definedValue_3 = ListType_4(listHolder_4->mList, element_1.externalIDList.count); + } else { + definedValue_3 = ListType_4(); } - listHolder_0->mList[i_0].parameterList = ListType_2(listHolder_2->mList, element_0.parameterList.count); - } else { - listHolder_0->mList[i_0].parameterList = ListType_2(); } } } - request.search = ListType_0(listHolder_0->mList, params.search.count); + request.search.parameterList = ListType_1(listHolder_1->mList, params.search.parameterList.count); } else { - request.search = ListType_0(); + request.search.parameterList = ListType_1(); } } request.autoPlay = params.autoPlay.boolValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h index 4cbc92e9fafaa6..d5cff9c967ce6b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h @@ -1611,7 +1611,7 @@ NS_ASSUME_NONNULL_BEGIN @end @interface CHIPContentLauncherClusterLaunchContentRequestParams : NSObject -@property (strong, nonatomic) NSArray * _Nonnull search; +@property (strong, nonatomic) CHIPContentLauncherClusterContentSearch * _Nonnull search; @property (strong, nonatomic) NSNumber * _Nonnull autoPlay; @property (strong, nonatomic) NSString * _Nullable data; - (instancetype)init; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm index d06f5a330af113..71e4cc1bc5bb94 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm @@ -3428,7 +3428,7 @@ - (instancetype)init { if (self = [super init]) { - _search = [NSArray array]; + _search = [CHIPContentLauncherClusterContentSearch new]; _autoPlay = @(0); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index cf7947920d7c18..a4a4899e40bae4 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -35545,7 +35545,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::LaunchContentRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ContentLauncher::Id; } - DataModel::List search; + Structs::ContentSearch::Type search; bool autoPlay = static_cast(0); Optional data; @@ -35562,7 +35562,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::LaunchContentRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ContentLauncher::Id; } - DataModel::DecodableList search; + Structs::ContentSearch::DecodableType search; bool autoPlay = static_cast(0); Optional data; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 62d2a8a4c05a1c..aa41cd903d29bd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -2265,8 +2265,7 @@ class ContentLauncherLaunchContentRequest : public ClusterCommand private: chip::app::Clusters::ContentLauncher::Commands::LaunchContentRequest::Type mRequest; - TypedComplexArgument> - mComplex_Search; + TypedComplexArgument mComplex_Search; }; /* diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index b92b3fa4105471..2592a21de6dab2 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -51134,7 +51134,21 @@ class TV_ContentLauncherCluster : public TestCommand RequestType request; - request.search = chip::app::DataModel::List(); + chip::app::Clusters::ContentLauncher::Structs::Parameter::Type parameterListList_1[1]; + + parameterListList_1[0].type = static_cast(1); + parameterListList_1[0].value = chip::Span("exampleValuegarbage: not in length on purpose", 12); + parameterListList_1[0].externalIDList.Emplace(); + + chip::app::Clusters::ContentLauncher::Structs::AdditionalInfo::Type externalIDListList_4[1]; + + externalIDListList_4[0].name = chip::Span("namegarbage: not in length on purpose", 4); + externalIDListList_4[0].value = chip::Span("valuegarbage: not in length on purpose", 5); + + parameterListList_1[0].externalIDList.Value() = externalIDListList_4; + + request.search.parameterList = parameterListList_1; + request.autoPlay = true; request.data.Emplace(); request.data.Value() = chip::Span("exampleDatagarbage: not in length on purpose", 11);