From d98d86edc1996ce314ea719dcb501533e2e8e655 Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Fri, 3 Apr 2026 07:53:09 -0400 Subject: [PATCH 1/8] Update ctrlm_thunder_plugin_powermanager.cpp --- src/thunder/ctrlm_thunder_plugin_powermanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp index eca59c62..eb9b35e0 100755 --- a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp +++ b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp @@ -113,7 +113,7 @@ bool ctrlm_thunder_plugin_powermanager_t::get_wakeup_reason_voice() { sem_wait(&this->semaphore); if(this->call_plugin("getLastWakeupReason", (void *)¶ms, (void *)&response)) { - wakeup_reason_voice = (0 == strncmp(response["result"].String().c_str(), "VOICE", 5)); + wakeup_reason_voice = (response["result"].String() == "WAKEUP_REASON_VOICE"); XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); } else { XLOGD_ERROR("getLastWakeupReason call failed"); From d2329ca3de321e12c9bd5f25ce322239361b141a Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Fri, 3 Apr 2026 09:17:10 -0400 Subject: [PATCH 2/8] Update ctrlm_thunder_plugin_powermanager.cpp --- src/thunder/ctrlm_thunder_plugin_powermanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp index eb9b35e0..4539a829 100755 --- a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp +++ b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp @@ -113,7 +113,7 @@ bool ctrlm_thunder_plugin_powermanager_t::get_wakeup_reason_voice() { sem_wait(&this->semaphore); if(this->call_plugin("getLastWakeupReason", (void *)¶ms, (void *)&response)) { - wakeup_reason_voice = (response["result"].String() == "WAKEUP_REASON_VOICE"); + wakeup_reason_voice = (response["wakeupReason"].String() == "WAKEUP_REASON_VOICE"); XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); } else { XLOGD_ERROR("getLastWakeupReason call failed"); From 417626809c1a802ab1bd950adee80133375514ea Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Fri, 3 Apr 2026 12:40:08 -0400 Subject: [PATCH 3/8] Update ctrlm_thunder_plugin_powermanager.cpp --- src/thunder/ctrlm_thunder_plugin_powermanager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp index 4539a829..a39f2a83 100755 --- a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp +++ b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp @@ -113,8 +113,10 @@ bool ctrlm_thunder_plugin_powermanager_t::get_wakeup_reason_voice() { sem_wait(&this->semaphore); if(this->call_plugin("getLastWakeupReason", (void *)¶ms, (void *)&response)) { - wakeup_reason_voice = (response["wakeupReason"].String() == "WAKEUP_REASON_VOICE"); - XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); + XLOGD_INFO("result received <%s>", response["result"].String().c_str()); + XLOGD_INFO("wakeupReason received <%s>", response["wakeupReason"].String().c_str()); + wakeup_reason_voice = (std::string(response["result"].String()) == "VOICE"); + XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); } else { XLOGD_ERROR("getLastWakeupReason call failed"); } From 11ea30be2827265612a1cf48b7bc0dd1de4369d8 Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Mon, 6 Apr 2026 12:28:09 +0000 Subject: [PATCH 4/8] Adding JSON string method to plugin --- src/thunder/ctrlm_thunder_plugin.cpp | 30 +++++++++++++++++-- src/thunder/ctrlm_thunder_plugin.h | 9 ++++++ .../ctrlm_thunder_plugin_powermanager.cpp | 14 +++++---- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/thunder/ctrlm_thunder_plugin.cpp b/src/thunder/ctrlm_thunder_plugin.cpp index 0eee5808..19b7d4c6 100644 --- a/src/thunder/ctrlm_thunder_plugin.cpp +++ b/src/thunder/ctrlm_thunder_plugin.cpp @@ -270,20 +270,44 @@ bool ctrlm_thunder_plugin_t::call_plugin_boolean(std::string method, void *param Core::JSON::Boolean jsonResponse; uint32_t thunderRet = clientObject->Invoke(CALL_TIMEOUT, _T(method), *jsonParams, jsonResponse); if(thunderRet != Core::ERROR_NONE) { - XLOGD_ERROR("%s: Thunder call failed <%s> <%u>\n", __FUNCTION__, method.c_str(), thunderRet); + XLOGD_ERROR("Thunder call failed <%s> <%u>", method.c_str(), thunderRet); } else { *response = jsonResponse.Value(); ret = true; } } else { - XLOGD_ERROR("%s: Invalid parameters\n", __FUNCTION__); + XLOGD_ERROR("Invalid parameters"); } } else { - XLOGD_ERROR("%s: Client is NULL\n", __FUNCTION__); + XLOGD_ERROR("Client is NULL"); } return(ret); } +bool ctrlm_thunder_plugin_t::call_plugin_string(std::string method, void *params, std::string *response) { + bool ret = false; + auto clientObject = (JSONRPC::LinkType*)this->plugin_client; + JsonObject *jsonParams = (JsonObject *)params; + if(clientObject) { + if(!method.empty() && jsonParams && response) { + Core::JSON::String jsonString; + uint32_t thunderRet = clientObject->Invoke(CALL_TIMEOUT, _T(method), *jsonParams, jsonString); + if(thunderRet != Core::ERROR_NONE) { + XLOGD_ERROR("%s: Thunder call failed <%s> <%u>", __FUNCTION__, method.c_str(), thunderRet); + } else { + *response = jsonString.Value(); + ret = true; + } + } else { + XLOGD_ERROR("%s: Invalid parameters", __FUNCTION__); + } + } else { + XLOGD_ERROR("%s: Client is NULL", __FUNCTION__); + } + return(ret); +} + + bool ctrlm_thunder_plugin_t::call_controller(std::string method, void *params, void *response) { bool ret = false; if(this->controller) { diff --git a/src/thunder/ctrlm_thunder_plugin.h b/src/thunder/ctrlm_thunder_plugin.h index 38a39e01..29092fb3 100644 --- a/src/thunder/ctrlm_thunder_plugin.h +++ b/src/thunder/ctrlm_thunder_plugin.h @@ -134,6 +134,15 @@ class ctrlm_thunder_plugin_t { */ bool call_plugin_boolean(std::string method, void *params, bool *response); + /** + * This function is used to call a Thunder Plugin method. + * @param method The method in which the user wants to call. + * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) + * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) + * @return True if the call succeeded, otherwise False. + */ + bool call_plugin_string(std::string method, void *params, std::string *response); + /** * This function is used to call a Thunder Controller method. * @param method The method in which the user wants to call. diff --git a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp index a39f2a83..e84fa983 100755 --- a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp +++ b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp @@ -107,21 +107,23 @@ bool ctrlm_thunder_plugin_powermanager_t::get_networked_standby_mode() { /* root@pioneer-uhd:~# curl --request POST --url http://127.0.0.1:9998/jsonrpc --header 'Content-Type: application/json' --data '{ "jsonrpc": "2.0", "id": 1234567890, "method": "org.rdk.PowerManager.1.getLastWakeupReason", "params": {} }' {"jsonrpc":"2.0","id":1234567890,"result":"COLDBOOT"} */ bool ctrlm_thunder_plugin_powermanager_t::get_wakeup_reason_voice() { - JsonObject params, response; + JsonObject params; + std::string response; params = {}; bool wakeup_reason_voice = false; sem_wait(&this->semaphore); - if(this->call_plugin("getLastWakeupReason", (void *)¶ms, (void *)&response)) { - XLOGD_INFO("result received <%s>", response["result"].String().c_str()); - XLOGD_INFO("wakeupReason received <%s>", response["wakeupReason"].String().c_str()); - wakeup_reason_voice = (std::string(response["result"].String()) == "VOICE"); - XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); + if(this->call_plugin_string("getLastWakeupReason", (void *)¶ms, &response)) { + if(response == "VOICE") { + wakeup_reason_voice = true; + } } else { XLOGD_ERROR("getLastWakeupReason call failed"); } sem_post(&this->semaphore); + XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); + return wakeup_reason_voice; } From d35e7dacf47028b89b2654b13cd8a8aa888c26c1 Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Wed, 8 Apr 2026 13:57:39 -0400 Subject: [PATCH 5/8] Update ctrlm_thunder_plugin.h Address copilot comments --- src/thunder/ctrlm_thunder_plugin.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/thunder/ctrlm_thunder_plugin.h b/src/thunder/ctrlm_thunder_plugin.h index 29092fb3..aeb7396b 100644 --- a/src/thunder/ctrlm_thunder_plugin.h +++ b/src/thunder/ctrlm_thunder_plugin.h @@ -106,7 +106,7 @@ class ctrlm_thunder_plugin_t { /** * This function is used to get a Thunder Plugin property. - * @param method The method in which the user wants to call. + * @param property The property the user wants to get * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param retries The number of retries if the call times out. @@ -128,8 +128,7 @@ class ctrlm_thunder_plugin_t { * This function is used to call a Thunder Plugin method. * @param method The method in which the user wants to call. * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) - * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) - * @param retries The number of retries if the call times out. + * @param response A pointer to a boolean which will be assigned true or false * @return True if the call succeeded, otherwise False. */ bool call_plugin_boolean(std::string method, void *params, bool *response); @@ -138,7 +137,7 @@ class ctrlm_thunder_plugin_t { * This function is used to call a Thunder Plugin method. * @param method The method in which the user wants to call. * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) - * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) + * @param response A pointer a string which will be assigned * @return True if the call succeeded, otherwise False. */ bool call_plugin_string(std::string method, void *params, std::string *response); @@ -183,4 +182,4 @@ class ctrlm_thunder_plugin_t { }; }; -#endif \ No newline at end of file +#endif From 2a3bc2a915bf463ae35b6c66a4d88fb9cd9a4c1a Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Wed, 8 Apr 2026 14:15:30 -0400 Subject: [PATCH 6/8] Update ctrlm_thunder_plugin.cpp Fix error log --- src/thunder/ctrlm_thunder_plugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thunder/ctrlm_thunder_plugin.cpp b/src/thunder/ctrlm_thunder_plugin.cpp index 19b7d4c6..ca6afffc 100644 --- a/src/thunder/ctrlm_thunder_plugin.cpp +++ b/src/thunder/ctrlm_thunder_plugin.cpp @@ -293,16 +293,16 @@ bool ctrlm_thunder_plugin_t::call_plugin_string(std::string method, void *params Core::JSON::String jsonString; uint32_t thunderRet = clientObject->Invoke(CALL_TIMEOUT, _T(method), *jsonParams, jsonString); if(thunderRet != Core::ERROR_NONE) { - XLOGD_ERROR("%s: Thunder call failed <%s> <%u>", __FUNCTION__, method.c_str(), thunderRet); + XLOGD_ERROR("Thunder call failed <%s> <%u>", method.c_str(), thunderRet); } else { *response = jsonString.Value(); ret = true; } } else { - XLOGD_ERROR("%s: Invalid parameters", __FUNCTION__); + XLOGD_ERROR("Invalid parameters"); } } else { - XLOGD_ERROR("%s: Client is NULL", __FUNCTION__); + XLOGD_ERROR("Client is NULL"); } return(ret); } From 3fd1df765fecd3aa2129a10603be57db34ab24da Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Wed, 8 Apr 2026 14:18:06 -0400 Subject: [PATCH 7/8] Update ctrlm_thunder_plugin.h --- src/thunder/ctrlm_thunder_plugin.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/thunder/ctrlm_thunder_plugin.h b/src/thunder/ctrlm_thunder_plugin.h index aeb7396b..919502f2 100644 --- a/src/thunder/ctrlm_thunder_plugin.h +++ b/src/thunder/ctrlm_thunder_plugin.h @@ -107,7 +107,6 @@ class ctrlm_thunder_plugin_t { /** * This function is used to get a Thunder Plugin property. * @param property The property the user wants to get - * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param retries The number of retries if the call times out. * @return True if the call succeeded, otherwise False. From ef652ff6e12c5ef70594182f58dff2ef610d0a53 Mon Sep 17 00:00:00 2001 From: jthomp007c Date: Wed, 8 Apr 2026 14:50:15 -0400 Subject: [PATCH 8/8] Update ctrlm_thunder_plugin.h --- src/thunder/ctrlm_thunder_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thunder/ctrlm_thunder_plugin.h b/src/thunder/ctrlm_thunder_plugin.h index 919502f2..5a04be72 100644 --- a/src/thunder/ctrlm_thunder_plugin.h +++ b/src/thunder/ctrlm_thunder_plugin.h @@ -136,7 +136,7 @@ class ctrlm_thunder_plugin_t { * This function is used to call a Thunder Plugin method. * @param method The method in which the user wants to call. * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) - * @param response A pointer a string which will be assigned + * @param response A pointer a string to accept the response * @return True if the call succeeded, otherwise False. */ bool call_plugin_string(std::string method, void *params, std::string *response);