Skip to content

Commit

Permalink
Merge branch 'sprint/24Q2' into sprint/24Q2
Browse files Browse the repository at this point in the history
  • Loading branch information
MFransen69 authored May 24, 2024
2 parents 4f5c480 + 6a7a725 commit 97af263
Show file tree
Hide file tree
Showing 23 changed files with 2,451 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ if(PLUGIN_CONTROLSERVICE)
add_subdirectory(ControlService)
endif()

if(PLUGIN_USERSETTINGS)
add_subdirectory(UserSettings)
endif()

if(PLUGIN_VOICECONTROL)
add_subdirectory(VoiceControl)
endif()
Expand Down
101 changes: 101 additions & 0 deletions RDKShell/RDKShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_GET_AV_BLOCKED_APPS
const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_KEY_REPEAT_CONFIG = "keyRepeatConfig";
const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_GET_GRAPHICS_FRAME_RATE = "getGraphicsFrameRate";
const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_SET_GRAPHICS_FRAME_RATE = "setGraphicsFrameRate";
const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_SET_KEY_INTERCEPTS = "setKeyIntercepts";
#ifdef HIBERNATE_SUPPORT_ENABLED
const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_HIBERNATE = "hibernate";
const string WPEFramework::Plugin::RDKShell::RDKSHELL_METHOD_RESTORE = "restore";
Expand Down Expand Up @@ -1602,6 +1603,7 @@ namespace WPEFramework {
Register(RDKSHELL_METHOD_SET_GRAPHICS_FRAME_RATE, &RDKShell::setGraphicsFrameRateWrapper, this);
Register(RDKSHELL_METHOD_SET_AV_BLOCKED, &RDKShell::setAVBlockedWrapper, this);
Register(RDKSHELL_METHOD_GET_AV_BLOCKED_APPS, &RDKShell::getBlockedAVApplicationsWrapper, this);
Register(RDKSHELL_METHOD_SET_KEY_INTERCEPTS, &RDKShell::setKeyInterceptsWrapper, this);
#ifdef HIBERNATE_SUPPORT_ENABLED
Register(RDKSHELL_METHOD_HIBERNATE, &RDKShell::hibernateWrapper, this);
Register(RDKSHELL_METHOD_RESTORE, &RDKShell::restoreWrapper, this);
Expand Down Expand Up @@ -2849,6 +2851,29 @@ namespace WPEFramework {
returnResponse(result);
}

uint32_t RDKShell::setKeyInterceptsWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
bool result = true;

if (!parameters.HasLabel("intercepts"))
{
result = false;
response["message"] = "please specify intercepts";
}
if (result)
{
//optional param?
const JsonArray intercepts = parameters["intercepts"].Array();
result = setKeyIntercepts(intercepts);
if (false == result)
{
response["message"] = "failed to add some key intercepts due to missing parameters or wrong format ";
}
}
returnResponse(result);
}

uint32_t RDKShell::removeKeyInterceptWrapper(const JsonObject& parameters, JsonObject& response)
{
LOGINFOMETHOD();
Expand Down Expand Up @@ -7033,6 +7058,82 @@ namespace WPEFramework {
return ret;
}

bool RDKShell::setKeyIntercepts(const JsonArray& intercepts)
{
bool ret = true;
for (int i=0; i<intercepts.Length(); i++)
{
if (!(intercepts[i].Content() == JsonValue::type::OBJECT))
{
std::cout << "ignoring entry " << i+1 << "due to wrong format " << std::endl;
ret = false;
continue;
}
const JsonObject& interceptEntry = intercepts[i].Object();
if (!interceptEntry.HasLabel("keys") || !interceptEntry.HasLabel("clients"))
{
std::cout << "ignoring entry " << i+1 << "due to missing client or keys parameter " << std::endl;
ret = false;
continue;
}
const JsonArray& keys = interceptEntry["keys"].Array();
const JsonArray& clients = interceptEntry["clients"].Array();

for (int j=0; j<clients.Length(); j++)
{
if (!(clients[j].Content() == JsonValue::type::OBJECT))
{
std::cout << "ignoring client << " << j+1 << " in entry " << i+1 << "due to wrong format " << std::endl;
ret = false;
continue;
}
const JsonObject& clientEntry = clients[j].Object();
if (!clientEntry.HasLabel("client"))
{
std::cout << "ignoring client << " << j+1 << " in entry " << i+1 << "due to missing client parameter " << std::endl;
ret = false;
continue;
}
std::string client = clientEntry["client"].String();
const bool always = clientEntry.HasLabel("always") ? clientEntry["always"].Boolean(): true;
for (int k=0; k<keys.Length(); k++)
{
if (!(keys[k].Content() == JsonValue::type::OBJECT))
{
std::cout << "ignoring key << " << k+1 << " in entry " << i+1 << "due to wrong format " << std::endl;
ret = false;
continue;
}
const JsonObject& keyEntry = keys[k].Object();
if (!keyEntry.HasLabel("keycode"))
{
std::cout << "ignoring key << " << k+1 << " in entry " << i+1 << "due to missing key code parameter " << std::endl;
ret = false;
continue;
}
const JsonArray modifiers = keyEntry.HasLabel("modifiers") ? keyEntry["modifiers"].Array() : JsonArray();
const uint32_t keyCode = keyEntry["keycode"].Number();
std::cout << "setKeyIntercept keyCode << " << keyCode << " client " << client << " always" << always << std::endl;
ret = setKeyIntercept(keyCode, modifiers, client, always);
}
}
}
return ret;
}

bool RDKShell::setKeyIntercept(const uint32_t& keyCode, const JsonArray& modifiers, const string& client, const bool always)
{
uint32_t flags = 0;
for (int i=0; i<modifiers.Length(); i++) {
flags |= getKeyFlag(modifiers[i].String());
}
bool ret = false;
gRdkShellMutex.lock();
ret = CompositorController::setKeyIntercept(client, keyCode, flags, always);
gRdkShellMutex.unlock();
return ret;
}

bool RDKShell::removeKeyIntercept(const uint32_t& keyCode, const JsonArray& modifiers, const string& client)
{
uint32_t flags = 0;
Expand Down
4 changes: 4 additions & 0 deletions RDKShell/RDKShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ namespace WPEFramework {
static const string RDKSHELL_METHOD_KEY_REPEAT_CONFIG;
static const string RDKSHELL_METHOD_GET_GRAPHICS_FRAME_RATE;
static const string RDKSHELL_METHOD_SET_GRAPHICS_FRAME_RATE;
static const string RDKSHELL_METHOD_SET_KEY_INTERCEPTS;
#ifdef HIBERNATE_SUPPORT_ENABLED
static const string RDKSHELL_METHOD_HIBERNATE;
static const string RDKSHELL_METHOD_RESTORE;
Expand Down Expand Up @@ -272,6 +273,7 @@ namespace WPEFramework {
uint32_t keyRepeatConfigWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t getGraphicsFrameRateWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t setGraphicsFrameRateWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t setKeyInterceptsWrapper(const JsonObject& parameters, JsonObject& response);
#ifdef HIBERNATE_SUPPORT_ENABLED
uint32_t hibernateWrapper(const JsonObject& parameters, JsonObject& response);
uint32_t restoreWrapper(const JsonObject& parameters, JsonObject& response);
Expand All @@ -289,6 +291,8 @@ namespace WPEFramework {
bool kill(const string& client);
bool addKeyIntercept(const uint32_t& keyCode, const JsonArray& modifiers, const string& client);
bool addKeyIntercepts(const JsonArray& intercepts);
bool setKeyIntercepts(const JsonArray& intercepts);
bool setKeyIntercept(const uint32_t& keyCode, const JsonArray& modifiers, const string& client, const bool always);
bool removeKeyIntercept(const uint32_t& keyCode, const JsonArray& modifiers, const string& client);
bool addKeyListeners(const string& client, const JsonArray& listeners);
bool removeKeyListeners(const string& client, const JsonArray& listeners);
Expand Down
63 changes: 63 additions & 0 deletions RDKShell/RDKShell.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,69 @@
"$ref": "#/common/result"
}
},
"setKeyIntercepts": {
"summary": "Adds the list of key intercepts.",
"params": {
"type":"object",
"properties": {
"intercepts": {
"summary": "A list of intercepts",
"type": "array",
"items": {
"type": "object",
"properties": {
"clients": {
"summary": "A list of clients",
"type": "array",
"items": {
"type": "object",
"properties": {
"client":{
"summary": "The client name",
"type": "string",
"example": "searchanddiscovery"
},
"always":{
"summary": "If set to true then the key will always be intercepted for this client",
"type": "boolean",
"example": true
}
}
}
},
"keys":{
"summary": "A list of keys to intercept",
"type": "array",
"items":{
"type": "object",
"properties": {
"keycode": {
"$ref": "#/definitions/keyCode"
},
"modifiers": {
"$ref": "#/definitions/modifiers"
}
},
"required": [
"keycode",
"modifiers",
"keys"
]
}
}
},
"required": [
"client",
"keys"
]
}
}
}
},
"result": {
"$ref": "#/common/result"
}
},
"addKeyListener":{
"summary": "Adds a key listener to an application. The keys are bubbled up based on their z-order.",
"params": {
Expand Down
2 changes: 1 addition & 1 deletion SystemAudioPlayer/impl/AudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ void AudioPlayer::setVolume( int thisVol)
g_object_set(G_OBJECT(m_audioVolume), "stream-volume", (double)thisVol/100, NULL);
}
#elif defined(PLATFORM_REALTEK)
g_object_set(G_OBJECT(m_audioVolume), "volume", (double) 4.0 * (thisVol/100), NULL);
g_object_set(G_OBJECT(m_audioVolume), "volume", (double)thisVol/100, NULL);
#elif defined(PLATFORM_BROADCOM)
g_object_set(G_OBJECT(m_audioVolume), "volume", (double)thisVol/100, NULL);
#endif
Expand Down
1 change: 1 addition & 0 deletions Tests/L1Tests/tests/test_RDKShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ TEST_F(RDKShellTest, RegisteredMethods){
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("addAnimation")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("addKeyIntercept")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("addKeyIntercepts")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("setKeyIntercepts")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("addKeyListener")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("addKeyMetadataListener")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("exitAgingMode")));
Expand Down
4 changes: 4 additions & 0 deletions Tests/mocks/rdkshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ bool CompositorController::addKeyIntercept(const std::string& client, const uint
{
return impl->addKeyIntercept(client, keyCode, flags);
}
bool CompositorController::setKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, const bool always)
{
return impl->setKeyIntercept(client, keyCode, flags, always);
}
bool CompositorController::removeKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags)
{
return impl->removeKeyIntercept(client, keyCode, flags);
Expand Down
2 changes: 2 additions & 0 deletions Tests/mocks/rdkshell.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ namespace RdkShell
virtual bool addNativeKeyListener(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, std::map<std::string, RdkShellData> &listenerProperties) = 0;
virtual bool addKeyListener(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, std::map<std::string, RdkShellData> &listenerProperties) = 0;
virtual bool addKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags) = 0;
virtual bool setKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, const bool always) = 0;
virtual bool kill(const std::string& client) = 0;
virtual void setInactivityInterval(const double minutes) = 0;
};
Expand All @@ -284,6 +285,7 @@ namespace RdkShell
static bool getFocused(std::string& client);
static bool kill(const std::string& client);
static bool addKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags);
static bool setKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, const bool always);
static bool removeKeyIntercept(const std::string& client, const uint32_t& keyCode, const uint32_t& flags);
static bool addKeyListener(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, std::map<std::string, RdkShellData> &listenerProperties);
static bool addNativeKeyListener(const std::string& client, const uint32_t& keyCode, const uint32_t& flags, std::map<std::string, RdkShellData> &listenerProperties);
Expand Down
1 change: 1 addition & 0 deletions Tests/mocks/rdkshellmock.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class CompositorImplMock : public RdkShell::CompositorControllerImpl {
MOCK_METHOD(bool, addNativeKeyListener, (const std::string& client, const uint32_t& keyCode, const uint32_t& flags, (std::map<std::string, RdkShell::RdkShellData> &listenerProperties)), (override));
MOCK_METHOD(bool, addKeyListener, (const std::string& client, const uint32_t& keyCode, const uint32_t& flags, (std::map<std::string, RdkShell::RdkShellData> &listenerProperties)), (override));
MOCK_METHOD(bool, addKeyIntercept, (const std::string& client, const uint32_t& keyCode, const uint32_t& flags), (override));
MOCK_METHOD(bool, setKeyIntercept, (const std::string& client, const uint32_t& keyCode, const uint32_t& flags, const bool always), (override));
MOCK_METHOD(bool, kill, (const std::string& client), (override));
MOCK_METHOD(void, setInactivityInterval, (const double minutes), (override));
};
Expand Down
21 changes: 18 additions & 3 deletions TextToSpeech/impl/TTSURLConstructer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *use
return size * nmemb;
}

static const std::map<std::string, int> speechRateMap = {
{"slow", 25},
{"medium", 50},
{"fast", 75},
{"faster", 90},
{"fastest", 100}
};

namespace TTS
{

Expand Down Expand Up @@ -45,9 +53,16 @@ std::string TTSURLConstructer::httpgetURL(TTSConfiguration &config, std::string
ttsRequest.append(config.language());
}

if(!isLocal && ((config.endPointType().compare("TTS2")) == 0)) {
ttsRequest.append("&speaking_rate=");
ttsRequest.append(config.speechRate());
if(((config.endPointType().compare("TTS2")) == 0)) {
if(!isLocal) {
ttsRequest.append("&speaking_rate=");
ttsRequest.append(config.speechRate());
} else {
//rate mapping for offline VG
ttsRequest.append("&rate=");
auto it = speechRateMap.find(config.speechRate());
ttsRequest.append(std::to_string((speechRateMap.end() != it ) ? it->second : 50));
}
} else {
// Rate / speed
ttsRequest.append("&rate=");
Expand Down
24 changes: 24 additions & 0 deletions UserSettings/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this RDK Service will be documented in this file.

* Each RDK Service has a CHANGELOG file that contains all changes done so far. When version is updated, add a entry in the CHANGELOG.md at the top with user friendly information on what was changed with the new version. Please don't mention JIRA tickets in CHANGELOG.

* Please Add entry in the CHANGELOG for each version change and indicate the type of change with these labels:
* **Added** for new features.
* **Changed** for changes in existing functionality.
* **Deprecated** for soon-to-be removed features.
* **Removed** for now removed features.
* **Fixed** for any bug fixes.
* **Security** in case of vulnerabilities.

* Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.
## [1.0.0] - 2024-05-08
### Added
- Add CHANGELOG

### Change
- Reset API version to 1.0.0
- Change README to inform how to update changelog and API version
Loading

0 comments on commit 97af263

Please sign in to comment.