Snapdragon® Telematics Application Framework (TelAF) Interface Specification
Power Management Service

API Reference


Components need access to the TelAF Power Manager to control the system's wake-up state. Operations that need fast response times (e.g., maintaining call state or playing/recording a media stream) result in high interrupt rates; keeping the system awake results in better performance and power efficiency.

TelAF Power Manager keeps the system awake when at least one of the registered components requests a wakeup source to be held. When all wakeup sources are released, the system may enter a suspend state depending on the status of other (unrelated) wakeup sources.

IPC interfaces binding

The functions of this API are provided by the tafPMSvc application service.

The following example illustrates how to bind to PM services.

bindings:
{
    clientExe.clientComponent.taf_pm -> tafPMSvc.taf_pm
}

Requesting and releasing a wakeup source

TelAF Power Manager service provides basic APIs for requesting and releasing a wakeup source. TelAF Power Manager's clients call taf_pm_NewWakeupSource() to create a wakeup source. This function returns a taf_pm_WakeupSourceRef_t type that can later be used to acquire and release a wakeup source through taf_pm_StayAwake() and taf_pm_Relax(), respectively. Wakeup sources are not reference-counted, which means multiple calls to taf_pm_StayAwake() can be canceled by a single call to taf_pm_Relax().

To have a reference-counted wakeup-source, set the TAF_PM_REF_COUNT bit in the opts argument. When this bit is set, each taf_pm_StayAwake() increments a counter and multiple calls to taf_pm_Relax() are necessary to release the wakeup source.

 char tag[10];

 snprintf(tag, sizeof(tag), "testpm");
 taf_pm_WakeupSourceRef_t ref = taf_pm_NewWakeupSource(1, tag);

 for(int i = 0; i < 5; i++) {
     tafPMTest_acquire(ref);
 }
 for(int i = 0; i < 5; i++) {
     tafPMTest_release(ref);
 }

TelAF Power Manager service will automatically release and delete all wakeup sources held on. behalf of an exiting or disconnecting client.

Use the StateChange to register a notification callback function to be called before device state triggers.

stateChangehandlerRef = taf_pm_AddStateChangeHandler(TestStateChangeHandler, NULL);

Use the StateChangeEx to register a notification callback function to be called for every state change trigger.

 handlerExRef = taf_pm_AddStateChangeExHandler(TestStateChangeExHandler, NULL);

Get the available Virtual Machines

TelAF Power Manager Service provides APIs to know the available machines on the device. TelAF Power Manager's client calls taf_pm_GetMachineList() to get the machine available reference. This function returns a taf_pm_VMListRef_t that can be later used to get the name of each machine, and also to delete the list reference using taf_pm_DeleteMachineList().

 taf_pm_VMListRef_t vmListRef = taf_pm_GetMachineList( );
 char name[32] = {0};
 if(!vmListRef) {
     LE_ERROR("List is null");
 }
 le_result_t res = taf_pm_GetFirstMachineName(vmListRef, name, 32);
 while(res == LE_OK)
 {
     LE_INFO("vm name : %s",name);
     res = taf_pm_GetNextMachineName(vmListRef, name, 32);
 }
 res = taf_pm_DeleteMachineList(vmListRef);

Acknowledge on the state change notification

TelAF Power Manager Service should know the acknowledgement of clients to proceed with the state change. TelAF Power Manager's client calls taf_pm_SendStateChangeAck() to send the acknowledgement for state change.

 taf_pm_SendStateChangeAck(powerStateRef, state, TAF_PM_PVM, TAF_PM_READY);