-
Notifications
You must be signed in to change notification settings - Fork 4
Update ctrlm_thunder_plugin_powermanager.cpp #193
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: support/1.1.11
Are you sure you want to change the base?
Changes from all commits
d98d86e
d2329ca
4176268
11ea30b
d35e7da
2a3bc2a
3fd1df7
ef652ff
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -106,8 +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 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 property The property the user wants to get | ||||||
|
||||||
| * @param property The property the user wants to get | |
| * @param property The property the user wants to get. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -107,19 +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)) { | ||||||||||||||||||||||||
| wakeup_reason_voice = (0 == strncmp(response["result"].String().c_str(), "VOICE", 5)); | ||||||||||||||||||||||||
| 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"); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
120
to
+126
|
||||||||||||||||||||||||
| } else { | |
| XLOGD_ERROR("getLastWakeupReason call failed"); | |
| } | |
| sem_post(&this->semaphore); | |
| XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); | |
| XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); | |
| } else { | |
| XLOGD_ERROR("getLastWakeupReason call failed"); | |
| } | |
| sem_post(&this->semaphore); |
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.
call_plugin_string largely duplicates call_plugin_boolean (client cast, parameter validation, Invoke, error handling). Consider extracting a small internal templated helper for primitive-return Invoke calls to reduce duplication and keep logging/handling consistent as more typed helpers are added.