-
Notifications
You must be signed in to change notification settings - Fork 4
DELIA-70047 #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
DELIA-70047 #187
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -261,6 +261,30 @@ bool ctrlm_thunder_plugin_t::call_plugin(std::string method, void *params, void | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| return(ret); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool ctrlm_thunder_plugin_t::call_plugin_boolean(std::string method, void *params, bool *response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool ret = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto clientObject = (JSONRPC::LinkType<Core::JSON::IElement>*)this->plugin_client; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JsonObject *jsonParams = (JsonObject *)params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(clientObject) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(!method.empty() && jsonParams && response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Core::JSON::Boolean jsonResponse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uint32_t thunderRet = clientObject->Invoke<JsonObject, Core::JSON::Boolean>(CALL_TIMEOUT, _T(method), *jsonParams, jsonResponse); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(thunderRet == Core::ERROR_NONE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *response = jsonResponse.Value(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ret = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XLOGD_ERROR("%s: Thunder call success <%s> <%u> response:%d \n", __FUNCTION__, method.c_str(), thunderRet, *response); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XLOGD_ERROR("%s: Thunder call success <%s> <%u> response:%d \n", __FUNCTION__, method.c_str(), thunderRet, *response); |
Copilot
AI
Mar 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a new Thunder call helper but it doesn’t support retries on Core::ERROR_TIMEDOUT like call_plugin/property_get do. To keep behavior consistent and avoid transient timeouts becoming hard failures, consider adding a retries parameter (default 0) and wrapping Invoke in the same timed-out retry loop used by call_plugin.
| uint32_t thunderRet = clientObject->Invoke<JsonObject, Core::JSON::Boolean>(CALL_TIMEOUT, _T(method), *jsonParams, jsonResponse); | |
| if(thunderRet == Core::ERROR_NONE) { | |
| *response = jsonResponse.Value(); | |
| ret = true; | |
| XLOGD_ERROR("%s: Thunder call success <%s> <%u> response:%d \n", __FUNCTION__, method.c_str(), thunderRet, *response); | |
| } else { | |
| XLOGD_ERROR("%s: Thunder call failed <%s> <%u>\n", __FUNCTION__, method.c_str(), thunderRet); | |
| unsigned int attempts = 0; | |
| unsigned int retries = 0; // keep current behavior: no retries beyond the initial attempt | |
| uint32_t thunderRet = Core::ERROR_TIMEDOUT; | |
| while(thunderRet == Core::ERROR_TIMEDOUT && attempts <= retries) { // Only retry on TIMEDOUT | |
| thunderRet = clientObject->Invoke<JsonObject, Core::JSON::Boolean>(CALL_TIMEOUT, _T(method), *jsonParams, jsonResponse); | |
| if(thunderRet == Core::ERROR_NONE) { | |
| *response = jsonResponse.Value(); | |
| ret = true; | |
| XLOGD_ERROR("%s: Thunder call success <%s> <%u> response:%d \n", __FUNCTION__, method.c_str(), thunderRet, *response); | |
| } else { | |
| attempts += 1; | |
| XLOGD_ERROR("%s: Thunder call failed <%s> <%u>, attempt %u of %u\n", | |
| __FUNCTION__, | |
| method.c_str(), | |
| thunderRet, | |
| attempts, | |
| (thunderRet == Core::ERROR_TIMEDOUT ? retries : 0) + 1); // retries + initial attempt | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -124,6 +124,8 @@ class ctrlm_thunder_plugin_t { | |||||||||||||||||||
| */ | ||||||||||||||||||||
| bool call_plugin(std::string method, void *params, void *response, unsigned int retries = 0); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
||||||||||||||||||||
| /** | |
| * This function is used to call a Thunder Plugin method that returns a boolean result. | |
| * @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 Pointer to a boolean that will contain the result from the call. | |
| * @return True if the call succeeded, otherwise False. | |
| */ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -89,16 +89,15 @@ ctrlm_power_state_t ctrlm_thunder_plugin_powermanager_t::get_power_state() { | |||||
| /* 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.getNetworkStandbyMode", "params": {} }' | ||||||
| {"jsonrpc":"2.0","id":1234567890,"result":true} */ | ||||||
| bool ctrlm_thunder_plugin_powermanager_t::get_networked_standby_mode() { | ||||||
| JsonObject params, response; | ||||||
| JsonObject params; | ||||||
| params = {}; | ||||||
| bool networked_standby_mode = false; | ||||||
|
|
||||||
| sem_wait(&this->semaphore); | ||||||
| if(this->call_plugin("getNetworkStandbyMode", (void *)¶ms, (void *)&response)) { | ||||||
| networked_standby_mode = response["result"].Boolean(); | ||||||
| XLOGD_DEBUG("networked_standby_mode is %s", networked_standby_mode?"TRUE":"FALSE"); | ||||||
| sem_wait(&this->semaphore); | ||||||
| if(this->call_plugin_boolean("getNetworkStandbyMode", (void *)¶ms, &networked_standby_mode)) { | ||||||
| XLOGD_ERROR("networked_standby_mode is %s", networked_standby_mode ? "TRUE" : "FALSE"); | ||||||
|
||||||
| XLOGD_ERROR("networked_standby_mode is %s", networked_standby_mode ? "TRUE" : "FALSE"); | |
| XLOGD_DEBUG("networked_standby_mode is %s", networked_standby_mode ? "TRUE" : "FALSE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a temporary ticket-specific debug log and it uses XLOGD_ERROR unconditionally. It also duplicates the earlier NSM log (and calls ctrlm_main_get_networked_standby_mode again), which can add noise. Please remove this line or downgrade it to DEBUG and gate it the same way as the existing NSM log.