diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 8c4384de9db207..ac0068dfb221bd 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -14476,7 +14476,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/all-clusters-app/linux/include/tv-callbacks.cpp b/examples/all-clusters-app/linux/include/tv-callbacks.cpp index 47108ec588eff1..917c3f0548cf1a 100644 --- a/examples/all-clusters-app/linux/include/tv-callbacks.cpp +++ b/examples/all-clusters-app/linux/include/tv-callbacks.cpp @@ -29,13 +29,3 @@ bool lowPowerClusterSleep() { return true; } - -uint32_t contentLauncherClusterGetSupportedStreamingProtocols() -{ - return 0; -} - -std::list contentLauncherClusterGetAcceptsHeaderList() -{ - return { "example", "example" }; -} diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 063efbc6075ea5..531970d2f88018 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -13136,7 +13136,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/tv-app/android/java/ContentLauncherManager.cpp b/examples/tv-app/android/java/ContentLauncherManager.cpp index 8946c8856097aa..ab035dab5971b3 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -46,7 +46,8 @@ using namespace chip; ContentLauncherManager ContentLauncherManager::sInstance; ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, - std::list parameterList, bool autoplay, + const std::list & parameterList, + bool autoplay, const chip::CharSpan & data) { ContentLaunchResponse response; @@ -102,7 +103,7 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) + const ContentLaunchBrandingInformation & brandingInformation) { ContentLaunchResponse response; CHIP_ERROR err = CHIP_NO_ERROR; @@ -156,23 +157,23 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSp return response; } -std::list ContentLauncherManager::HandleGetAcceptsHeaderList() +std::list ContentLauncherManager::HandleGetAcceptHeaderList() { CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); std::list acceptedHeadersList; - ChipLogProgress(Zcl, "Received ContentLauncherManager::GetAcceptsHeader"); + ChipLogProgress(Zcl, "Received ContentLauncherManager::GetAcceptHeader"); VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mGetAcceptsHeaderMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mGetAcceptHeaderMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); { jobjectArray acceptedHeadersArray = - (jobjectArray) env->CallObjectMethod(mContentLauncherManagerObject, mGetAcceptsHeaderMethod); + (jobjectArray) env->CallObjectMethod(mContentLauncherManagerObject, mGetAcceptHeaderMethod); if (env->ExceptionCheck()) { - ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptsHeader"); + ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptHeader"); env->ExceptionDescribe(); env->ExceptionClear(); err = CHIP_ERROR_INCORRECT_STATE; @@ -193,7 +194,7 @@ std::list ContentLauncherManager::HandleGetAcceptsHeaderList() exit: if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "ContentLauncherManager::GetAcceptsHeader status error: %s", err.AsString()); + ChipLogError(Zcl, "ContentLauncherManager::GetAcceptHeader status error: %s", err.AsString()); } return acceptedHeadersList; @@ -216,7 +217,7 @@ uint32_t ContentLauncherManager::HandleGetSupportedStreamingProtocols() supportedStreamingProtocols = (uint32_t) jSupportedStreamingProtocols; if (env->ExceptionCheck()) { - ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptsHeader"); + ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptHeader"); env->ExceptionDescribe(); env->ExceptionClear(); err = CHIP_ERROR_INCORRECT_STATE; @@ -244,8 +245,8 @@ void ContentLauncherManager::InitializeWithObjects(jobject managerObject) jclass ContentLauncherClass = env->GetObjectClass(managerObject); VerifyOrReturn(ContentLauncherClass != nullptr, ChipLogError(Zcl, "Failed to get ContentLauncherManager Java class")); - mGetAcceptsHeaderMethod = env->GetMethodID(ContentLauncherClass, "getAcceptsHeader", "()[Ljava/lang/String;"); - if (mGetAcceptsHeaderMethod == nullptr) + mGetAcceptHeaderMethod = env->GetMethodID(ContentLauncherClass, "getAcceptHeader", "()[Ljava/lang/String;"); + if (mGetAcceptHeaderMethod == nullptr) { ChipLogError(Zcl, "Failed to access MediaInputManager 'getInputList' method"); env->ExceptionClear(); diff --git a/examples/tv-app/android/java/ContentLauncherManager.h b/examples/tv-app/android/java/ContentLauncherManager.h index 5ca9a268949bf0..4a7345ef51bb1e 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.h +++ b/examples/tv-app/android/java/ContentLauncherManager.h @@ -31,11 +31,11 @@ class ContentLauncherManager : public chip::app::Clusters::ContentLauncher::Dele public: void InitializeWithObjects(jobject managerObject); - ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, std::list parameterList, + ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list & parameterList, bool autoplay, const chip::CharSpan & data) override; ContentLaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) override; - std::list HandleGetAcceptsHeaderList() override; + const std::list & brandingInformation) override; + std::list HandleGetAcceptHeaderList() override; uint32_t HandleGetSupportedStreamingProtocols() override; private: @@ -43,7 +43,7 @@ class ContentLauncherManager : public chip::app::Clusters::ContentLauncher::Dele static ContentLauncherManager sInstance; jobject mContentLauncherManagerObject = nullptr; - jmethodID mGetAcceptsHeaderMethod = nullptr; + jmethodID mGetAcceptHeaderMethod = nullptr; jmethodID mGetSupportedStreamingProtocolsMethod = nullptr; jmethodID mLaunchContentMethod = nullptr; jmethodID mLaunchUrlMethod = nullptr; diff --git a/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManager.java b/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManager.java index ba8b209ad1e709..fe50a7a8420d0d 100755 --- a/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManager.java +++ b/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManager.java @@ -27,10 +27,10 @@ public interface ContentLaunchManager { * @return The list of content types supported by the Video Player or Content App in the form of * entries in the HTTP "Accept" request header. */ - String[] getAcceptsHeader(); + String[] getAcceptHeader(); /** @return The list information about supported streaming protocols in STREAMING_TYPE_XXX. */ - int[] getSupportedStreamingTypes(); + int[] getSupportedStreamingProtocols(); /** * Launch the specified content with optional search criteria. diff --git a/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManagerStub.java b/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManagerStub.java index cf95fa807b31a3..347b670cc58acf 100644 --- a/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManagerStub.java +++ b/examples/tv-app/android/java/src/com/tcl/chip/tvapp/ContentLaunchManagerStub.java @@ -7,7 +7,7 @@ public class ContentLaunchManagerStub implements ContentLaunchManager { private final String TAG = ContentLaunchManagerStub.class.getSimpleName(); @Override - public String[] getAcceptsHeader() { + public String[] getAcceptHeader() { String[] headers = new String[] { "application/dash+xml", "application/vnd.apple.mpegurl", "text/html", @@ -17,7 +17,7 @@ public String[] getAcceptsHeader() { } @Override - public int[] getSupportedStreamingTypes() { + public int[] getSupportedStreamingProtocols() { int[] types = new int[] {STREAMING_TYPE_DASH, STREAMING_TYPE_HLS}; return types; } diff --git a/examples/tv-app/linux/AppImpl.cpp b/examples/tv-app/linux/AppImpl.cpp index 6b667967bf28ac..437cb7379527a1 100644 --- a/examples/tv-app/linux/AppImpl.cpp +++ b/examples/tv-app/linux/AppImpl.cpp @@ -103,7 +103,7 @@ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END(); // Declare Content Launcher cluster attributes DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(contentLauncherAttrs) -DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CONTENT_LAUNCHER_ACCEPTS_HEADER_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, +DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CONTENT_LAUNCHER_ACCEPT_HEADER_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* accept header list */ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CONTENT_LAUNCHER_SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, BITMAP32, 1, 0), /* streaming protocols */ diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp index c95dc3e6e71d83..7bf78790c90912 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp @@ -39,7 +39,7 @@ using namespace std; using namespace chip::AppPlatform; ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, - std::list parameterList, bool autoplay, + const std::list & parameterList, bool autoplay, const chip::CharSpan & data) { ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchContent "); @@ -63,7 +63,7 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) + const std::list & brandingInformation) { ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchUrl"); @@ -78,9 +78,9 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSp return response; } -std::list ContentLauncherManager::HandleGetAcceptsHeaderList() +std::list ContentLauncherManager::HandleGetAcceptHeaderList() { - ChipLogProgress(Zcl, "ContentLauncherManager::HandleGetAcceptsHeaderList"); + ChipLogProgress(Zcl, "ContentLauncherManager::HandleGetAcceptHeaderList"); return { "example", "example" }; } diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h index f0a3e7996b9266..8ca6981e46591f 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h @@ -30,10 +30,10 @@ class ContentLauncherManager : public chip::app::Clusters::ContentLauncher::Delegate { public: - ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, std::list parameterList, + ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list & parameterList, bool autoplay, const chip::CharSpan & data) override; ContentLaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) override; - std::list HandleGetAcceptsHeaderList() override; + const std::list & brandingInformation) override; + std::list HandleGetAcceptHeaderList() override; uint32_t HandleGetSupportedStreamingProtocols() override; }; diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index 782c98d7fca93b..e279ecbe8e77e0 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -7491,7 +7491,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", @@ -9209,7 +9209,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", @@ -9697,7 +9697,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index ae8d70b000b154..3b19c27da39d3d 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -12542,7 +12542,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", 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 0d668bacbf72aa..9c95f7fe73c958 100644 --- a/src/app/clusters/content-launch-server/content-launch-delegate.h +++ b/src/app/clusters/content-launch-server/content-launch-delegate.h @@ -44,13 +44,13 @@ namespace ContentLauncher { class Delegate { public: - virtual ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, std::list parameterList, + virtual ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list & parameterList, bool autoplay, const chip::CharSpan & data) = 0; virtual ContentLaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) = 0; + const std::list & brandingInformation) = 0; - virtual std::list HandleGetAcceptsHeaderList() = 0; + virtual std::list HandleGetAcceptHeaderList() = 0; virtual uint32_t HandleGetSupportedStreamingProtocols() = 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 7bdd2b0f2b80fb..b23a8a504015cd 100644 --- a/src/app/clusters/content-launch-server/content-launch-server.cpp +++ b/src/app/clusters/content-launch-server/content-launch-server.cpp @@ -70,9 +70,9 @@ Delegate * GetDelegate(EndpointId endpoint) return (ep == 0xFFFF ? NULL : gDelegateTable[ep]); } -bool SendStatusIfDelegateNull(EndpointId endpoint) +bool SendStatusIfDelegateNull(Delegate * delegate, EndpointId endpoint) { - if (GetDelegate(endpoint) == nullptr) + if (delegate == nullptr) { ChipLogError(Zcl, "No ContentLauncher Delegate set for ep:%" PRIu16, endpoint); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_UNSUP_COMMAND); @@ -119,7 +119,7 @@ class ContentLauncherAttrAccess : public app::AttributeAccessInterface CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override; private: - CHIP_ERROR ReadAcceptsHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate); + CHIP_ERROR ReadAcceptHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate); CHIP_ERROR ReadSupportedStreamingProtocols(app::AttributeValueEncoder & aEncoder, Delegate * delegate); }; @@ -129,15 +129,15 @@ CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath { EndpointId endpoint = aPath.mEndpointId; Delegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(endpoint)) + if (SendStatusIfDelegateNull(delegate, endpoint)) { return CHIP_NO_ERROR; } switch (aPath.mAttributeId) { - case app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::Id: { - return ReadAcceptsHeaderAttribute(aEncoder, delegate); + case app::Clusters::ContentLauncher::Attributes::AcceptHeaderList::Id: { + return ReadAcceptHeaderAttribute(aEncoder, delegate); } case app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id: { return ReadSupportedStreamingProtocols(aEncoder, delegate); @@ -149,13 +149,13 @@ CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath return CHIP_NO_ERROR; } -CHIP_ERROR ContentLauncherAttrAccess::ReadAcceptsHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate) +CHIP_ERROR ContentLauncherAttrAccess::ReadAcceptHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate) { - std::list acceptsHeaderList = delegate->HandleGetAcceptsHeaderList(); - return aEncoder.EncodeList([acceptsHeaderList](const auto & encoder) -> CHIP_ERROR { - for (std::string acceptedHeader : acceptsHeaderList) + std::list acceptHeaderList = delegate->HandleGetAcceptHeaderList(); + return aEncoder.EncodeList([acceptHeaderList](const auto & encoder) -> CHIP_ERROR { + for (const auto & acceptedHeader : acceptHeaderList) { - CharSpan span(acceptedHeader.c_str(), strlen(acceptedHeader.c_str())); + CharSpan span(acceptedHeader.c_str(), acceptedHeader.length()); ReturnErrorOnFailure(encoder.Encode(span)); } return CHIP_NO_ERROR; @@ -181,12 +181,14 @@ bool emberAfContentLauncherClusterLaunchContentCallback( chip::app::Clusters::ContentLauncher::Commands::LaunchContentResponse::Type response; EndpointId endpoint = commandPath.mEndpointId; - auto & autoplay = commandData.autoPlay; - auto & data = commandData.data; + auto & autoplay = commandData.autoPlay; + auto & data = commandData.data; + // TODO: Decode the paramater and pass it to delegate + // auto searchIterator = commandData.search.begin(); std::list parameterList; Delegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(endpoint)) + if (SendStatusIfDelegateNull(delegate, endpoint)) { return true; } @@ -219,17 +221,21 @@ bool emberAfContentLauncherClusterLaunchURLCallback( chip::app::Clusters::ContentLauncher::Commands::LaunchURLResponse::Type response; EndpointId endpoint = commandPath.mEndpointId; - auto & contentUrl = commandData.contentURL; - auto & displayString = commandData.displayString; - ContentLaunchBrandingInformation brandingInformation; + + auto & contentUrl = commandData.contentURL; + auto & displayString = commandData.displayString; + // TODO: Decode the paramater and pass it to delegate + // auto brandingInformationIterator = commandData.brandingInformation.begin(); + std::list brandingInformationList; + Delegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(endpoint)) + if (SendStatusIfDelegateNull(delegate, endpoint)) { return true; } - ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformation); + ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformationList); VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); response.contentLaunchStatus = resp.status; diff --git a/src/app/tests/suites/TV_ContentLauncherCluster.yaml b/src/app/tests/suites/TV_ContentLauncherCluster.yaml index 07d34876231a8f..e2c6b5a38ef526 100644 --- a/src/app/tests/suites/TV_ContentLauncherCluster.yaml +++ b/src/app/tests/suites/TV_ContentLauncherCluster.yaml @@ -23,9 +23,9 @@ tests: cluster: "DelayCommands" command: "WaitForCommissionee" - - label: "Read attribute accepts header list" + - label: "Read attribute accept header list" command: "readAttribute" - attribute: "accepts header list" + attribute: "accept header list" response: value: ["example", "example"] 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 21976e56892b69..db2e801b854662 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 @@ -26,7 +26,7 @@ limitations under the License. This cluster provides an interface for launching content on a media player device such as a TV or Speaker. - accepts header list + accept header list supported streaming protocols diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index cd2ee0e48eb350..e8ba2818ffef6b 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -11605,7 +11605,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server",