Display Manager

The Display Manager service (com.palm.display) has one method -- status.


status

Returns the device display status. If subscribe=true, then the method returns updates (as events) when the screen turns on or off, dims, or brightens.

Syntax

{
    "subscribe" : boolean
}

Parameters

Parameter Required Type Description
subscribe No boolean Flag to return events indicating display state changes; otherwise, only the current display status is returned.

Returns

{
   "returnValue"  : boolean,
   "event"        : string,
   "state"        : string,
   "dockMode"     : boolean,
   "subscribed"   : boolean
}
Attribute Required Type Description
returnValue Yes boolean true (success) or false (failure)
event Yes string Display state change, returned periodically when subscribe=true:
  • displayOn -- The display turned on
  • displayDimmed -- The display dimmed
  • displayOff -- The display turned off
  • request -- The initial event received in response to the subscription request
state No string Display state:
  • on
  • off
  • dimmed
dockMode No boolean This field is returned with a value of true if the device is in Exhibition mode (attached to the Touchstone charging dock); otherwise, this field is not returned.
subscribed No boolean Indicates whether the subscription succeeded.

Examples

Enyo

...
{
    name : "getDisplayStatus",
    kind : "PalmService",
    service : "palm://com.palm.display/",
    method : "status",
    onSuccess : "statusFinished",
    onFailure : "statusFail",
    onResponse : "gotResponse",
    subscribe : true
}
...

statusFinished : function(inSender, inResponse) {
    enyo.log("Status success, results=" + enyo.json.stringify(inResponse));
},
statusFail : function(inSender, inResponse) {
    enyo.log("Status failure, results=" + enyo.json.stringify(inResponse));
},
getStatus : function(inSender, inResponse)
{
    this.$.getDisplayStatus.call({ "subscribe": true });
}

Mojo

this.controller.serviceRequest('palm://com.palm.display/', {
        method: 'status',
        parameters: {
             "subscribe": true
         },
         onSuccess : function (e){ Mojo.Log.info("Status success, results="+JSON.stringify(e)); },
         onFailure : function (e){ Mojo.Log.info("Status failure, results="+JSON.stringify(e)); }
    });

Success

Status success, results={"returnValue":true,"event":"request","state":"on","subscribed":true}
Status success, results={"returnValue":true,"event":"displayDimmed"}
Status success, results={"returnValue":true,"event":"displayOff"}
Status success, results={"returnValue":true,"event":"displayOn"}