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 79a6ee8413daac..917c3f0548cf1a 100644 --- a/examples/all-clusters-app/linux/include/tv-callbacks.cpp +++ b/examples/all-clusters-app/linux/include/tv-callbacks.cpp @@ -22,6 +22,9 @@ ******************************************************************************* ******************************************************************************/ +#include +#include + bool lowPowerClusterSleep() { return true; diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 12ba90c3e99995..148577836863a4 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -173,6 +173,7 @@ function getTests() 'TV_MediaPlaybackCluster', 'TV_TvChannelCluster', 'TV_LowPowerCluster', + 'TV_ContentLauncherCluster', 'TV_MediaInputCluster', ]; 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 9f7233f50c961b..984e9631861860 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -45,206 +45,9 @@ using namespace chip; ContentLauncherManager ContentLauncherManager::sInstance; -namespace { - -class ContentLauncherAttrAccess : public app::AttributeAccessInterface -{ -public: - ContentLauncherAttrAccess() : app::AttributeAccessInterface(Optional::Missing(), app::Clusters::ContentLauncher::Id) - {} - - CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override - { - if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::Id) - { - return ContentLauncherMgr().GetAcceptsHeader(aEncoder); - } - else if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id) - { - return ContentLauncherMgr().GetSupportedStreamingTypes(aEncoder); - } - - return CHIP_NO_ERROR; - } -}; - -ContentLauncherAttrAccess gContentLauncherAttrAccess; - -} // anonymous namespace - -/** @brief Content Launch Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - */ -void emberAfContentLauncherClusterInitCallback(EndpointId endpoint) -{ - static bool attrAccessRegistered = false; - if (!attrAccessRegistered) - { - registerAttributeAccessOverride(&gContentLauncherAttrAccess); - attrAccessRegistered = true; - } -} - -ContentLaunchResponse contentLauncherClusterLaunchContent(chip::EndpointId endpointId, - std::list parameterList, bool autoplay, - const chip::CharSpan & data) -{ - return ContentLauncherMgr().LaunchContent(endpointId, parameterList, autoplay, data); -} - -ContentLaunchResponse contentLauncherClusterLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) -{ - return ContentLauncherMgr().LaunchUrl(contentUrl, displayString, brandingInformation); -} - -void ContentLauncherManager::InitializeWithObjects(jobject managerObject) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Failed to GetEnvForCurrentThread for ContentLauncherManager")); - - mContentLauncherManagerObject = env->NewGlobalRef(managerObject); - VerifyOrReturn(mContentLauncherManagerObject != nullptr, ChipLogError(Zcl, "Failed to NewGlobalRef ContentLauncherManager")); - - 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) - { - ChipLogError(Zcl, "Failed to access MediaInputManager 'getInputList' method"); - env->ExceptionClear(); - } - - mGetSupportedStreamingTypesMethod = env->GetMethodID(ContentLauncherClass, "getSupportedStreamingTypes", "()[I"); - if (mGetSupportedStreamingTypesMethod == nullptr) - { - ChipLogError(Zcl, "Failed to access MediaInputManager 'getSupportedStreamingTypes' method"); - env->ExceptionClear(); - } - - mLaunchContentMethod = env->GetMethodID( - ContentLauncherClass, "launchContent", - "([Lcom/tcl/chip/tvapp/ContentLaunchSearchParameter;ZLjava/lang/String;)Lcom/tcl/chip/tvapp/ContentLaunchResponse;"); - if (mLaunchContentMethod == nullptr) - { - ChipLogError(Zcl, "Failed to access MediaInputManager 'launchContent' method"); - env->ExceptionClear(); - } - - mLaunchUrlMethod = env->GetMethodID(ContentLauncherClass, "launchUrl", - "(Ljava/lang/String;Ljava/lang/String;Lcom/tcl/chip/tvapp/" - "ContentLaunchBrandingInformation;)Lcom/tcl/chip/tvapp/ContentLaunchResponse;"); - if (mLaunchUrlMethod == nullptr) - { - ChipLogError(AppServer, "Failed to access 'launchUrl' method"); - env->ExceptionClear(); - } -} - -CHIP_ERROR ContentLauncherManager::GetAcceptsHeader(chip::app::AttributeValueEncoder & aEncoder) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - ChipLogProgress(Zcl, "Received ContentLauncherManager::GetAcceptsHeader"); - VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mGetAcceptsHeaderMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); - - return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { - jobjectArray headersArray = (jobjectArray) env->CallObjectMethod(mContentLauncherManagerObject, mGetAcceptsHeaderMethod); - if (env->ExceptionCheck()) - { - ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptsHeader"); - env->ExceptionDescribe(); - env->ExceptionClear(); - return CHIP_ERROR_INCORRECT_STATE; - } - - jint size = env->GetArrayLength(headersArray); - for (int i = 0; i < size; i++) - { - jstring acceptsheader = (jstring) env->GetObjectArrayElement(headersArray, i); - if (acceptsheader != nullptr) - { - JniUtfString header(env, acceptsheader); - - chip::ByteSpan bHeader((const uint8_t *) (header.c_str()), (size_t)(header.size())); - ReturnErrorOnFailure(encoder.Encode(bHeader)); - - // Todo: should be chanSpan? - // ReturnErrorOnFailure(encoder.Encode(header.charSpan())); - } - } - - return CHIP_NO_ERROR; - }); - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "ContentLauncherManager::GetAcceptsHeader status error: %s", err.AsString()); - } - - return err; -} - -CHIP_ERROR ContentLauncherManager::GetSupportedStreamingTypes(chip::app::AttributeValueEncoder & aEncoder) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - ChipLogProgress(Zcl, "Received ContentLauncherManager::GetSupportedStreamingTypes"); - VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mGetSupportedStreamingTypesMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); - - return aEncoder.EncodeList([this, env](const auto & encoder) -> CHIP_ERROR { - jintArray typesArray = (jintArray) env->CallObjectMethod(mContentLauncherManagerObject, mGetSupportedStreamingTypesMethod); - if (env->ExceptionCheck()) - { - ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetSupportedStreamingTypes"); - env->ExceptionDescribe(); - env->ExceptionClear(); - return CHIP_ERROR_INCORRECT_STATE; - } - - jboolean isCopy = JNI_FALSE; - jint * ptypes = env->GetIntArrayElements(typesArray, &isCopy); - jint size = env->GetArrayLength(typesArray); - - CHIP_ERROR err = CHIP_NO_ERROR; - for (int i = 0; i < size; i++) - { - err = encoder.Encode(static_cast(ptypes[i])); - if (err != CHIP_NO_ERROR) - { - break; - } - } - env->ReleaseIntArrayElements(typesArray, ptypes, 0); - return err; - }); - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "ContentLauncherManager::GetAcceptsHeader status error: %s", err.AsString()); - } - - return err; -} - -ContentLaunchResponse ContentLauncherManager::LaunchContent(chip::EndpointId endpointId, - std::list parameterList, bool autoplay, - const chip::CharSpan & data) +ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, + const std::list & parameterList, + bool autoplay, const chip::CharSpan & data) { ContentLaunchResponse response; CHIP_ERROR err = CHIP_NO_ERROR; @@ -297,8 +100,9 @@ ContentLaunchResponse ContentLauncherManager::LaunchContent(chip::EndpointId end return response; } -ContentLaunchResponse ContentLauncherManager::LaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) +ContentLaunchResponse +ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, + const std::list & brandingInformation) { ContentLaunchResponse response; CHIP_ERROR err = CHIP_NO_ERROR; @@ -351,3 +155,124 @@ ContentLaunchResponse ContentLauncherManager::LaunchUrl(const chip::CharSpan & c return response; } + +std::list ContentLauncherManager::HandleGetAcceptHeaderList() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + std::list acceptedHeadersList; + + ChipLogProgress(Zcl, "Received ContentLauncherManager::GetAcceptHeader"); + VerifyOrExit(mContentLauncherManagerObject != 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, mGetAcceptHeaderMethod); + if (env->ExceptionCheck()) + { + ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptHeader"); + env->ExceptionDescribe(); + env->ExceptionClear(); + err = CHIP_ERROR_INCORRECT_STATE; + goto exit; + } + + jint size = env->GetArrayLength(acceptedHeadersArray); + for (int i = 0; i < size; i++) + { + + jstring jAcceptedHeader = (jstring) env->GetObjectArrayElement(acceptedHeadersArray, i); + const char * convertedValue = (env)->GetStringUTFChars(jAcceptedHeader, JNI_FALSE); + std::string acceptedHeader = std::string(convertedValue, strlen(convertedValue)); + acceptedHeadersList.push_front(acceptedHeader); + } + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "ContentLauncherManager::GetAcceptHeader status error: %s", err.AsString()); + } + + return acceptedHeadersList; +} + +uint32_t ContentLauncherManager::HandleGetSupportedStreamingProtocols() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + uint32_t supportedStreamingProtocols = 0; + + ChipLogProgress(Zcl, "Received ContentLauncherManager::GetSupportedStreamingProtocols"); + VerifyOrExit(mContentLauncherManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mGetSupportedStreamingProtocolsMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV); + + { + jint jSupportedStreamingProtocols = + env->CallIntMethod(mContentLauncherManagerObject, mGetSupportedStreamingProtocolsMethod); + supportedStreamingProtocols = (uint32_t) jSupportedStreamingProtocols; + if (env->ExceptionCheck()) + { + ChipLogError(Zcl, "Java exception in ContentLauncherManager::GetAcceptHeader"); + env->ExceptionDescribe(); + env->ExceptionClear(); + err = CHIP_ERROR_INCORRECT_STATE; + goto exit; + } + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "ContentLauncherManager::GetSupportedStreamingProtocols status error: %s", err.AsString()); + } + + return supportedStreamingProtocols; +} + +void ContentLauncherManager::InitializeWithObjects(jobject managerObject) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Failed to GetEnvForCurrentThread for ContentLauncherManager")); + + mContentLauncherManagerObject = env->NewGlobalRef(managerObject); + VerifyOrReturn(mContentLauncherManagerObject != nullptr, ChipLogError(Zcl, "Failed to NewGlobalRef ContentLauncherManager")); + + jclass ContentLauncherClass = env->GetObjectClass(managerObject); + VerifyOrReturn(ContentLauncherClass != nullptr, ChipLogError(Zcl, "Failed to get ContentLauncherManager Java class")); + + mGetAcceptHeaderMethod = env->GetMethodID(ContentLauncherClass, "getAcceptHeader", "()[Ljava/lang/String;"); + if (mGetAcceptHeaderMethod == nullptr) + { + ChipLogError(Zcl, "Failed to access MediaInputManager 'getInputList' method"); + env->ExceptionClear(); + } + + mGetSupportedStreamingProtocolsMethod = env->GetMethodID(ContentLauncherClass, "getSupportedStreamingProtocols", "()[I"); + if (mGetSupportedStreamingProtocolsMethod == nullptr) + { + ChipLogError(Zcl, "Failed to access MediaInputManager 'getSupportedStreamingProtocols' method"); + env->ExceptionClear(); + } + + mLaunchContentMethod = env->GetMethodID( + ContentLauncherClass, "launchContent", + "([Lcom/tcl/chip/tvapp/ContentLaunchSearchParameter;ZLjava/lang/String;)Lcom/tcl/chip/tvapp/ContentLaunchResponse;"); + if (mLaunchContentMethod == nullptr) + { + ChipLogError(Zcl, "Failed to access MediaInputManager 'launchContent' method"); + env->ExceptionClear(); + } + + mLaunchUrlMethod = env->GetMethodID(ContentLauncherClass, "launchUrl", + "(Ljava/lang/String;Ljava/lang/String;Lcom/tcl/chip/tvapp/" + "ContentLaunchBrandingInformation;)Lcom/tcl/chip/tvapp/ContentLaunchResponse;"); + if (mLaunchUrlMethod == nullptr) + { + ChipLogError(AppServer, "Failed to access 'launchUrl' method"); + env->ExceptionClear(); + } +} diff --git a/examples/tv-app/android/java/ContentLauncherManager.h b/examples/tv-app/android/java/ContentLauncherManager.h index 01b843530a2e77..4a7345ef51bb1e 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.h +++ b/examples/tv-app/android/java/ContentLauncherManager.h @@ -21,31 +21,32 @@ #include #include -#include +#include #include #include #include -class ContentLauncherManager +class ContentLauncherManager : public chip::app::Clusters::ContentLauncher::Delegate { public: void InitializeWithObjects(jobject managerObject); - CHIP_ERROR GetAcceptsHeader(chip::app::AttributeValueEncoder & aEncoder); - CHIP_ERROR GetSupportedStreamingTypes(chip::app::AttributeValueEncoder & aEncoder); - ContentLaunchResponse LaunchContent(chip::EndpointId endpointId, std::list parameterList, bool autoplay, - const chip::CharSpan & data); - ContentLaunchResponse LaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation); + + 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, + const std::list & brandingInformation) override; + std::list HandleGetAcceptHeaderList() override; + uint32_t HandleGetSupportedStreamingProtocols() override; private: friend ContentLauncherManager & ContentLauncherMgr(); static ContentLauncherManager sInstance; - jobject mContentLauncherManagerObject = nullptr; - jmethodID mGetAcceptsHeaderMethod = nullptr; - jmethodID mGetSupportedStreamingTypesMethod = nullptr; - jmethodID mLaunchContentMethod = nullptr; - jmethodID mLaunchUrlMethod = nullptr; + jobject mContentLauncherManagerObject = nullptr; + jmethodID mGetAcceptHeaderMethod = nullptr; + jmethodID mGetSupportedStreamingProtocolsMethod = nullptr; + jmethodID mLaunchContentMethod = nullptr; + jmethodID mLaunchUrlMethod = nullptr; }; inline ContentLauncherManager & ContentLauncherMgr() 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/cluster-init.cpp b/examples/tv-app/linux/include/cluster-init.cpp index 8ec354664ee23c..54d6b1dab412a0 100644 --- a/examples/tv-app/linux/include/cluster-init.cpp +++ b/examples/tv-app/linux/include/cluster-init.cpp @@ -189,48 +189,6 @@ void emberAfAudioOutputClusterInitCallback(EndpointId endpoint) namespace { -class ContentLauncherAttrAccess : public app::AttributeAccessInterface -{ -public: - ContentLauncherAttrAccess() : app::AttributeAccessInterface(Optional::Missing(), app::Clusters::ContentLauncher::Id) - {} - - CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override - { - if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::Id) - { - return ContentLauncherManager().proxyGetAcceptsHeader(aEncoder); - } - - return CHIP_NO_ERROR; - } -}; - -ContentLauncherAttrAccess gContentLauncherAttrAccess; - -} // anonymous namespace - -/** @brief Content Launch Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - */ -void emberAfContentLauncherClusterInitCallback(EndpointId endpoint) -{ - static bool attrAccessRegistered = false; - if (!attrAccessRegistered) - { - registerAttributeAccessOverride(&gContentLauncherAttrAccess); - attrAccessRegistered = true; - } -} - -namespace { - TvAttrAccess gMediaInputAttrAccess; diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp index 0bb0a9df4e3c1b..17e5d5ef8d4080 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp @@ -38,91 +38,55 @@ using namespace std; using namespace chip::AppPlatform; -CHIP_ERROR ContentLauncherManager::Init() +ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, + const std::list & parameterList, + bool autoplay, const chip::CharSpan & data) { - CHIP_ERROR err = CHIP_NO_ERROR; - - // TODO: Store feature map once it is supported - map featureMap; - featureMap["CS"] = true; - featureMap["UP"] = true; - featureMap["WA"] = true; - - SuccessOrExit(err); -exit: - return err; -} - -CHIP_ERROR ContentLauncherManager::proxyGetAcceptsHeader(chip::app::AttributeValueEncoder & aEncoder) -{ - ChipLogProgress(Zcl, "ContentLauncherManager::proxyGetAcceptsHeader "); - return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { - std::list headerExample = { "image/*", "video/*" }; - - for (string entry : headerExample) - { - ReturnErrorOnFailure(encoder.Encode(chip::CharSpan(entry.c_str(), entry.length()))); - } - return CHIP_NO_ERROR; - }); -} - -CHIP_ERROR ContentLauncherManager::proxyGetSupportedStreamingTypes(chip::app::AttributeValueEncoder & aEncoder) -{ - ChipLogProgress(Zcl, "ContentLauncherManager::proxyGetSupportedStreamingTypes "); - return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { - // ReturnErrorOnFailure(encoder.Encode(EMBER_ZCL_CONTENT_LAUNCH_STREAMING_TYPE_DASH)); - // ReturnErrorOnFailure(encoder.Encode(EMBER_ZCL_CONTENT_LAUNCH_STREAMING_TYPE_HLS)); - return CHIP_NO_ERROR; - }); -} - -ContentLaunchResponse ContentLauncherManager::proxyLaunchContentRequest(chip::EndpointId endpointId, - list parameterList, bool autoplay, - string data) -{ - ChipLogProgress(Zcl, "ContentLauncherManager::proxyLaunchContentRequest endpoint=%d", endpointId); + ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchContent "); + string dataString(data.data(), data.size()); #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED ContentApp * app = chip::AppPlatform::AppPlatform::GetInstance().GetContentAppByEndpointId(endpointId); if (app != NULL) { - return app->GetContentLauncher()->LaunchContent(parameterList, autoplay, data); + return app->GetContentLauncher()->LaunchContent(parameterList, autoplay, dataString); } #endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED // TODO: Insert code here ContentLaunchResponse response; response.err = CHIP_NO_ERROR; - response.data = "Example data"; + response.data = chip::CharSpan("exampleData", strlen("exampleData")); response.status = EMBER_ZCL_CONTENT_LAUNCH_STATUS_SUCCESS; return response; } -ContentLaunchResponse ContentLauncherManager::proxyLaunchUrlRequest(string contentUrl, string displayString, - ContentLaunchBrandingInformation brandingInformation) + +ContentLaunchResponse +ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, + const std::list & brandingInformation) { - ChipLogProgress(Zcl, "ContentLauncherManager::proxyLaunchUrlRequest contentUrl=%s ", contentUrl.c_str()); + ChipLogProgress(Zcl, "ContentLauncherManager::HandleLaunchUrl"); + + string contentUrlString(contentUrl.data(), contentUrl.size()); + string displayStringString(displayString.data(), displayString.size()); // TODO: Insert code here ContentLaunchResponse response; response.err = CHIP_NO_ERROR; - response.data = "Example data"; + response.data = chip::CharSpan("exampleData", strlen("exampleData")); response.status = EMBER_ZCL_CONTENT_LAUNCH_STATUS_SUCCESS; return response; } -ContentLaunchResponse contentLauncherClusterLaunchContent(chip::EndpointId endpointId, - std::list parameterList, bool autoplay, - const chip::CharSpan & data) +std::list ContentLauncherManager::HandleGetAcceptHeaderList() { - string dataString(data.data(), data.size()); - return ContentLauncherManager().proxyLaunchContentRequest(endpointId, parameterList, autoplay, dataString); + ChipLogProgress(Zcl, "ContentLauncherManager::HandleGetAcceptHeaderList"); + return { "example", "example" }; } -ContentLaunchResponse contentLauncherClusterLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation) +uint32_t ContentLauncherManager::HandleGetSupportedStreamingProtocols() { - string contentUrlString(contentUrl.data(), contentUrl.size()); - string displayStringString(displayString.data(), displayString.size()); - return ContentLauncherManager().proxyLaunchUrlRequest(contentUrlString, displayStringString, brandingInformation); + ChipLogProgress(Zcl, "ContentLauncherManager::HandleGetSupportedStreamingProtocols"); + uint32_t streamingProtocols = 0; + return streamingProtocols; } diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h index aedeb2cc134b98..8ca6981e46591f 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.h @@ -20,21 +20,20 @@ #include #include -#include +#include #include #include #include #include -class ContentLauncherManager +class ContentLauncherManager : public chip::app::Clusters::ContentLauncher::Delegate { public: - CHIP_ERROR Init(); - CHIP_ERROR proxyGetAcceptsHeader(chip::app::AttributeValueEncoder & aEncoder); - CHIP_ERROR proxyGetSupportedStreamingTypes(chip::app::AttributeValueEncoder & aEncoder); - ContentLaunchResponse proxyLaunchContentRequest(chip::EndpointId endpointId, std::list parameterList, - bool autoplay, std::string data); - ContentLaunchResponse proxyLaunchUrlRequest(std::string contentUrl, std::string displayString, - ContentLaunchBrandingInformation brandingInformation); + 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, + const std::list & brandingInformation) override; + std::list HandleGetAcceptHeaderList() override; + uint32_t HandleGetSupportedStreamingProtocols() override; }; diff --git a/examples/tv-app/linux/main.cpp b/examples/tv-app/linux/main.cpp index 35ca1a8d5fabf2..1aa352d280a00a 100644 --- a/examples/tv-app/linux/main.cpp +++ b/examples/tv-app/linux/main.cpp @@ -52,6 +52,11 @@ bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * comm return true; } +namespace { +static ContentLauncherManager contentLauncherManager; +constexpr chip::EndpointId kContentLauncherEndpoint = 1; +} // namespace + int main(int argc, char * argv[]) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -72,10 +77,6 @@ int main(int argc, char * argv[]) err = AudioOutputManager().Init(); SuccessOrExit(err); - // Init Content Launcher Manager - err = ContentLauncherManager().Init(); - SuccessOrExit(err); - // Init Media Input Manager err = MediaInputManager().Init(); SuccessOrExit(err); @@ -115,3 +116,9 @@ int main(int argc, char * argv[]) } return 0; } + +void emberAfContentLauncherClusterInitCallback(EndpointId endpoint) +{ + ChipLogProgress(Zcl, "TV Linux App: ContentLauncherManager::SetDelegate"); + chip::app::Clusters::ContentLauncher::SetDelegate(kContentLauncherEndpoint, &contentLauncherManager); +} diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index 782c98d7fca93b..c70f50d5b69af2 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", @@ -9389,21 +9389,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "allowed vendor list", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, @@ -9697,7 +9682,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", @@ -9868,21 +9853,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "allowed vendor list", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, @@ -10145,21 +10115,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "allowed vendor list", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, diff --git a/examples/tv-casting-app/linux/main.cpp b/examples/tv-casting-app/linux/main.cpp index 7cd5934347e967..2aee5c5b3422ba 100644 --- a/examples/tv-casting-app/linux/main.cpp +++ b/examples/tv-casting-app/linux/main.cpp @@ -30,6 +30,9 @@ #include #include +#include +#include + using namespace chip; using namespace chip::Controller; using namespace chip::Credentials; 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..272131c4846351 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 @@ -1703,7 +1703,7 @@ "reportableChange": 0 }, { - "name": "NetworkDisabled", + "name": "InterfaceEnabled", "code": 4, "mfgCode": null, "side": "server", @@ -11934,7 +11934,7 @@ ], "attributes": [ { - "name": "tv channel list", + "name": "channel list", "code": 0, "mfgCode": null, "side": "server", @@ -11949,7 +11949,7 @@ "reportableChange": 0 }, { - "name": "tv channel lineup", + "name": "channel lineup", "code": 1, "mfgCode": null, "side": "server", @@ -11964,7 +11964,7 @@ "reportableChange": 0 }, { - "name": "current tv channel", + "name": "current channel", "code": 2, "mfgCode": null, "side": "server", @@ -12542,7 +12542,7 @@ ], "attributes": [ { - "name": "accepts header list", + "name": "accept header list", "code": 0, "mfgCode": null, "side": "server", @@ -12557,7 +12557,7 @@ "reportableChange": 0 }, { - "name": "supported streaming types", + "name": "supported streaming protocols", "code": 1, "mfgCode": null, "side": "server", @@ -12853,7 +12853,7 @@ "reportableChange": 0 }, { - "name": "application id", + "name": "application status", "code": 5, "mfgCode": null, "side": "server", @@ -12868,7 +12868,7 @@ "reportableChange": 0 }, { - "name": "catalog vendor id", + "name": "application version", "code": 6, "mfgCode": null, "side": "server", @@ -12882,21 +12882,6 @@ "maxInterval": 65344, "reportableChange": 0 }, - { - "name": "application status", - "code": 7, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x01", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, { "name": "ClusterRevision", "code": 65533, diff --git a/src/app/clusters/content-launch-server/content-launch-delegate.h b/src/app/clusters/content-launch-server/content-launch-delegate.h new file mode 100644 index 00000000000000..9974b2c2bde0b4 --- /dev/null +++ b/src/app/clusters/content-launch-server/content-launch-delegate.h @@ -0,0 +1,64 @@ +/* + * + * Copyright (c) 2021 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 +#include +#include + +#include +#include +#include + +struct ContentLaunchResponse +{ + CHIP_ERROR err; + chip::CharSpan data; + chip::app::Clusters::ContentLauncher::ContentLaunchStatus status; +}; + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentLauncher { + +/** @brief + * Defines methods for implementing application-specific logic for the Content Launcher Cluster. + */ +class Delegate +{ +public: + 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, + const std::list & brandingInformation) = 0; + + virtual std::list HandleGetAcceptHeaderList() = 0; + + virtual uint32_t HandleGetSupportedStreamingProtocols() = 0; + + virtual ~Delegate() = default; +}; + +} // namespace ContentLauncher +} // namespace Clusters +} // namespace app +} // namespace chip 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 c9b5bb5e9f94e3..2a912346f441bb 100644 --- a/src/app/clusters/content-launch-server/content-launch-server.cpp +++ b/src/app/clusters/content-launch-server/content-launch-server.cpp @@ -39,19 +39,145 @@ ******************************************************************************/ #include "content-launch-server.h" + #include +#include +#include + +#include #include +#include +#include #include +#include #include using namespace chip; +using namespace chip::app; + +// ----------------------------------------------------------------------------- +// Delegate Implementation + +using chip::app::Clusters::ContentLauncher::Delegate; + +namespace { + +Delegate * gDelegateTable[EMBER_AF_CONTENT_LAUNCH_CLUSTER_SERVER_ENDPOINT_COUNT] = { nullptr }; + +Delegate * GetDelegate(EndpointId endpoint) +{ + uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::ContentLauncher::Id); + return (ep == 0xFFFF ? NULL : gDelegateTable[ep]); +} + +bool SendStatusIfDelegateNull(Delegate * delegate, EndpointId endpoint) +{ + if (delegate == nullptr) + { + ChipLogError(Zcl, "No ContentLauncher Delegate set for ep:%" PRIu16, endpoint); + return true; + } + return false; +} +} // namespace + +namespace chip { +namespace app { +namespace Clusters { +namespace ContentLauncher { + +void SetDelegate(EndpointId endpoint, Delegate * delegate) +{ + uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, chip::app::Clusters::ContentLauncher::Id); + if (ep != 0xFFFF) + { + gDelegateTable[ep] = delegate; + } + else + { + } +} + +} // namespace ContentLauncher +} // namespace Clusters +} // namespace app +} // namespace chip + +// ----------------------------------------------------------------------------- +// Attribute Accessor Implementation + +namespace { + +class ContentLauncherAttrAccess : public app::AttributeAccessInterface +{ +public: + ContentLauncherAttrAccess() : + app::AttributeAccessInterface(Optional::Missing(), chip::app::Clusters::ContentLauncher::Id) + {} + + CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override; + +private: + CHIP_ERROR ReadAcceptHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate); + CHIP_ERROR ReadSupportedStreamingProtocols(app::AttributeValueEncoder & aEncoder, Delegate * delegate); +}; + +ContentLauncherAttrAccess gContentLauncherAttrAccess; + +CHIP_ERROR ContentLauncherAttrAccess::Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + EndpointId endpoint = aPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); + VerifyOrExit(SendStatusIfDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); + + switch (aPath.mAttributeId) + { + case app::Clusters::ContentLauncher::Attributes::AcceptHeaderList::Id: { + return ReadAcceptHeaderAttribute(aEncoder, delegate); + } + case app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id: { + return ReadSupportedStreamingProtocols(aEncoder, delegate); + } + default: { + break; + } + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "ContentLauncherAttrAccess::Read error: %s", err.AsString()); -ContentLaunchResponse contentLauncherClusterLaunchContent(chip::EndpointId endpointId, - std::list parameterList, bool autoplay, - const chip::CharSpan & data); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + } -ContentLaunchResponse contentLauncherClusterLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString, - ContentLaunchBrandingInformation & brandingInformation); + return err; +} + +CHIP_ERROR ContentLauncherAttrAccess::ReadAcceptHeaderAttribute(app::AttributeValueEncoder & aEncoder, Delegate * delegate) +{ + std::list acceptHeaderList = delegate->HandleGetAcceptHeaderList(); + return aEncoder.EncodeList([acceptHeaderList](const auto & encoder) -> CHIP_ERROR { + for (const auto & acceptedHeader : acceptHeaderList) + { + CharSpan span(acceptedHeader.c_str(), acceptedHeader.length()); + ReturnErrorOnFailure(encoder.Encode(span)); + } + return CHIP_NO_ERROR; + }); +} + +CHIP_ERROR ContentLauncherAttrAccess::ReadSupportedStreamingProtocols(app::AttributeValueEncoder & aEncoder, Delegate * delegate) +{ + uint32_t streamingProtocols = delegate->HandleGetSupportedStreamingProtocols(); + return aEncoder.Encode(streamingProtocols); +} + +} // anonymous namespace + +// ----------------------------------------------------------------------------- +// Matter Framework Callbacks Implementation bool emberAfContentLauncherClusterLaunchContentCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, @@ -59,19 +185,27 @@ bool emberAfContentLauncherClusterLaunchContentCallback( { CHIP_ERROR err = CHIP_NO_ERROR; chip::app::Clusters::ContentLauncher::Commands::LaunchContentResponse::Type response; + EndpointId endpoint = commandPath.mEndpointId; 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; - ContentLaunchResponse resp = contentLauncherClusterLaunchContent(emberAfCurrentEndpoint(), parameterList, autoplay, data); - VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); + Delegate * delegate = GetDelegate(endpoint); + VerifyOrExit(SendStatusIfDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); - response.contentLaunchStatus = resp.status; - response.data = resp.data; + { + ContentLaunchResponse resp = delegate->HandleLaunchContent(emberAfCurrentEndpoint(), parameterList, autoplay, data); + VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); - err = commandObj->AddResponseData(commandPath, response); - SuccessOrExit(err); + response.contentLaunchStatus = resp.status; + response.data = resp.data; + + err = commandObj->AddResponseData(commandPath, response); + SuccessOrExit(err); + } exit: if (err != CHIP_NO_ERROR) @@ -90,19 +224,27 @@ bool emberAfContentLauncherClusterLaunchURLCallback( { CHIP_ERROR err = CHIP_NO_ERROR; chip::app::Clusters::ContentLauncher::Commands::LaunchURLResponse::Type response; + EndpointId endpoint = commandPath.mEndpointId; auto & contentUrl = commandData.contentURL; auto & displayString = commandData.displayString; - ContentLaunchBrandingInformation brandingInformation; + // TODO: Decode the paramater and pass it to delegate + // auto brandingInformationIterator = commandData.brandingInformation.begin(); + std::list brandingInformationList; + + Delegate * delegate = GetDelegate(endpoint); + VerifyOrExit(SendStatusIfDelegateNull(delegate, endpoint) != true, err = CHIP_ERROR_INCORRECT_STATE); - ContentLaunchResponse resp = contentLauncherClusterLaunchUrl(contentUrl, displayString, brandingInformation); - VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); + { + ContentLaunchResponse resp = delegate->HandleLaunchUrl(contentUrl, displayString, brandingInformationList); + VerifyOrExit(resp.err == CHIP_NO_ERROR, err = resp.err); - response.contentLaunchStatus = resp.status; - response.data = resp.data; + response.contentLaunchStatus = resp.status; + response.data = resp.data; - err = commandObj->AddResponseData(commandPath, response); - SuccessOrExit(err); + err = commandObj->AddResponseData(commandPath, response); + SuccessOrExit(err); + } exit: if (err != CHIP_NO_ERROR) @@ -115,4 +257,10 @@ bool emberAfContentLauncherClusterLaunchURLCallback( return true; } -void MatterContentLauncherPluginServerInitCallback() {} +// ----------------------------------------------------------------------------- +// Plugin initialization + +void MatterContentLauncherPluginServerInitCallback(void) +{ + registerAttributeAccessOverride(&gContentLauncherAttrAccess); +} diff --git a/src/app/clusters/content-launch-server/content-launch-server.h b/src/app/clusters/content-launch-server/content-launch-server.h index 2d4934e5fc0eb9..7a0911078ffad5 100644 --- a/src/app/clusters/content-launch-server/content-launch-server.h +++ b/src/app/clusters/content-launch-server/content-launch-server.h @@ -17,12 +17,18 @@ #pragma once +#include "content-launch-delegate.h" #include #include -struct ContentLaunchResponse -{ - CHIP_ERROR err; - chip::CharSpan data; - chip::app::Clusters::ContentLauncher::ContentLaunchStatus status; -}; +namespace chip { +namespace app { +namespace Clusters { +namespace ContentLauncher { + +void SetDelegate(EndpointId endpoint, Delegate * delegate); + +} // namespace ContentLauncher +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/tests/suites/TV_ContentLauncherCluster.yaml b/src/app/tests/suites/TV_ContentLauncherCluster.yaml index 4da7df542fdf81..e2c6b5a38ef526 100644 --- a/src/app/tests/suites/TV_ContentLauncherCluster.yaml +++ b/src/app/tests/suites/TV_ContentLauncherCluster.yaml @@ -23,11 +23,11 @@ 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: ["example1", "example2"] + value: ["example", "example"] - label: "Read attribute supported streaming protocols" command: "readAttribute" 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 23a618b0002422..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 @@ -124,4 +124,10 @@ limitations under the License. + + + + + + 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", diff --git a/src/controller/java/templates/ClusterInfo-java.zapt b/src/controller/java/templates/ClusterInfo-java.zapt index 7440c4188c51b4..f2b5a8e1590e49 100644 --- a/src/controller/java/templates/ClusterInfo-java.zapt +++ b/src/controller/java/templates/ClusterInfo-java.zapt @@ -255,7 +255,7 @@ public class ClusterInfoMapping { {{#if (isOctetString type)}} CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); {{else if (isCharString type)}} - // Add String field here after ByteSpan is properly emitted in C++ layer + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); {{else}} {{! NOTE: asJavaBasicTypeForZclType does not handle isArray well, so add an inline partial to force isArray to false when we want the diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index 30ed8dc34d05b5..20da60db5d9177 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -299,8 +299,8 @@ typedef void (*CHIPContentLauncherClusterLaunchContentResponseCallbackType)( typedef void (*CHIPContentLauncherClusterLaunchURLResponseCallbackType)( void *, const chip::app::Clusters::ContentLauncher::Commands::LaunchURLResponse::DecodableType &); -typedef void (*CHIPContentLauncherClusterAcceptsHeaderListAttributeCallbackType)( - void *, const chip::app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo::DecodableType &); +typedef void (*CHIPContentLauncherClusterAcceptHeaderListAttributeCallbackType)( + void *, const chip::app::Clusters::ContentLauncher::Attributes::AcceptHeaderList::TypeInfo::DecodableType &); typedef void (*CHIPContentLauncherClusterSupportedStreamingProtocolsAttributeCallbackType)( void *, chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType); typedef void (*CHIPContentLauncherClusterAttributeListAttributeCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp index 3827a67f7dccdf..124d180c2eaf01 100644 --- a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp @@ -4362,15 +4362,15 @@ JNI_METHOD(void, ColorControlCluster, readClusterRevisionAttribute)(JNIEnv * env onFailure.release(); } -JNI_METHOD(void, ContentLauncherCluster, readAcceptsHeaderListAttribute) +JNI_METHOD(void, ContentLauncherCluster, readAcceptHeaderListAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { chip::DeviceLayer::StackLock lock; - using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo; - std::unique_ptr - onSuccess(chip::Platform::New(callback, false), - chip::Platform::Delete); + using TypeInfo = chip::app::Clusters::ContentLauncher::Attributes::AcceptHeaderList::TypeInfo; + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -4388,7 +4388,7 @@ JNI_METHOD(void, ContentLauncherCluster, readAcceptsHeaderListAttribute) chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); - auto successFn = chip::Callback::Callback::FromCancelable( + auto successFn = chip::Callback::Callback::FromCancelable( onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 13e1d628bb187d..2b4dab9fee21a6 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -2776,9 +2776,9 @@ void CHIPColorControlAttributeListAttributeCallback::CallbackFn(void * context, env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } -CHIPContentLauncherAcceptsHeaderListAttributeCallback::CHIPContentLauncherAcceptsHeaderListAttributeCallback(jobject javaCallback, - bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), +CHIPContentLauncherAcceptHeaderListAttributeCallback::CHIPContentLauncherAcceptHeaderListAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -2795,7 +2795,7 @@ CHIPContentLauncherAcceptsHeaderListAttributeCallback::CHIPContentLauncherAccept } } -CHIPContentLauncherAcceptsHeaderListAttributeCallback::~CHIPContentLauncherAcceptsHeaderListAttributeCallback() +CHIPContentLauncherAcceptHeaderListAttributeCallback::~CHIPContentLauncherAcceptHeaderListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -2806,8 +2806,8 @@ CHIPContentLauncherAcceptsHeaderListAttributeCallback::~CHIPContentLauncherAccep env->DeleteGlobalRef(javaCallbackRef); } -void CHIPContentLauncherAcceptsHeaderListAttributeCallback::CallbackFn( - void * context, const chip::app::DataModel::DecodableList & list) +void CHIPContentLauncherAcceptHeaderListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -2816,8 +2816,8 @@ void CHIPContentLauncherAcceptsHeaderListAttributeCallback::CallbackFn( VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. javaCallbackRef = cppCallback.get()->javaCallbackRef; @@ -2844,20 +2844,20 @@ void CHIPContentLauncherAcceptsHeaderListAttributeCallback::CallbackFn( { auto & entry = iter.GetValue(); bool entryNull = false; - chip::ByteSpan entryValue = entry; + chip::CharSpan entryValue = entry; - jbyteArray entryObject = nullptr; + jstring entryObject = nullptr; + chip::UtfString entryStr(env, entryValue); if (!entryNull) { - entryObject = env->NewByteArray(entryValue.size()); - env->SetByteArrayRegion(entryObject, 0, entryValue.size(), reinterpret_cast(entryValue.data())); + entryObject = jstring(entryStr.jniValue()); } env->CallBooleanMethod(arrayListObj, arrayListAddMethod, entryObject); } VerifyOrReturn( iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding AcceptsHeaderListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); + ChipLogError(Zcl, "Error decoding AcceptHeaderListAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index a409bb355690df..8e76b695508641 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -1032,28 +1032,28 @@ class CHIPColorControlAttributeListAttributeCallback bool keepAlive; }; -class CHIPContentLauncherAcceptsHeaderListAttributeCallback - : public chip::Callback::Callback +class CHIPContentLauncherAcceptHeaderListAttributeCallback + : public chip::Callback::Callback { public: - CHIPContentLauncherAcceptsHeaderListAttributeCallback(jobject javaCallback, bool keepAlive = false); + CHIPContentLauncherAcceptHeaderListAttributeCallback(jobject javaCallback, bool keepAlive = false); - ~CHIPContentLauncherAcceptsHeaderListAttributeCallback(); + ~CHIPContentLauncherAcceptHeaderListAttributeCallback(); - static void maybeDestroy(CHIPContentLauncherAcceptsHeaderListAttributeCallback * callback) + static void maybeDestroy(CHIPContentLauncherAcceptHeaderListAttributeCallback * callback) { if (!callback->keepAlive) { callback->Cancel(); - chip::Platform::Delete(callback); + chip::Platform::Delete(callback); } } - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); + static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); static void OnSubscriptionEstablished(void * context) { CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef); + reinterpret_cast(context)->javaCallbackRef); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); }; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index f4bc1593fd904f..4101050502be0a 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -3285,7 +3285,7 @@ public interface LaunchURLResponseCallback { void onError(Exception error); } - public interface AcceptsHeaderListAttributeCallback { + public interface AcceptHeaderListAttributeCallback { void onSuccess(List valueList); void onError(Exception ex); @@ -3301,8 +3301,8 @@ public interface AttributeListAttributeCallback { default void onSubscriptionEstablished() {} } - public void readAcceptsHeaderListAttribute(AcceptsHeaderListAttributeCallback callback) { - readAcceptsHeaderListAttribute(chipClusterPtr, callback); + public void readAcceptHeaderListAttribute(AcceptHeaderListAttributeCallback callback) { + readAcceptHeaderListAttribute(chipClusterPtr, callback); } public void readSupportedStreamingProtocolsAttribute(LongAttributeCallback callback) { @@ -3333,8 +3333,8 @@ public void subscribeClusterRevisionAttribute( subscribeClusterRevisionAttribute(chipClusterPtr, callback, minInterval, maxInterval); } - private native void readAcceptsHeaderListAttribute( - long chipClusterPtr, AcceptsHeaderListAttributeCallback callback); + private native void readAcceptHeaderListAttribute( + long chipClusterPtr, AcceptHeaderListAttributeCallback callback); private native void readSupportedStreamingProtocolsAttribute( long chipClusterPtr, LongAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 90903eccfe26d9..ab81448263a98d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -889,8 +889,8 @@ public void onError(Exception error) { } } - public static class DelegatedContentLauncherClusterAcceptsHeaderListAttributeCallback - implements ChipClusters.ContentLauncherCluster.AcceptsHeaderListAttributeCallback, + public static class DelegatedContentLauncherClusterAcceptHeaderListAttributeCallback + implements ChipClusters.ContentLauncherCluster.AcceptHeaderListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -903,7 +903,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = - new CommandResponseInfo("valueList", "List"); + new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 3583754cfbe90c..062c4e11dd679e 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -1673,23 +1673,23 @@ public Map> getReadAttributeMap() { "readClusterRevisionAttribute", readColorControlClusterRevisionAttributeInteractionInfo); readAttributeMap.put("colorControl", readColorControlInteractionInfo); Map readContentLauncherInteractionInfo = new LinkedHashMap<>(); - Map readContentLauncherAcceptsHeaderListCommandParams = + Map readContentLauncherAcceptHeaderListCommandParams = new LinkedHashMap(); - InteractionInfo readContentLauncherAcceptsHeaderListAttributeInteractionInfo = + InteractionInfo readContentLauncherAcceptHeaderListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ContentLauncherCluster) cluster) - .readAcceptsHeaderListAttribute( - (ChipClusters.ContentLauncherCluster.AcceptsHeaderListAttributeCallback) + .readAcceptHeaderListAttribute( + (ChipClusters.ContentLauncherCluster.AcceptHeaderListAttributeCallback) callback); }, () -> new ClusterInfoMapping - .DelegatedContentLauncherClusterAcceptsHeaderListAttributeCallback(), - readContentLauncherAcceptsHeaderListCommandParams); + .DelegatedContentLauncherClusterAcceptHeaderListAttributeCallback(), + readContentLauncherAcceptHeaderListCommandParams); readContentLauncherInteractionInfo.put( - "readAcceptsHeaderListAttribute", - readContentLauncherAcceptsHeaderListAttributeInteractionInfo); + "readAcceptHeaderListAttribute", + readContentLauncherAcceptHeaderListAttributeInteractionInfo); Map readContentLauncherSupportedStreamingProtocolsCommandParams = new LinkedHashMap(); InteractionInfo readContentLauncherSupportedStreamingProtocolsAttributeInteractionInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index cd19b6e5599669..c6005eb6b660a6 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -1362,9 +1362,9 @@ class ChipClusters: }, "attributes": { 0x00000000: { - "attributeName": "AcceptsHeaderList", + "attributeName": "AcceptHeaderList", "attributeId": 0x00000000, - "type": "bytes", + "type": "str", "reportable": True, }, 0x00000001: { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 7b17da90f9cd04..2142485555d8fe 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -28653,14 +28653,14 @@ class ContentLauncher(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="acceptsHeaderList", Tag=0x00000000, Type=typing.List[bytes]), + ClusterObjectFieldDescriptor(Label="acceptHeaderList", Tag=0x00000000, Type=typing.List[str]), ClusterObjectFieldDescriptor(Label="supportedStreamingProtocols", Tag=0x00000001, Type=uint), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), ]) - acceptsHeaderList: 'typing.List[bytes]' = None + acceptHeaderList: 'typing.List[str]' = None supportedStreamingProtocols: 'uint' = None attributeList: 'typing.List[uint]' = None featureMap: 'typing.Optional[uint]' = None @@ -28850,7 +28850,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: class Attributes: @dataclass - class AcceptsHeaderList(ClusterAttributeDescriptor): + class AcceptHeaderList(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x050A @@ -28861,9 +28861,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[bytes]) + return ClusterObjectFieldDescriptor(Type=typing.List[str]) - value: 'typing.List[bytes]' = field(default_factory=lambda: []) + value: 'typing.List[str]' = field(default_factory=lambda: []) @dataclass class SupportedStreamingProtocols(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 5df08da8882552..460945b34975b9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -1936,8 +1936,8 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader case Clusters::ContentLauncher::Id: { using namespace Clusters::ContentLauncher; switch (aPath.mAttributeId) { - case Attributes::AcceptsHeaderList::Id: { - using TypeInfo = Attributes::AcceptsHeaderList::TypeInfo; + case Attributes::AcceptHeaderList::Id: { + using TypeInfo = Attributes::AcceptHeaderList::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -1948,8 +1948,8 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; + NSString * newElement_0; + newElement_0 = [[NSString alloc] initWithBytes:entry_0.data() length:entry_0.size() encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index e041b5dc1bdf8d..265deb06298007 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -1610,16 +1610,16 @@ } } -void CHIPContentLauncherAcceptsHeaderListListAttributeCallbackBridge::OnSuccessFn( - void * context, const chip::app::DataModel::DecodableList & value) +void CHIPContentLauncherAcceptHeaderListListAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::DecodableList & value) { NSArray * _Nonnull objCValue; auto * array_0 = [NSMutableArray new]; auto iter_0 = value.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; + NSString * newElement_0; + newElement_0 = [[NSString alloc] initWithBytes:entry_0.data() length:entry_0.size() encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named @@ -1633,9 +1633,9 @@ DispatchSuccess(context, objCValue); }; -void CHIPContentLauncherAcceptsHeaderListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +void CHIPContentLauncherAcceptHeaderListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) { - auto * self = static_cast(context); + auto * self = static_cast(context); if (!self->mQueue) { return; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 1e3603fbe12549..db13503bea1d50 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -1822,25 +1822,25 @@ class CHIPColorControlAttributeListListAttributeCallbackSubscriptionBridge SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPContentLauncherAcceptsHeaderListListAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPContentLauncherAcceptHeaderListListAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPContentLauncherAcceptsHeaderListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + CHIPContentLauncherAcceptHeaderListListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; - static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); + static void OnSuccessFn(void * context, const chip::app::DataModel::DecodableList & value); }; -class CHIPContentLauncherAcceptsHeaderListListAttributeCallbackSubscriptionBridge - : public CHIPContentLauncherAcceptsHeaderListListAttributeCallbackBridge +class CHIPContentLauncherAcceptHeaderListListAttributeCallbackSubscriptionBridge + : public CHIPContentLauncherAcceptHeaderListListAttributeCallbackBridge { public: - CHIPContentLauncherAcceptsHeaderListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, - SubscriptionEstablishedHandler establishedHandler) : - CHIPContentLauncherAcceptsHeaderListListAttributeCallbackBridge(queue, handler, action, true), + CHIPContentLauncherAcceptHeaderListListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPContentLauncherAcceptHeaderListListAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 42dabdd81919e4..18ca18770e82e0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -1154,13 +1154,13 @@ NS_ASSUME_NONNULL_BEGIN completionHandler:(void (^)(CHIPContentLauncherClusterLaunchURLResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; -- (void)readAttributeAcceptsHeaderListWithCompletionHandler:(void (^)(NSArray * _Nullable value, - NSError * _Nullable error))completionHandler; -- (void)subscribeAttributeAcceptsHeaderListWithMinInterval:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler: - (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; +- (void)readAttributeAcceptHeaderListWithCompletionHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeAcceptHeaderListWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; - (void)readAttributeSupportedStreamingProtocolsWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index c26fefa3c323ba..610c1597299347 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -5063,33 +5063,33 @@ new CHIPContentLauncherClusterLaunchURLResponseCallbackBridge( }); } -- (void)readAttributeAcceptsHeaderListWithCompletionHandler:(void (^)(NSArray * _Nullable value, - NSError * _Nullable error))completionHandler +- (void)readAttributeAcceptHeaderListWithCompletionHandler:(void (^)(NSArray * _Nullable value, + NSError * _Nullable error))completionHandler { - new CHIPContentLauncherAcceptsHeaderListListAttributeCallbackBridge( + new CHIPContentLauncherAcceptHeaderListListAttributeCallbackBridge( self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = ContentLauncher::Attributes::AcceptHeaderList::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); } -- (void)subscribeAttributeAcceptsHeaderListWithMinInterval:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler: - (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAcceptHeaderListWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPContentLauncherAcceptsHeaderListListAttributeCallbackSubscriptionBridge( + new CHIPContentLauncherAcceptHeaderListListAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = ContentLauncher::Attributes::AcceptHeaderList::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, minInterval, maxInterval, - CHIPContentLauncherAcceptsHeaderListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + CHIPContentLauncherAcceptHeaderListListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); }, subscriptionEstablishedHandler); } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h index 5aa678b0be1c45..b6103a5cacdcde 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h @@ -268,7 +268,7 @@ NS_ASSUME_NONNULL_BEGIN */ @interface CHIPTestContentLauncher : CHIPContentLauncher -- (void)writeAttributeAcceptsHeaderListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeAcceptHeaderListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 633f34100cfdb8..228add49464638 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -2522,7 +2522,7 @@ @implementation CHIPTestContentLauncher return &_cppCluster; } -- (void)writeAttributeAcceptsHeaderListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeAcceptHeaderListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -2531,7 +2531,7 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ContentLauncher::Attributes::AcceptsHeaderList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AcceptHeaderList::TypeInfo; TypeInfo::Type cppValue; { using ListType_0 = std::remove_reference_t; @@ -2543,12 +2543,12 @@ new CHIPDefaultSuccessCallbackBridge( } listFreer.add(listHolder_0); for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[NSData class]]) { + if (![value[i_0] isKindOfClass:[NSString class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_0 = (NSData *) value[i_0]; - listHolder_0->mList[i_0] = [self asByteSpan:element_0]; + auto element_0 = (NSString *) value[i_0]; + listHolder_0->mList[i_0] = [self asCharSpan:element_0]; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index a379d3fc4aeded..bd032ada1dd4a9 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -34512,7 +34512,7 @@ - (void)testSendClusterColorControlReadAttributeClusterRevisionWithCompletionHan [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterContentLauncherReadAttributeAcceptsHeaderListWithCompletionHandler +- (void)testSendClusterContentLauncherReadAttributeAcceptHeaderListWithCompletionHandler { dispatch_queue_t queue = dispatch_get_main_queue(); @@ -34526,10 +34526,10 @@ - (void)testSendClusterContentLauncherReadAttributeAcceptsHeaderListWithCompleti XCTAssertNotNil(cluster); XCTestExpectation * expectation = - [self expectationWithDescription:@"ContentLauncherReadAttributeAcceptsHeaderListWithCompletionHandler"]; + [self expectationWithDescription:@"ContentLauncherReadAttributeAcceptHeaderListWithCompletionHandler"]; - [cluster readAttributeAcceptsHeaderListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"ContentLauncher AcceptsHeaderList Error: %@", err); + [cluster readAttributeAcceptHeaderListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"ContentLauncher AcceptHeaderList Error: %@", err); XCTAssertEqual(err.code, 0); [expectation fulfill]; }]; diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 962979b7b6ae59..7065f4a7a36911 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -466,7 +466,7 @@ \ /* Endpoint: 1, Cluster: Content Launcher (server), big-endian */ \ \ - /* 2264 - accepts header list, */ \ + /* 2264 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -1137,7 +1137,7 @@ \ /* Endpoint: 1, Cluster: Content Launcher (server), little-endian */ \ \ - /* 2264 - accepts header list, */ \ + /* 2264 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -2101,7 +2101,7 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2264) }, /* accepts header list */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2264) }, /* accept header list */ \ { 0x0001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(2518) }, /* supported streaming protocols */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index ad86368560140c..9ddbd1f7a19abf 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -1416,7 +1416,7 @@ // Client attributes // Server attributes -#define ZCL_CONTENT_LAUNCHER_ACCEPTS_HEADER_ATTRIBUTE_ID (0x0000) +#define ZCL_CONTENT_LAUNCHER_ACCEPT_HEADER_ATTRIBUTE_ID (0x0000) #define ZCL_CONTENT_LAUNCHER_SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID (0x0001) // Attribute ids for cluster: Audio Output diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 8af4792ee8e875..4730d28779ad7c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -20930,8 +20930,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { switch (path.mAttributeId) { - case Attributes::AcceptsHeaderList::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, acceptsHeaderList)); + case Attributes::AcceptHeaderList::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, acceptHeaderList)); break; case Attributes::SupportedStreamingProtocols::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, supportedStreamingProtocols)); 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 32c84506228d8b..1b77d84c53ca1e 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 @@ -32109,6 +32109,13 @@ enum class ContentLaunchStatus : uint8_t using ContentLaunchStatus = EmberAfContentLaunchStatus; #endif +// Bitmap for SupportedStreamingProtocol +enum class SupportedStreamingProtocol : uint32_t +{ + kDash = 0x1, + kHls = 0x2, +}; + namespace Structs { namespace ContentLaunchDimension { enum class Fields @@ -32408,18 +32415,18 @@ struct DecodableType namespace Attributes { -namespace AcceptsHeaderList { +namespace AcceptHeaderList { struct TypeInfo { - using Type = DataModel::List; - using DecodableType = DataModel::DecodableList; - using DecodableArgType = const DataModel::DecodableList &; + using Type = DataModel::List; + using DecodableType = DataModel::DecodableList; + using DecodableArgType = const DataModel::DecodableList &; static constexpr ClusterId GetClusterId() { return Clusters::ContentLauncher::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::AcceptsHeaderList::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::AcceptHeaderList::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace AcceptsHeaderList +} // namespace AcceptHeaderList namespace SupportedStreamingProtocols { struct TypeInfo { @@ -32477,7 +32484,7 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); - Attributes::AcceptsHeaderList::TypeInfo::DecodableType acceptsHeaderList; + Attributes::AcceptHeaderList::TypeInfo::DecodableType acceptHeaderList; Attributes::SupportedStreamingProtocols::TypeInfo::DecodableType supportedStreamingProtocols; Attributes::AttributeList::TypeInfo::DecodableType attributeList; Attributes::FeatureMap::TypeInfo::DecodableType featureMap; diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index 70ce299d265bf8..93d0a3b6728194 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -1214,6 +1214,10 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_START_TIME_TIME_ENCODING_OFFSET (6) #define EMBER_AF_START_TIME_HOURS (65280) #define EMBER_AF_START_TIME_HOURS_OFFSET (8) +#define EMBER_AF_SUPPORTED_STREAMING_PROTOCOL_DASH (1) +#define EMBER_AF_SUPPORTED_STREAMING_PROTOCOL_DASH_OFFSET (0) +#define EMBER_AF_SUPPORTED_STREAMING_PROTOCOL_HLS (2) +#define EMBER_AF_SUPPORTED_STREAMING_PROTOCOL_HLS_OFFSET (1) #define EMBER_AF_SWITCH_FEATURE_LATCHING_SWITCH (1) #define EMBER_AF_SWITCH_FEATURE_LATCHING_SWITCH_OFFSET (0) #define EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH (2) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 4794917210dd97..4f1e90becfd3b5 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -4952,9 +4952,9 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; namespace ContentLauncher { namespace Attributes { -namespace AcceptsHeaderList { +namespace AcceptHeaderList { static constexpr AttributeId Id = 0x00000000; -} // namespace AcceptsHeaderList +} // namespace AcceptHeaderList namespace SupportedStreamingProtocols { static constexpr AttributeId Id = 0x00000001; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index c6e534819cce58..5033d7823eceb0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -13468,7 +13468,7 @@ class ReportColorControlClusterRevision : public ModelCommand | * LaunchURL | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | -| * AcceptsHeaderList | 0x0000 | +| * AcceptHeaderList | 0x0000 | | * SupportedStreamingProtocols | 0x0001 | | * AttributeList | 0xFFFB | | * ClusterRevision | 0xFFFD | @@ -13527,18 +13527,18 @@ class ContentLauncherLaunchURL : public ModelCommand }; /* - * Attribute AcceptsHeaderList + * Attribute AcceptHeaderList */ -class ReadContentLauncherAcceptsHeaderList : public ModelCommand +class ReadContentLauncherAcceptHeaderList : public ModelCommand { public: - ReadContentLauncherAcceptsHeaderList() : ModelCommand("read") + ReadContentLauncherAcceptHeaderList() : ModelCommand("read") { - AddArgument("attr-name", "accepts-header-list"); + AddArgument("attr-name", "accept-header-list"); ModelCommand::AddArguments(); } - ~ReadContentLauncherAcceptsHeaderList() {} + ~ReadContentLauncherAcceptHeaderList() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13546,29 +13546,29 @@ class ReadContentLauncherAcceptsHeaderList : public ModelCommand chip::Controller::ContentLauncherCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttribute( + return cluster.ReadAttribute( this, OnAttributeResponse, OnDefaultFailure); } - static void OnAttributeResponse(void * context, const chip::app::DataModel::DecodableList & value) + static void OnAttributeResponse(void * context, const chip::app::DataModel::DecodableList & value) { - OnGeneralAttributeResponse(context, "ContentLauncher.AcceptsHeaderList response", value); + OnGeneralAttributeResponse(context, "ContentLauncher.AcceptHeaderList response", value); } }; -class ReportContentLauncherAcceptsHeaderList : public ModelCommand +class ReportContentLauncherAcceptHeaderList : public ModelCommand { public: - ReportContentLauncherAcceptsHeaderList() : ModelCommand("report") + ReportContentLauncherAcceptHeaderList() : ModelCommand("report") { - AddArgument("attr-name", "accepts-header-list"); + AddArgument("attr-name", "accept-header-list"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~ReportContentLauncherAcceptsHeaderList() {} + ~ReportContentLauncherAcceptHeaderList() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13578,7 +13578,7 @@ class ReportContentLauncherAcceptsHeaderList : public ModelCommand cluster.Associate(device, endpointId); auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; - return cluster.SubscribeAttribute( + return cluster.SubscribeAttribute( this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } @@ -13587,9 +13587,9 @@ class ReportContentLauncherAcceptsHeaderList : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } - static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) { - LogValue("ContentLauncher.AcceptsHeaderList report", 0, value); + LogValue("ContentLauncher.AcceptHeaderList report", 0, value); } private: @@ -51196,7 +51196,7 @@ void registerClusterContentLauncher(Commands & commands) commands_list clusterCommands = { make_unique(), // make_unique(), // - make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 52cd3a46642d82..557b175ce280dc 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -130,6 +130,7 @@ class TestList : public Command printf("TV_MediaPlaybackCluster\n"); printf("TV_TvChannelCluster\n"); printf("TV_LowPowerCluster\n"); + printf("TV_ContentLauncherCluster\n"); printf("TV_MediaInputCluster\n"); printf("TestCluster\n"); printf("TestClusterComplexTypes\n"); @@ -33967,6 +33968,215 @@ class TV_LowPowerCluster : public TestCommand void OnSuccessResponse_1() { NextTest(); } }; +class TV_ContentLauncherCluster : public TestCommand +{ +public: + TV_ContentLauncherCluster() : TestCommand("TV_ContentLauncherCluster"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: TV_ContentLauncherCluster\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: TV_ContentLauncherCluster\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute accept header list\n"); + err = TestReadAttributeAcceptHeaderList_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute supported streaming protocols\n"); + err = TestReadAttributeSupportedStreamingProtocols_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Launch Content Command\n"); + err = TestLaunchContentCommand_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Launch URL Command\n"); + err = TestLaunchUrlCommand_4(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, const chip::app::DataModel::DecodableList & acceptHeaderList) + { + (static_cast(context))->OnSuccessResponse_1(acceptHeaderList); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint32_t supportedStreamingProtocols) + { + (static_cast(context))->OnSuccessResponse_2(supportedStreamingProtocols); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadAttributeAcceptHeaderList_1() + { + const chip::EndpointId endpoint = mEndpointId.HasValue() ? mEndpointId.Value() : 1; + chip::Controller::ContentLauncherClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(const chip::app::DataModel::DecodableList & acceptHeaderList) + { + auto iter = acceptHeaderList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acceptHeaderList", iter, 0)); + VerifyOrReturn(CheckValueAsString("acceptHeaderList[0]", iter.GetValue(), chip::CharSpan("example", 7))); + VerifyOrReturn(CheckNextListItemDecodes("acceptHeaderList", iter, 1)); + VerifyOrReturn(CheckValueAsString("acceptHeaderList[1]", iter.GetValue(), chip::CharSpan("example", 7))); + VerifyOrReturn(CheckNoMoreListItems("acceptHeaderList", iter, 2)); + + NextTest(); + } + + CHIP_ERROR TestReadAttributeSupportedStreamingProtocols_2() + { + const chip::EndpointId endpoint = mEndpointId.HasValue() ? mEndpointId.Value() : 1; + chip::Controller::ContentLauncherClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint32_t supportedStreamingProtocols) + { + VerifyOrReturn(CheckValue("supportedStreamingProtocols", supportedStreamingProtocols, 0UL)); + + NextTest(); + } + + CHIP_ERROR TestLaunchContentCommand_3() + { + const chip::EndpointId endpoint = mEndpointId.HasValue() ? mEndpointId.Value() : 1; + using RequestType = chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type; + + RequestType request; + request.autoPlay = true; + request.data = chip::Span("exampleDatagarbage: not in length on purpose", 11); + + request.search = chip::app::DataModel::List(); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(data.contentLaunchStatus, data.data); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_3(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(chip::app::Clusters::ContentLauncher::ContentLaunchStatus contentLaunchStatus, chip::CharSpan data) + { + VerifyOrReturn(CheckValue("contentLaunchStatus", contentLaunchStatus, 0)); + + VerifyOrReturn(CheckValueAsString("data", data, chip::CharSpan("exampleData", 11))); + + NextTest(); + } + + CHIP_ERROR TestLaunchUrlCommand_4() + { + const chip::EndpointId endpoint = mEndpointId.HasValue() ? mEndpointId.Value() : 1; + using RequestType = chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type; + + RequestType request; + request.contentURL = chip::Span("exampleUrlgarbage: not in length on purpose", 10); + request.displayString = chip::Span("exampleDisplayStringgarbage: not in length on purpose", 20); + + request.brandingInformation = + chip::app::DataModel::List(); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_4(data.contentLaunchStatus, data.data); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(chip::app::Clusters::ContentLauncher::ContentLaunchStatus contentLaunchStatus, chip::CharSpan data) + { + VerifyOrReturn(CheckValue("contentLaunchStatus", contentLaunchStatus, 0)); + + VerifyOrReturn(CheckValueAsString("data", data, chip::CharSpan("exampleData", 11))); + + NextTest(); + } +}; + class TV_MediaInputCluster : public TestCommand { public: @@ -51922,6 +52132,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index 2df9174f0d2cd2..cd395f2a08fca2 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -553,10 +553,10 @@ void ColorControlClusterAttributeListListAttributeFilter(TLV::TLVReader * tlvDat cb->mCall(cb->mContext, list); } -void ContentLauncherClusterAcceptsHeaderListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) +void ContentLauncherClusterAcceptHeaderListListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) { - chip::app::DataModel::DecodableList list; + chip::app::DataModel::DecodableList list; CHIP_ERROR err = Decode(*tlvData, list); if (err != CHIP_NO_ERROR) { @@ -569,8 +569,8 @@ void ContentLauncherClusterAcceptsHeaderListListAttributeFilter(TLV::TLVReader * return; } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); cb->mCall(cb->mContext, list); } diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 63c28f75060381..6114dffd77005c 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -227,11 +227,11 @@ void ColorControlClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * chip::Callback::Cancelable * onFailureCallback); typedef void (*ColorControlAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); -void ContentLauncherClusterAcceptsHeaderListListAttributeFilter(chip::TLV::TLVReader * data, - chip::Callback::Cancelable * onSuccessCallback, - chip::Callback::Cancelable * onFailureCallback); -typedef void (*ContentLauncherAcceptsHeaderListListAttributeCallback)( - void * context, const chip::app::DataModel::DecodableList & data); +void ContentLauncherClusterAcceptHeaderListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ContentLauncherAcceptHeaderListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); void ContentLauncherClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); diff --git a/zzz_generated/tv-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-app/zap-generated/attribute-size.cpp index 455380a3520a50..6007186b1d689f 100644 --- a/zzz_generated/tv-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-app/zap-generated/attribute-size.cpp @@ -158,7 +158,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo uint16_t entryOffset = kSizeLengthInBytes; switch (am->attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list { entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) @@ -167,22 +167,22 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - ByteSpan * acceptsHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING - uint16_t acceptsHeaderListRemainingSpace = static_cast(am->size - entryOffset); + ByteSpan * acceptHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING + uint16_t acceptHeaderListRemainingSpace = static_cast(am->size - entryOffset); if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan) - : ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan))) + (write ? WriteByteSpan(dest + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan) + : ReadByteSpan(src + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - if (!CanCastTo(acceptsHeaderListSpan->size())) + if (!CanCastTo(acceptHeaderListSpan->size())) { - ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size()); + ChipLogError(Zcl, "Span size %zu is too large", acceptHeaderListSpan->size()); return 0; } - entryLength = static_cast(acceptsHeaderListSpan->size()); + entryLength = static_cast(acceptHeaderListSpan->size()); break; } } @@ -864,7 +864,7 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut case 0x050A: // Content Launcher Cluster switch (attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list // chip::ByteSpan return GetByteSpanOffsetFromIndex(buffer, 256, entryCount); break; diff --git a/zzz_generated/tv-app/zap-generated/endpoint_config.h b/zzz_generated/tv-app/zap-generated/endpoint_config.h index 69ffa9c6bb798d..03857299ad060b 100644 --- a/zzz_generated/tv-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-app/zap-generated/endpoint_config.h @@ -367,7 +367,7 @@ \ /* Endpoint: 1, Cluster: Content Launcher (server), big-endian */ \ \ - /* 1889 - accepts header list, */ \ + /* 1889 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -441,7 +441,7 @@ \ /* Endpoint: 3, Cluster: Content Launcher (server), big-endian */ \ \ - /* 2691 - accepts header list, */ \ + /* 2691 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -462,7 +462,7 @@ \ /* Endpoint: 4, Cluster: Content Launcher (server), big-endian */ \ \ - /* 2949 - accepts header list, */ \ + /* 2949 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -826,7 +826,7 @@ \ /* Endpoint: 1, Cluster: Content Launcher (server), little-endian */ \ \ - /* 1889 - accepts header list, */ \ + /* 1889 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -900,7 +900,7 @@ \ /* Endpoint: 3, Cluster: Content Launcher (server), little-endian */ \ \ - /* 2691 - accepts header list, */ \ + /* 2691 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -921,7 +921,7 @@ \ /* Endpoint: 4, Cluster: Content Launcher (server), little-endian */ \ \ - /* 2949 - accepts header list, */ \ + /* 2949 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -1242,7 +1242,7 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1889) }, /* accepts header list */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1889) }, /* accept header list */ \ { 0x0001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(2143) }, /* supported streaming protocols */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ @@ -1311,7 +1311,7 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 3, Cluster: Content Launcher (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2691) }, /* accepts header list */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2691) }, /* accept header list */ \ { 0x0001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(2945) }, /* supported streaming protocols */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ @@ -1336,7 +1336,7 @@ { 0xFFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 4, Cluster: Content Launcher (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2949) }, /* accepts header list */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2949) }, /* accept header list */ \ { 0x0001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(3203) }, /* supported streaming protocols */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ diff --git a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp index f23dd96d4c3c84..9fd437e395e1e4 100644 --- a/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp +++ b/zzz_generated/tv-casting-app/zap-generated/attribute-size.cpp @@ -158,7 +158,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo uint16_t entryOffset = kSizeLengthInBytes; switch (am->attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list { entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast(index - 1)); if (entryOffset == 0) @@ -167,22 +167,22 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo return 0; } - ByteSpan * acceptsHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING - uint16_t acceptsHeaderListRemainingSpace = static_cast(am->size - entryOffset); + ByteSpan * acceptHeaderListSpan = reinterpret_cast(write ? src : dest); // OCTET_STRING + uint16_t acceptHeaderListRemainingSpace = static_cast(am->size - entryOffset); if (CHIP_NO_ERROR != - (write ? WriteByteSpan(dest + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan) - : ReadByteSpan(src + entryOffset, acceptsHeaderListRemainingSpace, acceptsHeaderListSpan))) + (write ? WriteByteSpan(dest + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan) + : ReadByteSpan(src + entryOffset, acceptHeaderListRemainingSpace, acceptHeaderListSpan))) { ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index); return 0; } - if (!CanCastTo(acceptsHeaderListSpan->size())) + if (!CanCastTo(acceptHeaderListSpan->size())) { - ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size()); + ChipLogError(Zcl, "Span size %zu is too large", acceptHeaderListSpan->size()); return 0; } - entryLength = static_cast(acceptsHeaderListSpan->size()); + entryLength = static_cast(acceptHeaderListSpan->size()); break; } } @@ -974,7 +974,7 @@ uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attribut case 0x050A: // Content Launcher Cluster switch (attributeId) { - case 0x0000: // accepts header list + case 0x0000: // accept header list // chip::ByteSpan return GetByteSpanOffsetFromIndex(buffer, 256, entryCount); break; diff --git a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h index 7b99fc7b819629..b6e6d6f4058167 100644 --- a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h @@ -411,7 +411,7 @@ \ /* Endpoint: 1, Cluster: Content Launcher (server), big-endian */ \ \ - /* 2183 - accepts header list, */ \ + /* 2183 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -910,7 +910,7 @@ \ /* Endpoint: 1, Cluster: Content Launcher (server), little-endian */ \ \ - /* 2183 - accepts header list, */ \ + /* 2183 - accept header list, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -1590,7 +1590,7 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2183) }, /* accepts header list */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(2183) }, /* accept header list */ \ { 0x0001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(2437) }, /* supported streaming protocols */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \