Note
This API has been available since API level 13.
This API has been available since API level 13.
This service registers itself as com.webos.service.power and as com.webos.service.alarm and is provided by the sleep daemon (sleepd). It allows applications to interact with (e.g. defer or prevent) the system suspend/resume cycle.
Shutdown Process:
The sleep daemon (sleepd) also transitions the system (and ultimately the device) from "On" to "Off". Clients that wish to be notified of this transition and optionally defer or prevent it must first register with sleepd using the "shutdown/shutdownApplicationsRegister" or "shutdown/ShutdownServicesRegister" method.
When sleepd receives a "shutdown/initiate" request, it will transition to the "ShutdownApplications" state.
In the "ShutdownApplications" state, sleepd will broadcast the "ShutdownApplications" signal to all clients which have registered for this signal using the "shutdown/shutdownApplicationsRegister" method, and will wait a maximum of 15 seconds for all responses. Each registered client should respond with an acknowledgement (ACK) using the "shutdown/shutdownApplicationsAck" method. As soon as all clients respond with an ACK, or the "ShutdownApplications" timeout expires, sleepd will transition to the "ShutdownServices" state.
In the "ShutdownServices" state, sleepd will broadcast the "ShutdownServices" signal to all clients which have registered for this signal using the "shutdown/shutdownServicesRegister" method, and will wait a maximum of 15 seconds for all responses. Each registered client should respond with an ACK using the "shutdown/shutdownServicesAck" method. As soon as all clients respond with an ACK, or the "ShutdownServices" timeout expires, sleepd will reply to the caller of the "shutdown/initiate" request.
After receiving the reply to the "shutdown/initiate" request, the caller should then call "shutdown/machineOff" or "shutdown/machineReboot" to forcefully shut down or reboot the device, respectively.
API level 24
Schedule the IdleCheck thread to check if the device can suspend.
Note: Used for developer testing purposes.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | returnValue is always true |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/TESTSuspend '{}'
Response:
{
"returnValue":true
}
API level 24
Cancel a previous request (identified by "id") which was registered using activityStart.
Name | Required | Type | Description |
---|---|---|---|
id | Required | String | ID of activity that needs to be ended. This ID should be the same as one specified while calling activityStart method |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If the activityEnd method succeeds, returnValue will contain true If the activityEnd method fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | Number | Return -1 In case of error |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Malformed json | If the json object parsing fails |
Example scenario
# luna-send -n -f luna://com.webos.service.sleep/com/palm/power/activityEnd '{"id":"Diagnostics activity"}'
Response:
{
"returnValue":true
}
API level 24
An activity is a specified time duration for which you do not want the system to suspend. This method requests that the system create an activity for "duration" (in milliseconds) with an associated "id" (activity name).
Name | Required | Type | Description |
---|---|---|---|
id | Required | String | ID of the activity , which can be any string as defined by the caller |
duration_ms | Required | number | Duration of activity in milliseconds This is the amount of time the caller does not want sleepd to suspend the system |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If the activityStart method succeeds, returnValue will contain true If the activityStart method fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | String | return errorCode as -1 if method call fails |
Error Code | Error Text | Error Description |
---|---|---|
None | Activities frozen | This error indicates the system has decided to go to suspend and no new activities are accepted |
-1 | Malformed json | If json object parsing fails |
Example scenario
# luna-send -n -f luna://com.webos.service.sleep/com/palm/power/activityStart '{"id":"Diagnostics activity", "duration_ms":100}'
Response:
{
"returnValue":true
}
API level 24
Name | Required | Type | Description |
---|---|---|---|
clientName | Required | String | Name of the client |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If the clientCancelByName method succeeds, returnValue will contain true If the clientCancelByName method fails, returnValue will contain false. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | String | return errorCode as -1 if method call fails |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | clientName is invalid |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/clientCancelByName '{"clientName":"rdxd"}'
Response:
{
"returnValue":true
}
API level 24
Force the device to go into suspend even with charger connected or any activity is still active.
Note: Used for developer testing purposes.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | returnValue is always true |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/forceSuspend '{}'
Response:
{
"returnValue":true
}
API level 24
Name | Required | Type | Description |
---|---|---|---|
clientName | Required | String | Name of the client |
subscribe | Required | Boolean | Should be always set to true, since subscription is necessary for this method. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If the method succeeds, returnValue will contain true. If the method fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
clientId | Optional | String | The new ID created for the client |
subscribed | Optional | Boolean | Always true |
errorText | Optional | String | errorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | Number | Return -1 as errorCode |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Malformed json | If the json object parsing fails |
-1 | Invalid parameters | If client name is NULL or subscription is not set |
-1 | Unknown error | Unknown error |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/identify '{"subscribe":true, "clientName":"rdxd"}'
Response:
{
"subscribed":true,
"clientId":"1HE7I2ej.4",
"returnValue":true
}
API level 24
Used by a client to respond (ack or nack) to the "prepareSuspend" signal. Once the client sends ack to the "prepareSuspend" signal, the client does not do any more operations and prepare itself for the system suspend.
Name | Required | Type | Description |
---|---|---|---|
clientId | Required | String | ID of the client |
ack | Required | Boolean | To ack for prepareSuspend cycle, set ack to true To nack for prepareSuspend cycle, set ack to false This parameter needs to be set, else the method will return an error |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If prepareSuspendAck call succeeds, returnValue will contain true. If prepareSuspendAck call fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | Number | Return errorCode as -1 if method call fails |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid Parameters | ClientId is invalid or ack is not set |
-1 | Malformed json | If the json object parsing fails |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/prepareSuspendAck '{"clientId":"VGb93LuP.2", "ack":true}'
Response:
{
"returnValue":true
}
API level 24
Name | Required | Type | Description |
---|---|---|---|
clientId | Required | String | ID of the client as returned in the identify method call |
register | Required | Boolean | To register a vote in total count for "prepareSuspend" voting cycle, set register to true To not register a vote in total count for "prepareSuspend" voting cycle, set register to false This parameter needs to be set, else the method will return an error |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If prepareSuspendRegister call succeeds, returnValue will contain true. If prepareSuspendRegister call fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | Number | Return errorCode -1 if method call fails |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid Parameters | clientId is invalid or register is not set |
-1 | Malformed json | If the json object parsing fails |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/prepareSuspendRegister '{"clientId":"MRw5pw2V.2", "register":true}'
Response:
{
"returnValue":true
}
API level 24
Add the client's count in the total number of ACKs received for the "suspend request" signal.
Name | Required | Type | Description |
---|---|---|---|
clientId | Required | String | ID of the client as returned in the identify method call |
ack | Required | Boolean | To ack for suspendRequest cycle, set ack to true To nack for suspendRequest cycle, set ack to false This parameter needs to be set, else the method will return an error |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If suspendRequestAck call succeeds, returnValue will contain true. If suspendRequestAck call fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | String | return errorCode as -1 if method call fails |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid Parameters | ClientId is invalid or ack is not set |
-1 | Malformed json | If the json object parsing fails |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/suspendRequestAck '{"clientId":"VVxhXwzw.2", "ack":true}'
Resposne:
{
"returnValue":true
}
API level 24
Name | Required | Type | Description |
---|---|---|---|
clientId | Required | String | ID of the client as returned in the identify method call |
register | Required | Boolean | To register a vote in total count for "suspendRequest" voting cycle, set register to true To not register a vote in total count for "suspendRequest" voting cycle, set register to false This parameter needs to be set, else the method will return an error |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | If suspendRequestRegister call succeeds, returnValue will contain true. If suspendRequestRegister call fails, returnValue will contain false. The method may fail because of one the error conditions described in the Error Codes Reference table of this method. See the Error Code Reference table for more information. |
errorText | Optional | String | ErrorText contains the error text if the method fails. The method will return errorText only if it fails. See the Error Codes Reference of this method for more details. |
errorCode | Optional | String | return errorCode as -1 if method call fails |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | ClientId is invalid or register is not set |
-1 | Malformed json | An internal error occurred when parsing the JSON object being prepared as a response (extremely unlikely). |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/com/palm/power/suspendRequestRegister '{"clientId":"/var/run/ls2/T4fb64.4", "register":true}'
Response:
{
"returnValue":true
}
API level 24
Called by test code to reset state machine to square 1.
Note: Used for developer testing purposes.
None
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | true if success |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/TESTresetShutdownState '{}'
Response:
{
"returnValue":true
}
API level 13
Starts the shutdown process. It sends the shutdownApplications and shutdownServices signals to all the registered apps/services.
Returns "true" once the shutdown process is complete and the system decides that it can shutdown.
Note: This call does not do the actual shutdown; instead use the machineOff method.
None
Name | Required | Type | Description |
---|---|---|---|
success | Required | Boolean | Always returns true |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/initiate '{}'
Response:
{
"success":true
}
API level 13
Shuts down the machine forcefully.
Name | Required | Type | Description |
---|---|---|---|
reason | Required | String | Reason for the shutdown. Possible reasons are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | The reason parameter was not provided. |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/machineOff '{"reason":"remoteKey"}'
Response:
{
"returnValue":true
}
API level 13
Reboots the machine forcefully by calling "reboot".
Name | Required | Type | Description |
---|---|---|---|
reason | Required | String | The reason why caller wants to reboot the system. Possible reasons are:
|
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | The reason parameter was not provided |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/machineReboot '{"reason":"reset"}'
Response:
{
"returnValue":true
}
API level 13
Sets the client's response as ACK for the "shutdownApplications" signal and trigger the dispatcher for the shutdown state machine, so that if the total client ACK count exceeds total number of clients, it can proceed to the next state.
Name | Required | Type | Description |
---|---|---|---|
clientId | Required | String | The unique token for this client which was generated in a previous shutdownApplicationsRegister call. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | The clientId parameter was not provided |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/shutdownApplicationsAck '{"clientId":"/var/run/ls2/T4fb64.4"}'
Response:
{
"returnValue":true
}
API level 13
Registers an application for the "shutdownApplications" signal. Returns the client ID of the client.
Name | Required | Type | Description |
---|---|---|---|
clientName | Required | String | A unique name which the caller decides for the application. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
clientId | Required | String | This is a unique token generated for this client by this method, which should be used by the caller for acknowledging the shutdownApplications signal later. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | The clientName parameter was not provided |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/shutdownApplicationsRegister '{"clientName":"facebook app"}'
Response:
{
"returnValue":true,
"clientId":"/var/run/ls2/T4fb64.4"
}
API level 13
Sets the client's response as ACK for the "shutdownServices" signal and trigger the dispatcher for the shutdown state machine, so that if the total client ACK count exceeds total number of clients, it can proceed to the next state.
Name | Required | Type | Description |
---|---|---|---|
clientId | Required | String | The unique token for this client which was generated in a previous shutdownServicesRegister call. |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | The clientId parameter was not provided |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/shutdownServicesAck '{"clientId":"/var/run/ls2/T4fb64.5"}'
Response:
{
"returnValue":true
}
API level 13
Registers an application for the "shutdownApplications" signal. Returns the client ID of the client added.
Name | Required | Type | Description |
---|---|---|---|
clientName | Required | String | A unique name which the caller decides for the application |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
clientId | Required | String | This is a unique token generated for this client by this method, which should be used by the caller for acknowledging the shutdownApplications signal later. |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Invalid parameters | The clientName parameter was not provided |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/shutdown/shutdownServicesRegister '{"clientName":"facebook service"}'
Response:
{
"returnValue":true,
"clientId":"/var/run/ls2/T4fb64.5"
}
API level 24
Name | Required | Type | Description |
---|---|---|---|
serviceName | Optional | String | Name of the service for which the alarm is to be added |
key | Optional | String | identifier for the alarm |
relative_time | Required | String | amount of relative time after which the alarm should go off. time format is hh:mm:ss (hours:minutes:seconds) |
subscribe | Optional | Boolean | true if the results are to be subscribed |
Name | Required | Type | Description |
---|---|---|---|
alarmId | Optional | Number | alarmId if the alarm was successfully added |
subscribed | Optional | Boolean | subscribed parameter is received only if subscribe parameter is sent during alarmAdd request true: if subscription is successful false: is subscription failed
|
returnValue | Optional | Boolean |
|
errorText | Optional | String | Error message on failure |
Name | Required | Type | Description |
---|---|---|---|
alarmId | Required | Number | alarmId of the subscribed alarm |
fired | Required | Boolean | true: if the alarm has fired false: if the alarm has not fired |
key | Optional | String | alarm identifier of the fired alarm |
Error Code | Error Text | Error Description |
---|---|---|
None | Invalid format for alarm time | Payload format is incorrect |
None | Unknown error | Unknown error |
-1 | Malformed json | Invalid json data |
Example scenario
1. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
2. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"/var/run/ls2/tmp", "key":"key1", "subscribe":false}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
3. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"/var/run/ls2/tmp", "key":"key1", "subscribe":true}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
4. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{"relative_time":"0:0:2"}'
Response:
{"alarmId":0}
5. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"/var/run/ls2/tmp", "key":"key1", "relative_time":"0:0:5"}}'
Response:
{"alarmId":4}
6. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"/var/run/ls2/tmp", "key":"key1", "relative_time":"0:0:3", "subscribe":false}'
Response:
{"alarmId":5,"subscribed":false}
7. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"/var/run/ls2/tmp", "key":"key1", "relative_time":"0:0:3", "subscribe":true}'
Response:
{"alarmId":8,"subscribed":true}
8. luna-send -n 4 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"/var/run/ls2/tmp", "key":"key2", "relative_time":"0:0:3", "subscribe":true}'
Response:
{"alarmId":10,"subscribed":true}
Subscription Return:
{"alarmId":10,"fired":true,"key":"key2"} // on fire
9. luna-send -n 3 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"com.webos.service.sleep", "key":"calendarAlarm", "relative_time":"0:0:4", "subscribe":true}'
Response:
{"alarmId":12,"subscribed":true}
Subscription Return:
{"alarmId":12,"fired":true,"key":"calendarAlarm"} //if key exists on fire
10. luna-send -n 3 luna://com.webos.service.sleep/time/alarmAdd '{"serviceName":"com.webos.service.sleep", "relative_time":"0:0:4", "subscribe":true}'
Response:
{"alarmId":13,"subscribed":true}
Subscription Return:
{"alarmId":13,"fired":true} //without key on fire
API level 24
Name | Required | Type | Description |
---|---|---|---|
serviceName | Optional | String | Service name for which the alarm needs to be set |
key | Optional | String | alarm identifier |
date | Required | String | date at which alarm should fire. format is mm-dd-yyyy |
time | Required | String | time at which alarm should fire. format is hh:mm:ss (0-23 hrs) (hh- hours, mm-minutes, ss-seconds) |
subscribe | Optional | Boolean | to subscribe to the results of this call |
Name | Required | Type | Description |
---|---|---|---|
alarmId | Optional | Number | alarm Id of the added calendar alarm if alarmAddCalendar is successful |
subscribed | Optional | String | subscribed parameter is received only if subscribe parameter is sent during alarmAddCalendar request true: if subscription is successful false: is subscription failed |
key | Optional | String | alarm identifier of the fired alarm if provided during the alarmAddCalendar request. |
fired | Optional | Boolean | true: if the alarm has fired false: if the alarm has not fired |
returnValue | Optional | Boolean |
|
errorText | Optional | String | Error message on failure |
Name | Required | Type | Description |
---|---|---|---|
alarmId | Required | Number | alarmId of the subscribed alarm |
fired | Required | Boolean | true: if the alarm has fired false: if the alarm has not fired |
key | Optional | String | alarm identifier of the fired alarm |
Error Code | Error Text | Error Description |
---|---|---|
None | Invalid format for alarm time. | Invalid format for alarm time. |
None | Unknown error | Unknown error |
-1 | malformed json object | Invalid json object |
Example scenario
1. luna-send -n 2 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"01-24-2020", "time":"10:01:03", "subscribe":}'
Response:
{"returnValue":false, "errorCode":-1,"errorText":"Malformed json."}
2. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
3. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"serviceName":"com.palm.X"}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
4. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"key":"calendarAlarm"}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
5. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"serviceName":"com.palm.X", "key":"calendarAlarm", "date":"23-01-2020", "subscribe":false}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
6. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"serviceName":"com.palm.X", "key":"calendarAlarm", "time":"23:49:03", "subscribe":false}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
7. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"23-01-2020", "time":"49:03"}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
8. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"23-01-2020", "time":"23:52:03"}'
Response:
{"returnValue":false,"errorText":"Invalid format for alarm time."}
9. luna-send -n 1 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"01-23-2020", "time":"23:52:03"}'
Response:
{"alarmId":14}
10. luna-send -n 2 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"01-23-2020", "time":"23:56:03", "subscribe":true}' //already fired
Subscription Return:
{"alarmId":17,"fired":true}
Response:
{"alarmId":17,"subscribed":true}
11. luna-send -n 2 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"01-24-2020", "time":"10:00:03", "subscribe":true}' //not yet fired
Response:
{"alarmId":22,"subscribed":true}
Subscription Return:
{"alarmId":22,"fired":true} //on fire
12. luna-send -n 2 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"01-24-2020", "time":"10:01:03", "subscribe":false}' //no subscription
Response:
{"alarmId":23,"subscribed":false}
13. luna-send -n 2 luna://com.webos.service.sleep/time/alarmAddCalendar '{"date":"01-23-2020", "time":"23:56:03", "subscribe":false}'
Response:
{"alarmId":26,"subscribed":false}
API level 24
Query for set of alarms identified by 'serviceName' & 'key'.
Name | Required | Type | Description |
---|---|---|---|
serviceName | Required | String | service name for which the alarm is being queried |
key | Required | String | identifier for the alarm |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Optional | Boolean |
|
alarms | Optional | Object array | An array of alarms identified by provided serviceName and key |
errorText | Optional | String | Error message if call fails |
Error Code | Error Text | Error Description |
---|---|---|
-1 | malformed json object | Invalid json data |
Example scenario
1. luna-send -n 1 luna://com.webos.service.sleep/time/alarmQuery '{"serviceName":"com.palm.ser2", "key":"alarmCalendar2"}'
Response:
{"alarms": []}
2. luna-send -n 1 luna://com.webos.service.sleep/time/alarmQuery '{"serviceName":"com.palm.ser2", "key":"alarmCalendar"}'
Response:
{"alarms": []}
3. luna-send -n 1 luna://com.webos.service.sleep/time/alarmQuery '{"serviceName":"com.palm.ser2"}'
Response:
{"returnValue":false,"errorText":"alarmQuery parameters are missing."}
4. luna-send -n 1 luna://com.webos.service.sleep/time/alarmQuery '{"serviceName":"", "key":"alarmCalendar2"}'
Response:
{"alarms": []}
5. luna-send -n 1 luna://com.webos.service.sleep/time/alarmQuery '{"key":"alarmCalendar2"}'
Response:
{"returnValue":false,"errorText":"alarmQuery parameters are missing."}
API level 24
None
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/time/internalAlarmFired '{}'
API level 13
Handles a timeout/clear message and deletes a timeout by its key.
Name | Required | Type | Description |
---|---|---|---|
key | Required | String | Unique identifier for the alarm |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
key | Optional | String | Unique identifier for the alarm |
errorText | Optional | String | Indicates the reason for the failure of the operation. See the "Error Codes Reference" section of this method for details. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Malformed JSON object | Invalid JSON data |
-1 | Invalid parameters | Invalid parameters data received |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/timeout/clear '{
"key":"com.webos.service.activitymanager.wakeup"
}'
Response:
{
"returnValue":true,
"key":"com.webos.service.activitymanager.wakeup"
}
API level 13
Handles a timeout/set message and adds a new power timeout. Relative timeouts can be set by passing the "in" parameter. Absolute timeouts can be set by passing the "at" parameter.
Name | Required | Type | Description |
---|---|---|---|
key | Required | String | Unique key to identify individual alarms |
at | Required | String | Absolute time for the alarm to be set to. Either this or the "in" parameter must be passed. |
in | Required | String | Relative time for the alarm to be set to. Either this or the "at" parameter must be passed. |
uri | Required | String | URI to be passed to the alarm |
params | Required | String | Parameters for the URI. |
wakeup | Optional | Boolean | If a wakeup alarm needs to be set. |
activity_id | Optional | String | Activity ID |
activity_duration_ms | Optional | Number | Duration in milliseconds to keep the device ON. Needs to be provided only if activity_id is provided. |
keep_existing | Optional | Boolean | Set to true to keep existing alarms with the same key |
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates the status of operation. Possible values are:
|
key | Required | String | Unique key used to identify the alarm |
kept_existing | Optional | Boolean | If the existing alarms have been kept |
errorText | Optional | String | Indicates the reason for the failure of the operation. |
Error Code | Error Text | Error Description |
---|---|---|
-1 | Malformed JSON object | Invalid JSON data |
Example scenario
# luna-send -n 1 luna://com.webos.service.sleep/timeout/set '{
"at":"03/12/2014 06:26:46",
"key":"com.webos.service.activitymanager.wakeup",
"params":{},
"uri":"luna://com.webos.service.activitymanager/callback/scheduledwakeup",
"wakeup":true
}'
Response:
{
"returnValue":true,
"key":"com.webos.service.activitymanager.wakeup"
}
This is the signal sent out by the sleepd daemon to the applications when the shutdown process starts. The daemon expects to get a response from all the registered applications if they are ready for the system shutdown.
This is the signal sent out by the sleepd daemon to the services when the shutdown process starts. The daemon expects to get a response from all the registered services if they are ready for the system shutdown.
Contents