From 63e0b71bbba907888e4040859296e985623634a8 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Mon, 17 Jun 2024 23:03:27 +0300 Subject: [PATCH 01/10] RDK-43262 : Added getPrivacyMode/setPrivacyMode calls and rbus event. --- UserSettings/CMakeLists.txt | 20 ++- UserSettings/UserSettingsImplementation.cpp | 129 ++++++++++++++++++++ UserSettings/UserSettingsImplementation.h | 13 +- 3 files changed, 160 insertions(+), 2 deletions(-) diff --git a/UserSettings/CMakeLists.txt b/UserSettings/CMakeLists.txt index 02f848239a..e0c39d2e71 100755 --- a/UserSettings/CMakeLists.txt +++ b/UserSettings/CMakeLists.txt @@ -49,7 +49,24 @@ add_library(${PLUGIN_IMPLEMENTATION} SHARED UserSettingsImplementation.cpp Module.cpp) + +find_path(RBUS_API_HEADER NAMES rbus.h PATH_SUFFIXES rbus) + +if (NOT ${RBUS_API_HEADER} STREQUAL "RBUS_API_HEADER-NOTFOUND") + message("Found rbus.h ${RBUS_API_HEADER}") + add_definitions (-DHAS_RBUS) + set(RBUS_API_HEADERS ${RBUS_API_HEADER}) +find_library(RBUS_LIBRARY NAMES rbus) +endif() + +set(RBUS_LIBRARIES "") +if (NOT ${RBUS_LIBRARY} STREQUAL "RBUS_LIBRARY-NOTFOUND") + set(RBUS_LIBRARIES ${RBUS_LIBRARY}) +endif() + + include_directories( + ${RBUS_API_HEADERS} ../helpers) set_target_properties(${PLUGIN_IMPLEMENTATION} PROPERTIES @@ -59,7 +76,8 @@ set_target_properties(${PLUGIN_IMPLEMENTATION} PROPERTIES target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE CompileSettingsDebug::CompileSettingsDebug - ${NAMESPACE}Plugins::${NAMESPACE}Plugins) + ${NAMESPACE}Plugins::${NAMESPACE}Plugins + ${RBUS_LIBRARIES}) install(TARGETS ${PLUGIN_IMPLEMENTATION} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/${STORAGE_DIRECTORY}/plugins) diff --git a/UserSettings/UserSettingsImplementation.cpp b/UserSettings/UserSettingsImplementation.cpp index 5dd186fd0b..ed5dd5e574 100755 --- a/UserSettings/UserSettingsImplementation.cpp +++ b/UserSettings/UserSettingsImplementation.cpp @@ -31,6 +31,12 @@ #define USERSETTINGS_CAPTIONS_KEY "captions" #define USERSETTINGS_PREFERRED_CAPTIONS_LANGUAGES_KEY "preferredCaptionsLanguages" #define USERSETTINGS_PREFERRED_CLOSED_CAPTIONS_SERVICE_KEY "preferredClosedCaptionsService" +#define USERSETTINGS_PRIVACY_MODE_KEY "privacyMode" + +#ifdef HAS_RBUS +#define RBUS_COMPONENT_NAME "UserSettingsThunderPlugin" +#define RBUS_PRIVACY_MODE_EVENT_NAME "Device.X_RDKCENTRAL-COM_UserSettings.PrivacyModeChanged" +#endif namespace WPEFramework { namespace Plugin { @@ -45,6 +51,9 @@ UserSettingsImplementation::UserSettingsImplementation() , _remotStoreObject(nullptr) , _storeNotification(*this) , _registeredEventHandlers(false) +#ifdef HAS_RBUS +, _rbusHandleStatus(RBUS_ERROR_NOT_INITIALIZED) +#endif { LOGINFO("Create UserSettingsImplementation Instance"); @@ -122,6 +131,15 @@ UserSettingsImplementation::~UserSettingsImplementation() _remotStoreObject->Release(); } _registeredEventHandlers = false; + +#ifdef HAS_RBUS + if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) + { + rbus_close(_rbusHandle); + _rbusHandleStatus = RBUS_ERROR_NOT_INITIALIZED; + } + +#endif } void UserSettingsImplementation::registerEventHandlers() @@ -246,6 +264,14 @@ void UserSettingsImplementation::Dispatch(Event event, const JsonValue params) } break; + case PRIVACY_MODE_CHANGED: + while (index != _userSettingNotification.end()) + { + (*index)->OnPrivacyModeChanged(params.String()); + ++index; + } + break; + default: break; } @@ -281,6 +307,10 @@ void UserSettingsImplementation::ValueChanged(const Exchange::IStore2::ScopeType { dispatchEvent(PREFERRED_CLOSED_CAPTIONS_SERVICE_CHANGED, JsonValue((string)value)); } + else if((ns.compare(USERSETTINGS_NAMESPACE) == 0) && (key.compare(USERSETTINGS_PRIVACY_MODE_KEY) == 0)) + { + dispatchEvent(PRIVACY_MODE_CHANGED, JsonValue((string)value)); + } else { LOGERR("Not supported"); @@ -550,5 +580,104 @@ uint32_t UserSettingsImplementation::GetPreferredClosedCaptionService(string &se return status; } + +uint32_t UserSettingsImplementation::SetPrivacyMode(const string& privacyMode) +{ + uint32_t status = Core::ERROR_GENERAL; + + LOGINFO("privacyMode: %s", privacyMode.c_str()); + + _adminLock.Lock(); + + ASSERT (nullptr != _remotStoreObject); + + if (nullptr != _remotStoreObject) + { + uint32_t ttl = 0; + string oldPrivacyMode; + status = _remotStoreObject->GetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, oldPrivacyMode, ttl); + +#ifdef HAS_RBUS + if (Core::ERROR_NONE == status) + { + if (RBUS_ERROR_SUCCESS != _rbusHandleStatus) + { + _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); + } + + if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) + { + + rbusEvent_t event = {0}; + rbusObject_t data; + rbusValue_t value; + rbusValue_t value2; + + rbusValue_Init(&value); + rbusValue_SetString(value, oldPrivacyMode.c_str()); + + rbusValue_Init(&value2); + rbusValue_SetString(value2, privacyMode.c_str()); + + + rbusObject_Init(&data, NULL); + rbusObject_SetValue(data, "oldPrivacyMode", value); + rbusObject_SetValue(data, "privacyMode", value2); + + event.name = RBUS_PRIVACY_MODE_EVENT_NAME; + event.data = data; + event.type = RBUS_EVENT_GENERAL; + + int rc = rbusEvent_Publish(_rbusHandle, &event); + if (RBUS_ERROR_SUCCESS != rc) + { + std::stringstream str; + str << "Failed to publish " << RBUS_PRIVACY_MODE_EVENT_NAME << ": " << rc; + LOGERR("%s", str.str().c_str()); + } + + rbusValue_Release(value); + rbusValue_Release(value2); + rbusObject_Release(data); + + } + else + { + std::stringstream str; + str << "rbus_open failed with error code " << _rbusHandleStatus; + LOGERR("%s", str.str().c_str()); + return Core::ERROR_OPENING_FAILED; + } + } +#endif + + status = _remotStoreObject->SetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, 0); + } + + _adminLock.Unlock(); + + return status; +} + +uint32_t UserSettingsImplementation::GetPrivacyMode(string &privacyMode) const +{ + uint32_t status = Core::ERROR_GENERAL; + std::string value = ""; + uint32_t ttl = 0; + + _adminLock.Lock(); + + ASSERT (nullptr != _remotStoreObject); + + if (nullptr != _remotStoreObject) + { + status = _remotStoreObject->GetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, ttl); + } + + _adminLock.Unlock(); + + return status; +} + } // namespace Plugin } // namespace WPEFramework diff --git a/UserSettings/UserSettingsImplementation.h b/UserSettings/UserSettingsImplementation.h index 83d967627b..d2cb8169ed 100755 --- a/UserSettings/UserSettingsImplementation.h +++ b/UserSettings/UserSettingsImplementation.h @@ -30,6 +30,10 @@ #include #include +#ifdef HAS_RBUS +#include "rbus.h" +#endif + namespace WPEFramework { namespace Plugin { class UserSettingsImplementation : public Exchange::IUserSettings{ @@ -82,7 +86,8 @@ namespace Plugin { PRESENTATION_LANGUAGE_CHANGED, CAPTIONS_CHANGED, PREFERRED_CAPTIONS_LANGUAGE_CHANGED, - PREFERRED_CLOSED_CAPTIONS_SERVICE_CHANGED + PREFERRED_CLOSED_CAPTIONS_SERVICE_CHANGED, + PRIVACY_MODE_CHANGED }; class EXTERNAL Job : public Core::IDispatch { @@ -139,6 +144,8 @@ namespace Plugin { uint32_t GetPreferredCaptionsLanguages(string &preferredLanguages) const override; uint32_t SetPreferredClosedCaptionService(const string& service) override; uint32_t GetPreferredClosedCaptionService(string &service) const override; + uint32_t SetPrivacyMode(const string& privacyMode) override; + uint32_t GetPrivacyMode(string &privacyMode) const override; void registerEventHandlers(); void ValueChanged(const Exchange::IStore2::ScopeType scope, const string& ns, const string& key, const string& value); @@ -153,6 +160,10 @@ namespace Plugin { Core::Sink _storeNotification; bool _registeredEventHandlers; +#ifdef HAS_RBUS + rbusError_t _rbusHandleStatus; + rbusHandle_t _rbusHandle; +#endif void dispatchEvent(Event, const JsonValue ¶ms); void Dispatch(Event event, const JsonValue params); From 6a34f013929ea705ee59fedcefeaa522883fb781 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Tue, 18 Jun 2024 02:00:49 +0300 Subject: [PATCH 02/10] Added implementation for OnPrivacyModeChanged. --- UserSettings/UserSettings.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UserSettings/UserSettings.h b/UserSettings/UserSettings.h index cdc83d4312..7ad29fd87e 100755 --- a/UserSettings/UserSettings.h +++ b/UserSettings/UserSettings.h @@ -104,6 +104,12 @@ namespace Plugin { Exchange::JUserSettings::Event::OnPreferredClosedCaptionServiceChanged(_parent, service); } + void OnPrivacyModeChanged(const string &privacyMode) override + { + LOGINFO("PrivacyModeChanged: %s\n", privacyMode.c_str()); + Exchange::JUserSettings::Event::OnPrivacyModeChanged(_parent, privacyMode); + } + private: UserSettings& _parent; }; From 5b2ef3be82e7b3d95609e081fa025fcb21b311f8 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Tue, 18 Jun 2024 06:37:23 +0300 Subject: [PATCH 03/10] Added check for privacyMode values. Added reg call for rbus event. --- UserSettings/UserSettingsImplementation.cpp | 109 ++++++++++++-------- 1 file changed, 66 insertions(+), 43 deletions(-) diff --git a/UserSettings/UserSettingsImplementation.cpp b/UserSettings/UserSettingsImplementation.cpp index ed5dd5e574..19f4b72526 100755 --- a/UserSettings/UserSettingsImplementation.cpp +++ b/UserSettings/UserSettingsImplementation.cpp @@ -587,6 +587,12 @@ uint32_t UserSettingsImplementation::SetPrivacyMode(const string& privacyMode) LOGINFO("privacyMode: %s", privacyMode.c_str()); + if (privacyMode != "SHARE" && privacyMode != "DO_NOT_SHARE") + { + LOGERR("Wrong privacyMode value: '%s', returning default", privacyMode.c_str()); + return status; + } + _adminLock.Lock(); ASSERT (nullptr != _remotStoreObject); @@ -596,62 +602,74 @@ uint32_t UserSettingsImplementation::SetPrivacyMode(const string& privacyMode) uint32_t ttl = 0; string oldPrivacyMode; status = _remotStoreObject->GetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, oldPrivacyMode, ttl); + LOGINFO("oldPrivacyMode: %s", oldPrivacyMode.c_str()); -#ifdef HAS_RBUS - if (Core::ERROR_NONE == status) + if (privacyMode != oldPrivacyMode) { - if (RBUS_ERROR_SUCCESS != _rbusHandleStatus) - { - _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); - } - - if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) +#ifdef HAS_RBUS + if (Core::ERROR_NONE == status) { + if (RBUS_ERROR_SUCCESS != _rbusHandleStatus) + { + _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); - rbusEvent_t event = {0}; - rbusObject_t data; - rbusValue_t value; - rbusValue_t value2; - - rbusValue_Init(&value); - rbusValue_SetString(value, oldPrivacyMode.c_str()); - - rbusValue_Init(&value2); - rbusValue_SetString(value2, privacyMode.c_str()); - + rbusDataElement_t dataElements[1] = { + {(char *)RBUS_PRIVACY_MODE_EVENT_NAME, RBUS_ELEMENT_TYPE_EVENT, {NULL, NULL, NULL, NULL, NULL, NULL}}, + }; - rbusObject_Init(&data, NULL); - rbusObject_SetValue(data, "oldPrivacyMode", value); - rbusObject_SetValue(data, "privacyMode", value2); + int rc = rbus_regDataElements(_rbusHandle, 1, dataElements); + if (rc != RBUS_ERROR_SUCCESS) + { + LOGERR("rbus_regDataElements failed: %d", rc); - event.name = RBUS_PRIVACY_MODE_EVENT_NAME; - event.data = data; - event.type = RBUS_EVENT_GENERAL; + rbus_close(_rbusHandle); + _rbusHandleStatus = RBUS_ERROR_NOT_INITIALIZED; + } + } - int rc = rbusEvent_Publish(_rbusHandle, &event); - if (RBUS_ERROR_SUCCESS != rc) + if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) + { + rbusEvent_t event = {0}; + rbusObject_t data; + rbusValue_t value; + rbusValue_t value2; + + rbusValue_Init(&value); + rbusValue_SetString(value, oldPrivacyMode.c_str()); + + rbusValue_Init(&value2); + rbusValue_SetString(value2, privacyMode.c_str()); + + rbusObject_Init(&data, NULL); + rbusObject_SetValue(data, "oldPrivacyMode", value); + rbusObject_SetValue(data, "privacyMode", value2); + + event.name = RBUS_PRIVACY_MODE_EVENT_NAME; + event.data = data; + event.type = RBUS_EVENT_GENERAL; + + int rc = rbusEvent_Publish(_rbusHandle, &event); + if (RBUS_ERROR_SUCCESS != rc) + { + std::stringstream str; + str << "Failed to publish " << RBUS_PRIVACY_MODE_EVENT_NAME << ": " << rc; + LOGERR("%s", str.str().c_str()); + } + + rbusValue_Release(value); + rbusValue_Release(value2); + rbusObject_Release(data); + } + else { std::stringstream str; - str << "Failed to publish " << RBUS_PRIVACY_MODE_EVENT_NAME << ": " << rc; + str << "rbus_open failed with error code " << _rbusHandleStatus; LOGERR("%s", str.str().c_str()); } - - rbusValue_Release(value); - rbusValue_Release(value2); - rbusObject_Release(data); - - } - else - { - std::stringstream str; - str << "rbus_open failed with error code " << _rbusHandleStatus; - LOGERR("%s", str.str().c_str()); - return Core::ERROR_OPENING_FAILED; } - } #endif - - status = _remotStoreObject->SetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, 0); + status = _remotStoreObject->SetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, 0); + } } _adminLock.Unlock(); @@ -672,6 +690,11 @@ uint32_t UserSettingsImplementation::GetPrivacyMode(string &privacyMode) const if (nullptr != _remotStoreObject) { status = _remotStoreObject->GetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, ttl); + if (privacyMode != "SHARE" && privacyMode != "DO_NOT_SHARE") + { + LOGWARN("Wrong privacyMode value: '%s', returning default", privacyMode.c_str()); + privacyMode = "SHARE"; + } } _adminLock.Unlock(); From a3415c8eeda92f17d0da7cabff40f63566323955 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Tue, 18 Jun 2024 20:11:06 +0300 Subject: [PATCH 04/10] Moved registration of rbus event to constructor. --- UserSettings/UserSettingsImplementation.cpp | 38 +++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/UserSettings/UserSettingsImplementation.cpp b/UserSettings/UserSettingsImplementation.cpp index 19f4b72526..2e0a9225a1 100755 --- a/UserSettings/UserSettingsImplementation.cpp +++ b/UserSettings/UserSettingsImplementation.cpp @@ -88,6 +88,26 @@ UserSettingsImplementation::UserSettingsImplementation() } registerEventHandlers(); + +#ifdef HAS_RBUS + _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); + + if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) + { + rbusDataElement_t dataElements[1] = { + {(char *)RBUS_PRIVACY_MODE_EVENT_NAME, RBUS_ELEMENT_TYPE_EVENT, {NULL, NULL, NULL, NULL, NULL, NULL}}, + }; + + int rc = rbus_regDataElements(_rbusHandle, 1, dataElements); + if (rc != RBUS_ERROR_SUCCESS) + { + LOGERR("rbus_regDataElements failed: %d", rc); + + rbus_close(_rbusHandle); + _rbusHandleStatus = RBUS_ERROR_NOT_INITIALIZED; + } + } +#endif } } @@ -609,24 +629,6 @@ uint32_t UserSettingsImplementation::SetPrivacyMode(const string& privacyMode) #ifdef HAS_RBUS if (Core::ERROR_NONE == status) { - if (RBUS_ERROR_SUCCESS != _rbusHandleStatus) - { - _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); - - rbusDataElement_t dataElements[1] = { - {(char *)RBUS_PRIVACY_MODE_EVENT_NAME, RBUS_ELEMENT_TYPE_EVENT, {NULL, NULL, NULL, NULL, NULL, NULL}}, - }; - - int rc = rbus_regDataElements(_rbusHandle, 1, dataElements); - if (rc != RBUS_ERROR_SUCCESS) - { - LOGERR("rbus_regDataElements failed: %d", rc); - - rbus_close(_rbusHandle); - _rbusHandleStatus = RBUS_ERROR_NOT_INITIALIZED; - } - } - if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) { rbusEvent_t event = {0}; From 3f753f45b0f39b5fe8c767606471abdd3af34ed7 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Wed, 19 Jun 2024 05:33:59 +0300 Subject: [PATCH 05/10] Replaced rbus event by property setting. --- UserSettings/UserSettingsImplementation.cpp | 52 ++++----------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/UserSettings/UserSettingsImplementation.cpp b/UserSettings/UserSettingsImplementation.cpp index 2e0a9225a1..a3883a0b0e 100755 --- a/UserSettings/UserSettingsImplementation.cpp +++ b/UserSettings/UserSettingsImplementation.cpp @@ -88,26 +88,6 @@ UserSettingsImplementation::UserSettingsImplementation() } registerEventHandlers(); - -#ifdef HAS_RBUS - _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); - - if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) - { - rbusDataElement_t dataElements[1] = { - {(char *)RBUS_PRIVACY_MODE_EVENT_NAME, RBUS_ELEMENT_TYPE_EVENT, {NULL, NULL, NULL, NULL, NULL, NULL}}, - }; - - int rc = rbus_regDataElements(_rbusHandle, 1, dataElements); - if (rc != RBUS_ERROR_SUCCESS) - { - LOGERR("rbus_regDataElements failed: %d", rc); - - rbus_close(_rbusHandle); - _rbusHandleStatus = RBUS_ERROR_NOT_INITIALIZED; - } - } -#endif } } @@ -629,38 +609,26 @@ uint32_t UserSettingsImplementation::SetPrivacyMode(const string& privacyMode) #ifdef HAS_RBUS if (Core::ERROR_NONE == status) { + if (RBUS_ERROR_SUCCESS != _rbusHandleStatus) + { + _rbusHandleStatus = rbus_open(&_rbusHandle, RBUS_COMPONENT_NAME); + } + if (RBUS_ERROR_SUCCESS == _rbusHandleStatus) { - rbusEvent_t event = {0}; - rbusObject_t data; rbusValue_t value; - rbusValue_t value2; + rbusSetOptions_t opts = {true, 0}; rbusValue_Init(&value); - rbusValue_SetString(value, oldPrivacyMode.c_str()); - - rbusValue_Init(&value2); - rbusValue_SetString(value2, privacyMode.c_str()); - - rbusObject_Init(&data, NULL); - rbusObject_SetValue(data, "oldPrivacyMode", value); - rbusObject_SetValue(data, "privacyMode", value2); - - event.name = RBUS_PRIVACY_MODE_EVENT_NAME; - event.data = data; - event.type = RBUS_EVENT_GENERAL; - - int rc = rbusEvent_Publish(_rbusHandle, &event); - if (RBUS_ERROR_SUCCESS != rc) + rbusValue_SetString(value, privacyMode.c_str()); + int rc = rbus_set(_rbusHandle, RBUS_PRIVACY_MODE_EVENT_NAME, value, &opts); + if (rc != RBUS_ERROR_SUCCESS) { std::stringstream str; - str << "Failed to publish " << RBUS_PRIVACY_MODE_EVENT_NAME << ": " << rc; + str << "Failed to set property " << RBUS_PRIVACY_MODE_EVENT_NAME << ": " << rc; LOGERR("%s", str.str().c_str()); } - rbusValue_Release(value); - rbusValue_Release(value2); - rbusObject_Release(data); } else { From bd3c31f296b0c541cdd26f89aa0ac67c7e187a0a Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Mon, 24 Jun 2024 22:30:45 +0300 Subject: [PATCH 06/10] RDK-43262 : Updated api doc. --- docs/api/UserSettingsPlugin.md | 114 +++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/docs/api/UserSettingsPlugin.md b/docs/api/UserSettingsPlugin.md index 0b12ac820e..3a92f4c6a8 100755 --- a/docs/api/UserSettingsPlugin.md +++ b/docs/api/UserSettingsPlugin.md @@ -53,12 +53,14 @@ UserSettings interface methods: | [setcaptionsenabled](#setcaptionsenabled) | Setting Captions | | [setpreferredcaptionlanguages](#setpreferredcaptionlanguages) | Setting PreferredCaption Languages | | [setpreferredclosedcaptionservice](#setpreferredclosedcaptionservice) | Setting Preferred Closed Caption Service | +| [setprivacymode](#setprivacymode) | Setting PrivacyMode | | [getaudiodescription](#getaudiodescription) | Returns Audio Description | | [getpreferredaudiolanguages](#getpreferredaudiolanguages) | Returns Audio Description | | [getpresentationlanguages](#getpresentationlanguages) | Getting Presentation Languages | | [getcaptionsenabled](#getcaptionsenabled) | Getting Captions Enabled | | [GetPreferredCaptionLanguages](#GetPreferredCaptionLanguages) | Getting Preferred Caption Languages | | [GetPreferredClosedCaptionService](#GetPreferredClosedCaptionService) | Getting Preferred ClosedCaption Service | +| [getprivacymode](#getprivacymode) | Getting PrivacyMode | @@ -325,6 +327,50 @@ No Events } ``` + +## *setprivacymode* + +Setting PrivacyMode + +### Events + +No Events + +### Parameters + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| params | string | PrivacyMode: DO_NOT_SHARE | + +### Result + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| result | string | Null string will display | + +### Example + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 42, + "method": "org.rdk.UserSettings.setprivacymode", + "params": "DO_NOT_SHARE" +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 42, + "result": "null" +} +``` + ## *getaudiodescription* @@ -589,6 +635,50 @@ This method takes no parameters. } ``` + +## *getprivacymode* + +Getting PrivacyMode + +### Events + +No Events + +### Parameters + +This method takes no parameters. + +### Result + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| result | object | | +| result.privacymode | string | A string for the privacy mode. Valid values are SHARE(Default), DO_NOT_SHARE. | + +### Example + +#### Request + +```json +{ + "jsonrpc": "2.0", + "id": 42, + "method": "org.rdk.UserSettings.getprivacymode" +} +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 42, + "result": { + "privacymode": "SHARE" + } +} +``` + # Notifications @@ -606,6 +696,7 @@ UserSettings interface events: | [OnCaptionsChanged](#OnCaptionsChanged) | Triggered after the captions changes (see `setcaptionsenabled`) | | [OnPreferredCaptionsLanguagesChanged](#OnPreferredCaptionsLanguagesChanged) | Triggered after the PreferredCaption Languages changes (see `setpreferredcaptionlanguages`) | | [OnPreferredClosedCaptionServiceChanged](#OnPreferredClosedCaptionServiceChanged) | Triggered after the Preferred Closed Caption changes (see `setpreferredclosedcaptionservice`) | +| [OnPrivacyModeChanged](#OnPrivacyModeChanged) | Triggered after the Privacy Mode changes (see `setprivacymode`) | @@ -752,3 +843,26 @@ Triggered after the Preferred Closed Caption changes (see `setpreferredclosedcap } ``` + +## *OnPrivacyModeChanged [event](#head.Notifications)* + +Triggered after the Privacy Mode changes (see `setprivacymode`). + +### Parameters + +| Name | Type | Description | +| :-------- | :-------- | :-------- | +| params | object | | +| params.PrivacyModeChanged | string | Receive Privacy Mode changes | + +### Example + +```json +{ + "jsonrpc": "2.0", + "method": "client.events.OnPrivacyModeChanged", + "params": { + "PrivacyModeChanged": "DO_NOT_SHARE" + } +} +``` From 392fd5ff81c2ca64c317c32434312d487da5117b Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Tue, 25 Jun 2024 04:21:34 +0300 Subject: [PATCH 07/10] RDK-43262 : Fixed return of default privacyMode if it wasn't stored. --- UserSettings/UserSettingsImplementation.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/UserSettings/UserSettingsImplementation.cpp b/UserSettings/UserSettingsImplementation.cpp index a3883a0b0e..ea0629b1e8 100755 --- a/UserSettings/UserSettingsImplementation.cpp +++ b/UserSettings/UserSettingsImplementation.cpp @@ -649,9 +649,10 @@ uint32_t UserSettingsImplementation::SetPrivacyMode(const string& privacyMode) uint32_t UserSettingsImplementation::GetPrivacyMode(string &privacyMode) const { - uint32_t status = Core::ERROR_GENERAL; + uint32_t status = Core::ERROR_NONE; std::string value = ""; uint32_t ttl = 0; + privacyMode = ""; _adminLock.Lock(); @@ -659,15 +660,16 @@ uint32_t UserSettingsImplementation::GetPrivacyMode(string &privacyMode) const if (nullptr != _remotStoreObject) { - status = _remotStoreObject->GetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, ttl); - if (privacyMode != "SHARE" && privacyMode != "DO_NOT_SHARE") - { - LOGWARN("Wrong privacyMode value: '%s', returning default", privacyMode.c_str()); - privacyMode = "SHARE"; - } + _remotStoreObject->GetValue(Exchange::IStore2::ScopeType::DEVICE, USERSETTINGS_NAMESPACE, USERSETTINGS_PRIVACY_MODE_KEY, privacyMode, ttl); } _adminLock.Unlock(); + + if (privacyMode != "SHARE" && privacyMode != "DO_NOT_SHARE") + { + LOGWARN("Wrong privacyMode value: '%s', returning default", privacyMode.c_str()); + privacyMode = "SHARE"; + } return status; } From 7f50634aa39afb2ac4a4ab2439257c495844cb15 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Thu, 27 Jun 2024 19:28:06 +0300 Subject: [PATCH 08/10] Updated docs. --- UserSettings/UserSettings.json | 93 +++++++++++++++----- docs/api/UserSettingsPlugin.md | 152 ++++++++++++++++----------------- 2 files changed, 149 insertions(+), 96 deletions(-) diff --git a/UserSettings/UserSettings.json b/UserSettings/UserSettings.json index 3e01c6b911..4f64244087 100755 --- a/UserSettings/UserSettings.json +++ b/UserSettings/UserSettings.json @@ -34,10 +34,15 @@ "summary": "The preferred presentationLanguages in a full BCP 47 value, including script, * region, variant The language set and used by Immerse UI", "type": "string", "example": "en-US" + }, + "privacyMode": { + "summary": "The Privacy Mode. Valid values are SHARE, DO_NOT_SHARE", + "type": "string", + "example": "SHARE" } }, "methods": { - "setaudiodescription": { + "SetAudioDescription": { "summary": "Setting Audio Description.", "params": { "summary": "Audio Description Enabled: true/false", @@ -50,7 +55,7 @@ "example": "null" } }, - "setpreferredaudiolanguages": { + "SetPreferredAudioLanguages": { "summary": "Setting Preferred Audio Languages.", "params": { "summary": "Preferred Audio Languages: eng, wel", @@ -63,7 +68,7 @@ "example": "null" } }, - "setpresentationlanguages": { + "SetPresentationLanguage": { "summary": "Setting Presentation Languages.", "params": { "summary": "Presentation Languages: en-US, es-US", @@ -76,7 +81,7 @@ "example": "null" } }, - "setcaptionsenabled": { + "SetCaptions": { "summary": "Setting Captions.", "params": { "summary": "Captions Enabled: true/false", @@ -89,7 +94,7 @@ "example": "null" } }, - "setpreferredcaptionlanguages": { + "SetPreferredCaptionsLanguages": { "summary": "Setting PreferredCaption Languages.", "params": { "summary": "PreferredCaption Languages: eng, fra", @@ -102,7 +107,7 @@ "example": "null" } }, - "setpreferredclosedcaptionservice": { + "SetPreferredClosedCaptionService": { "summary": "Setting Preferred Closed Caption Service.", "params": { "summary": "Preferred Closed Caption Service: CC3", @@ -115,7 +120,25 @@ "example": "null" } }, - "getaudiodescription":{ + "SetPrivacyMode": { + "summary": "Setting Privacy Mode.", + "params": { + "type": "object", + "properties": { + "privacyMode": { + "summary": "New Privacy Mode" + "type": "string", + "example": "DO_NOT_SHARE" + } + } + }, + "result": { + "summary": "Null string will display", + "type": "string", + "example": "null" + } + }, + "GetAudioDescription":{ "summary": "Returns Audio Description.", "result": { "type": "object", @@ -129,7 +152,7 @@ ] } }, - "getpreferredaudiolanguages":{ + "GetPreferredAudioLanguages":{ "summary": "Returns Audio Description.", "result": { "type": "object", @@ -143,7 +166,7 @@ ] } }, - "getpresentationlanguages":{ + "GetPresentationLanguage":{ "summary": "Getting Presentation Languages.", "result": { "type": "object", @@ -157,7 +180,7 @@ ] } }, - "getcaptionsenabled":{ + "GetCaptions":{ "summary": "Getting Captions Enabled.", "result": { "type": "object", @@ -171,7 +194,7 @@ ] } }, - "GetPreferredCaptionLanguages":{ + "GetPreferredCaptionsLanguages":{ "summary": "Getting Preferred Caption Languages.", "result": { "type": "object", @@ -198,6 +221,20 @@ "preferredClosedCaptionService" ] } + }, + "GetPrivacyMode":{ + "summary": "Getting Privacy Mode", + "result": { + "type": "object", + "properties": { + "privacymode": { + "$ref": "#/definitions/privacyMode" + } + }, + "required": [ + "privacyMode" + ] + } } }, "events": { @@ -222,14 +259,14 @@ "params": { "type": "object", "properties": { - "PreferredAudioLanguagesChanged":{ + "preferredLanguages":{ "summary": "Receive preferred Audio languages changes", "type": "string", "example": "eng" } }, "required": [ - "PreferredAudioLanguagesChanged" + "preferredLanguages" ] } }, @@ -238,14 +275,14 @@ "params": { "type": "object", "properties": { - "PresentationLanguageChanged":{ + "presentationLanguages":{ "summary": "Receive Presentation Language changes", "type": "string", "example": "en-US" } }, "required": [ - "PresentationLanguageChanged" + "presentationLanguages" ] } }, @@ -270,14 +307,14 @@ "params": { "type": "object", "properties": { - "PreferredCaptionsLanguagesChanged":{ + "preferredLanguages":{ "summary": "Receive PreferredCaption Languages changes", "type": "string", "example": "eng" } }, "required": [ - "PreferredCaptionsLanguagesChanged" + "preferredLanguages" ] } }, @@ -286,14 +323,30 @@ "params": { "type": "object", "properties": { - "PreferredClosedCaptionServiceChanged":{ + "service":{ "summary": "Receive Preferred Closed Caption changes", "type": "string", - "example": "eng" + "example": "CC3" + } + }, + "required": [ + "service" + ] + } + }, + "OnPrivacyModeChanged": { + "summary": "Triggered after the Privacy Mode changes (see `SetPrivacyMode`)", + "params": { + "type": "object", + "properties": { + "privacyMode":{ + "summary": "Receive Privacy Mode changes", + "type": "string", + "example": "DO_NOT_SHARE" } }, "required": [ - "PreferredClosedCaptionServiceChanged" + "privacyMode" ] } } diff --git a/docs/api/UserSettingsPlugin.md b/docs/api/UserSettingsPlugin.md index 3a92f4c6a8..075900d299 100755 --- a/docs/api/UserSettingsPlugin.md +++ b/docs/api/UserSettingsPlugin.md @@ -47,24 +47,24 @@ UserSettings interface methods: | Method | Description | | :-------- | :-------- | -| [setaudiodescription](#setaudiodescription) | Setting Audio Description | -| [setpreferredaudiolanguages](#setpreferredaudiolanguages) | Setting Preferred Audio Languages | -| [setpresentationlanguages](#setpresentationlanguages) | Setting Presentation Languages | -| [setcaptionsenabled](#setcaptionsenabled) | Setting Captions | -| [setpreferredcaptionlanguages](#setpreferredcaptionlanguages) | Setting PreferredCaption Languages | -| [setpreferredclosedcaptionservice](#setpreferredclosedcaptionservice) | Setting Preferred Closed Caption Service | -| [setprivacymode](#setprivacymode) | Setting PrivacyMode | -| [getaudiodescription](#getaudiodescription) | Returns Audio Description | -| [getpreferredaudiolanguages](#getpreferredaudiolanguages) | Returns Audio Description | -| [getpresentationlanguages](#getpresentationlanguages) | Getting Presentation Languages | -| [getcaptionsenabled](#getcaptionsenabled) | Getting Captions Enabled | -| [GetPreferredCaptionLanguages](#GetPreferredCaptionLanguages) | Getting Preferred Caption Languages | +| [SetAudioDescription](#SetAudioDescription) | Setting Audio Description | +| [SetPreferredAudioLanguages](#SetPreferredAudioLanguages) | Setting Preferred Audio Languages | +| [SetPresentationLanguage](#SetPresentationLanguage) | Setting Presentation Languages | +| [SetCaptions](#SetCaptions) | Setting Captions | +| [SetPreferredCaptionsLanguages](#SetPreferredCaptionsLanguages) | Setting PreferredCaption Languages | +| [SetPreferredClosedCaptionService](#SetPreferredClosedCaptionService) | Setting Preferred Closed Caption Service | +| [SetPrivacyMode](#SetPrivacyMode) | Setting PrivacyMode | +| [GetAudioDescription](#GetAudioDescription) | Returns Audio Description | +| [GetPreferredAudioLanguages](#GetPreferredAudioLanguages) | Returns Audio Description | +| [GetPresentationLanguage](#GetPresentationLanguage) | Getting Presentation Languages | +| [GetCaptions](#GetCaptions) | Getting Captions Enabled | +| [GetPreferredCaptionsLanguages](#GetPreferredCaptionsLanguages) | Getting Preferred Caption Languages | | [GetPreferredClosedCaptionService](#GetPreferredClosedCaptionService) | Getting Preferred ClosedCaption Service | -| [getprivacymode](#getprivacymode) | Getting PrivacyMode | +| [GetPrivacyMode](#GetPrivacyMode) | Getting PrivacyMode | - -## *setaudiodescription* + +## *SetAudioDescription* Setting Audio Description. @@ -92,7 +92,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setaudiodescription", + "method": "org.rdk.UserSettings.SetAudioDescription", "params": true } ``` @@ -107,8 +107,8 @@ No Events } ``` - -## *setpreferredaudiolanguages* + +## *SetPreferredAudioLanguages* Setting Preferred Audio Languages. @@ -136,7 +136,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setpreferredaudiolanguages", + "method": "org.rdk.UserSettings.SetPreferredAudioLanguages", "params": "eng" } ``` @@ -151,8 +151,8 @@ No Events } ``` - -## *setpresentationlanguages* + +## *SetPresentationLanguage* Setting Presentation Languages. @@ -180,7 +180,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setpresentationlanguages", + "method": "org.rdk.UserSettings.SetPresentationLanguage", "params": "en-US" } ``` @@ -195,8 +195,8 @@ No Events } ``` - -## *setcaptionsenabled* + +## *SetCaptions* Setting Captions. @@ -224,7 +224,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setcaptionsenabled", + "method": "org.rdk.UserSettings.SetCaptions", "params": true } ``` @@ -239,8 +239,8 @@ No Events } ``` - -## *setpreferredcaptionlanguages* + +## *SetPreferredCaptionsLanguages* Setting PreferredCaption Languages. @@ -268,7 +268,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setpreferredcaptionlanguages", + "method": "org.rdk.UserSettings.SetPreferredCaptionsLanguages", "params": "eng" } ``` @@ -283,8 +283,8 @@ No Events } ``` - -## *setpreferredclosedcaptionservice* + +## *SetPreferredClosedCaptionService* Setting Preferred Closed Caption Service. @@ -312,7 +312,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setpreferredclosedcaptionservice", + "method": "org.rdk.UserSettings.SetPreferredClosedCaptionService", "params": "CC3" } ``` @@ -327,8 +327,8 @@ No Events } ``` - -## *setprivacymode* + +## *SetPrivacyMode* Setting PrivacyMode @@ -356,7 +356,7 @@ No Events { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.setprivacymode", + "method": "org.rdk.UserSettings.SetPrivacyMode", "params": "DO_NOT_SHARE" } ``` @@ -371,8 +371,8 @@ No Events } ``` - -## *getaudiodescription* + +## *GetAudioDescription* Returns Audio Description. @@ -399,7 +399,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.getaudiodescription" + "method": "org.rdk.UserSettings.GetAudioDescription" } ``` @@ -415,8 +415,8 @@ This method takes no parameters. } ``` - -## *getpreferredaudiolanguages* + +## *GetPreferredAudioLanguages* Returns Audio Description. @@ -443,7 +443,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.getpreferredaudiolanguages" + "method": "org.rdk.UserSettings.GetPreferredAudioLanguages" } ``` @@ -459,8 +459,8 @@ This method takes no parameters. } ``` - -## *getpresentationlanguages* + +## *GetPresentationLanguage* Getting Presentation Languages. @@ -487,7 +487,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.getpresentationlanguages" + "method": "org.rdk.UserSettings.GetPresentationLanguage" } ``` @@ -503,8 +503,8 @@ This method takes no parameters. } ``` - -## *getcaptionsenabled* + +## *GetCaptions* Getting Captions Enabled. @@ -531,7 +531,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.getcaptionsenabled" + "method": "org.rdk.UserSettings.GetCaptions" } ``` @@ -547,8 +547,8 @@ This method takes no parameters. } ``` - -## *GetPreferredCaptionLanguages* + +## *GetPreferredCaptionsLanguages* Getting Preferred Caption Languages. @@ -575,7 +575,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.GetPreferredCaptionLanguages" + "method": "org.rdk.UserSettings.GetPreferredCaptionsLanguages" } ``` @@ -635,8 +635,8 @@ This method takes no parameters. } ``` - -## *getprivacymode* + +## *GetPrivacyMode* Getting PrivacyMode @@ -663,7 +663,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "method": "org.rdk.UserSettings.getprivacymode" + "method": "org.rdk.UserSettings.GetPrivacyMode" } ``` @@ -690,19 +690,19 @@ UserSettings interface events: | Event | Description | | :-------- | :-------- | -| [OnAudioDescriptionChanged](#OnAudioDescriptionChanged) | Triggered after the audio description changes (see `setaudiodescription`) | -| [OnPreferredAudioLanguagesChanged](#OnPreferredAudioLanguagesChanged) | Triggered after the audio preferred Audio languages changes (see `setpreferredaudiolanguages`) | -| [OnPresentationLanguageChanged](#OnPresentationLanguageChanged) | Triggered after the Presentation Language changes (see `setpresentationlanguages`) | -| [OnCaptionsChanged](#OnCaptionsChanged) | Triggered after the captions changes (see `setcaptionsenabled`) | -| [OnPreferredCaptionsLanguagesChanged](#OnPreferredCaptionsLanguagesChanged) | Triggered after the PreferredCaption Languages changes (see `setpreferredcaptionlanguages`) | -| [OnPreferredClosedCaptionServiceChanged](#OnPreferredClosedCaptionServiceChanged) | Triggered after the Preferred Closed Caption changes (see `setpreferredclosedcaptionservice`) | -| [OnPrivacyModeChanged](#OnPrivacyModeChanged) | Triggered after the Privacy Mode changes (see `setprivacymode`) | +| [OnAudioDescriptionChanged](#OnAudioDescriptionChanged) | Triggered after the audio description changes (see `SetAudioDescription`) | +| [OnPreferredAudioLanguagesChanged](#OnPreferredAudioLanguagesChanged) | Triggered after the audio preferred Audio languages changes (see `SetPreferredAudioLanguages`) | +| [OnPresentationLanguageChanged](#OnPresentationLanguageChanged) | Triggered after the Presentation Language changes (see `SetPresentationLanguage`) | +| [OnCaptionsChanged](#OnCaptionsChanged) | Triggered after the captions changes (see `SetCaptions`) | +| [OnPreferredCaptionsLanguagesChanged](#OnPreferredCaptionsLanguagesChanged) | Triggered after the PreferredCaption Languages changes (see `SetPreferredCaptionsLanguages`) | +| [OnPreferredClosedCaptionServiceChanged](#OnPreferredClosedCaptionServiceChanged) | Triggered after the Preferred Closed Caption changes (see `SetPreferredClosedCaptionService`) | +| [OnPrivacyModeChanged](#OnPrivacyModeChanged) | Triggered after the Privacy Mode changes (see `SetPrivacyMode`) | ## *OnAudioDescriptionChanged* -Triggered after the audio description changes (see `setaudiodescription`). +Triggered after the audio description changes (see `SetAudioDescription`). ### Parameters @@ -726,14 +726,14 @@ Triggered after the audio description changes (see `setaudiodescription`). ## *OnPreferredAudioLanguagesChanged* -Triggered after the audio preferred Audio languages changes (see `setpreferredaudiolanguages`). +Triggered after the audio preferred Audio languages changes (see `SetPreferredAudioLanguages`). ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.PreferredAudioLanguagesChanged | string | Receive preferred Audio languages changes | +| params.preferredLanguages | string | Receive preferred Audio languages changes | ### Example @@ -742,7 +742,7 @@ Triggered after the audio preferred Audio languages changes (see `setpreferredau "jsonrpc": "2.0", "method": "client.events.OnPreferredAudioLanguagesChanged", "params": { - "PreferredAudioLanguagesChanged": "eng" + "preferredLanguages": "eng" } } ``` @@ -750,14 +750,14 @@ Triggered after the audio preferred Audio languages changes (see `setpreferredau ## *OnPresentationLanguageChanged* -Triggered after the Presentation Language changes (see `setpresentationlanguages`). +Triggered after the Presentation Language changes (see `SetPresentationLanguage`). ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.PresentationLanguageChanged | string | Receive Presentation Language changes | +| params.presentationLanguages | string | Receive Presentation Language changes | ### Example @@ -766,7 +766,7 @@ Triggered after the Presentation Language changes (see `setpresentationlanguages "jsonrpc": "2.0", "method": "client.events.OnPresentationLanguageChanged", "params": { - "PresentationLanguageChanged": "en-US" + "presentationLanguages": "en-US" } } ``` @@ -774,7 +774,7 @@ Triggered after the Presentation Language changes (see `setpresentationlanguages ## *OnCaptionsChanged* -Triggered after the captions changes (see `setcaptionsenabled`). +Triggered after the captions changes (see `SetCaptions`). ### Parameters @@ -798,14 +798,14 @@ Triggered after the captions changes (see `setcaptionsenabled`). ## *OnPreferredCaptionsLanguagesChanged* -Triggered after the PreferredCaption Languages changes (see `setpreferredcaptionlanguages`). +Triggered after the PreferredCaption Languages changes (see `SetPreferredCaptionsLanguages`). ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.PreferredCaptionsLanguagesChanged | string | Receive PreferredCaption Languages changes | +| params.preferredLanguages | string | Receive PreferredCaption Languages changes | ### Example @@ -814,7 +814,7 @@ Triggered after the PreferredCaption Languages changes (see `setpreferredcaption "jsonrpc": "2.0", "method": "client.events.OnPreferredCaptionsLanguagesChanged", "params": { - "PreferredCaptionsLanguagesChanged": "eng" + "preferredLanguages": "eng" } } ``` @@ -822,14 +822,14 @@ Triggered after the PreferredCaption Languages changes (see `setpreferredcaption ## *OnPreferredClosedCaptionServiceChanged* -Triggered after the Preferred Closed Caption changes (see `setpreferredclosedcaptionservice`). +Triggered after the Preferred Closed Caption changes (see `SetPreferredClosedCaptionService`). ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.PreferredClosedCaptionServiceChanged | string | Receive Preferred Closed Caption changes | +| params.service | string | Receive Preferred Closed Caption changes | ### Example @@ -838,7 +838,7 @@ Triggered after the Preferred Closed Caption changes (see `setpreferredclosedcap "jsonrpc": "2.0", "method": "client.events.OnPreferredClosedCaptionServiceChanged", "params": { - "PreferredClosedCaptionServiceChanged": "eng" + "service": "CC3" } } ``` @@ -846,14 +846,14 @@ Triggered after the Preferred Closed Caption changes (see `setpreferredclosedcap ## *OnPrivacyModeChanged [event](#head.Notifications)* -Triggered after the Privacy Mode changes (see `setprivacymode`). +Triggered after the Privacy Mode changes (see `SetPrivacyMode`). ### Parameters | Name | Type | Description | | :-------- | :-------- | :-------- | | params | object | | -| params.PrivacyModeChanged | string | Receive Privacy Mode changes | +| params.privacyMode | string | Receive Privacy Mode changes | ### Example @@ -862,7 +862,7 @@ Triggered after the Privacy Mode changes (see `setprivacymode`). "jsonrpc": "2.0", "method": "client.events.OnPrivacyModeChanged", "params": { - "PrivacyModeChanged": "DO_NOT_SHARE" + "privacyMode": "DO_NOT_SHARE" } } ``` From 84670191cc23b4803b1f4bfc01a0af2cec114a61 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Thu, 27 Jun 2024 19:43:46 +0300 Subject: [PATCH 09/10] Updated SetPrivacyMode sample request. --- UserSettings/UserSettings.json | 2 +- docs/api/UserSettingsPlugin.md | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/UserSettings/UserSettings.json b/UserSettings/UserSettings.json index 4f64244087..938e730abd 100755 --- a/UserSettings/UserSettings.json +++ b/UserSettings/UserSettings.json @@ -126,7 +126,7 @@ "type": "object", "properties": { "privacyMode": { - "summary": "New Privacy Mode" + "summary": "New Privacy Mode", "type": "string", "example": "DO_NOT_SHARE" } diff --git a/docs/api/UserSettingsPlugin.md b/docs/api/UserSettingsPlugin.md index 075900d299..c1c407e63b 100755 --- a/docs/api/UserSettingsPlugin.md +++ b/docs/api/UserSettingsPlugin.md @@ -340,7 +340,9 @@ No Events | Name | Type | Description | | :-------- | :-------- | :-------- | -| params | string | PrivacyMode: DO_NOT_SHARE | +| params | object | | +| params.privacyMode | string | PrivacyMode: SHARE or DO_NOT_SHARE | + ### Result @@ -357,7 +359,9 @@ No Events "jsonrpc": "2.0", "id": 42, "method": "org.rdk.UserSettings.SetPrivacyMode", - "params": "DO_NOT_SHARE" + "params": { + {"privacyMode":"DO_NOT_SHARE"} + } } ``` From 81653e7b26750da5f413792833abff157c307d20 Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Tue, 2 Jul 2024 05:19:28 +0300 Subject: [PATCH 10/10] Updated result output in docs. --- UserSettings/UserSettings.json | 102 +++------------------------------ docs/api/UserSettingsPlugin.md | 28 +++------ 2 files changed, 14 insertions(+), 116 deletions(-) diff --git a/UserSettings/UserSettings.json b/UserSettings/UserSettings.json index 938e730abd..c49993d204 100755 --- a/UserSettings/UserSettings.json +++ b/UserSettings/UserSettings.json @@ -9,38 +9,6 @@ "common": { "$ref": "../common/common.json" }, - "definitions": { - "enabled": { - "summary": "Enabled (`true`) or disabled (`false`)", - "type": "boolean", - "example": false - }, - "preferredLanguages": { - "summary": "A prioritized list of ISO 639-2/B codes for the preferred audio languages", - "type": "string", - "example": "eng" - }, - "preferredCaptionsLanguages": { - "summary": "A prioritized list of ISO 639-2/B codes for the preferred captions languages", - "type": "string", - "example": "eng" - }, - "preferredClosedCaptionService": { - "summary": "A string for the preferred closed captions service. Valid values are AUTO, CC[1-4], TEXT[1-4], SERVICE[1-64] where CC and TEXT is CTA-608 and SERVICE is CTA-708. AUTO indicates that the choice is left to the player", - "type": "string", - "example": "CC3" - }, - "presentationLanguage": { - "summary": "The preferred presentationLanguages in a full BCP 47 value, including script, * region, variant The language set and used by Immerse UI", - "type": "string", - "example": "en-US" - }, - "privacyMode": { - "summary": "The Privacy Mode. Valid values are SHARE, DO_NOT_SHARE", - "type": "string", - "example": "SHARE" - } - }, "methods": { "SetAudioDescription": { "summary": "Setting Audio Description.", @@ -141,99 +109,43 @@ "GetAudioDescription":{ "summary": "Returns Audio Description.", "result": { - "type": "object", - "properties": { - "enabled": { - "$ref": "#/definitions/enabled" - } - }, - "required": [ - "enabled" - ] + "type": "boolean" } }, "GetPreferredAudioLanguages":{ "summary": "Returns Audio Description.", "result": { - "type": "object", - "properties": { - "preferredLanguages": { - "$ref": "#/definitions/preferredLanguages" - } - }, - "required": [ - "preferredLanguages" - ] + "type": "string" } }, "GetPresentationLanguage":{ "summary": "Getting Presentation Languages.", "result": { - "type": "object", - "properties": { - "presentationlanguages": { - "$ref": "#/definitions/presentationLanguage" - } - }, - "required": [ - "presentationlanguages" - ] + "type": "string" } }, "GetCaptions":{ "summary": "Getting Captions Enabled.", "result": { - "type": "object", - "properties": { - "enabled": { - "$ref": "#/definitions/enabled" - } - }, - "required": [ - "enabled" - ] + "type": "boolean" } }, "GetPreferredCaptionsLanguages":{ "summary": "Getting Preferred Caption Languages.", "result": { - "type": "object", - "properties": { - "preferredLanguages": { - "$ref": "#/definitions/preferredCaptionsLanguages" - } - }, - "required": [ - "preferredLanguages" - ] + "type": "string" } }, "GetPreferredClosedCaptionService":{ "summary": "Getting Preferred ClosedCaption Service.", "result": { - "type": "object", - "properties": { - "preferredClosedCaptionService": { - "$ref": "#/definitions/preferredClosedCaptionService" - } - }, - "required": [ - "preferredClosedCaptionService" - ] + "type": "string" } }, "GetPrivacyMode":{ "summary": "Getting Privacy Mode", "result": { - "type": "object", - "properties": { - "privacymode": { - "$ref": "#/definitions/privacyMode" - } - }, - "required": [ - "privacyMode" - ] + "type": "string" } } }, diff --git a/docs/api/UserSettingsPlugin.md b/docs/api/UserSettingsPlugin.md index c1c407e63b..c422dbc281 100755 --- a/docs/api/UserSettingsPlugin.md +++ b/docs/api/UserSettingsPlugin.md @@ -413,9 +413,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "enabled": false - } + "result":false } ``` @@ -457,9 +455,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "preferredLanguages": "eng" - } + "result":"eng" } ``` @@ -501,9 +497,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "presentationlanguages": "en-US" - } + "result":"en-US" } ``` @@ -545,9 +539,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "enabled": false - } + "result":false } ``` @@ -589,9 +581,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "preferredLanguages": "eng" - } + "result":"eng" } ``` @@ -633,9 +623,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "preferredClosedCaptionService": "CC3" - } + "result":"CC3" } ``` @@ -677,9 +665,7 @@ This method takes no parameters. { "jsonrpc": "2.0", "id": 42, - "result": { - "privacymode": "SHARE" - } + "result":"SHARE" } ```