# 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
    }
    Copy to clipboard

## 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);
    }
    Copy to clipboard

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);
    Copy to clipboard

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

handlerExRef = taf_pm_AddStateChangeExHandler(TestStateChangeExHandler, NULL);
    Copy to clipboard

## Get 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);
    Copy to clipboard

## State change acknowledgement 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);
    Copy to clipboard

Last Published: May 11, 2026

Previous Topic
 
Flash Access Service Next Topic

Radio Service