Skip to main content
Version: 20 Mar 2024

Power Manager

Power Manager provides a set of power management APIs that allow applications to receive callbacks when the power state, properties or error conditions of components change, as well as APIs to get device components power state and properties, and to set certain component power states. More...

Classes

Name
structMLPowerManagerComponentProperty
A structure to encapsulate the data for each MLPowerManagerPropertyType.
unionMLPowerManagerComponentProperty.unnamed
structMLPowerManagerPropertyData
A structure to encapsulate output data when getting the current properties.
structMLPowerManagerPropertyTypeData
A structure to encapsulate output data when getting a component's available property types.
structMLPowerManagerPropertyTypeInfo
A structure to encapsulate information used by the Power Manager when getting the available property types.
structMLPowerManagerPropertyInfo
A structure to encapsulate info data used by the Power Manager when getting the current properties.
structMLPowerManagerPowerStateSettings
A structure to encapsulate settings used by the Power Manager when requesting the power state to be changed.
structMLPowerManagerPowerStateInfo
A structure to encapsulate info data used by the Power Manager when getting the current power state.
structMLPowerManagerPowerStateData
A structure to encapsulate output data when either getting available power states, or the current power state.
structMLPowerManagerCallbacks
A structure containing Power Manager callback events. Individual callbacks which are not required by the Power Manager can be NULL.

Types

Name
typedef struct MLPowerManagerComponentPropertyMLPowerManagerComponentProperty
A structure to encapsulate the data for each MLPowerManagerPropertyType.
typedef struct MLPowerManagerPropertyDataMLPowerManagerPropertyData
A structure to encapsulate output data when getting the current properties.
typedef struct MLPowerManagerPropertyTypeDataMLPowerManagerPropertyTypeData
A structure to encapsulate output data when getting a component's available property types.
typedef struct MLPowerManagerPropertyTypeInfoMLPowerManagerPropertyTypeInfo
A structure to encapsulate information used by the Power Manager when getting the available property types.
typedef struct MLPowerManagerPropertyInfoMLPowerManagerPropertyInfo
A structure to encapsulate info data used by the Power Manager when getting the current properties.
typedef struct MLPowerManagerPowerStateSettingsMLPowerManagerPowerStateSettings
A structure to encapsulate settings used by the Power Manager when requesting the power state to be changed.
typedef struct MLPowerManagerPowerStateInfoMLPowerManagerPowerStateInfo
A structure to encapsulate info data used by the Power Manager when getting the current power state.
typedef struct MLPowerManagerPowerStateDataMLPowerManagerPowerStateData
A structure to encapsulate output data when either getting available power states, or the current power state.
typedef struct MLPowerManagerCallbacksMLPowerManagerCallbacks
A structure containing Power Manager callback events. Individual callbacks which are not required by the Power Manager can be NULL.

Enums

Name
enumAnonymous Enum 24
{
MLResultAPIPrefix_PowerManager = ( 0x4c8a << 16)
}
enumMLPowerManagerResult
{
MLPowerManagerResult_NotConnected = MLResultAPIPrefix_PowerManager,
MLPowerManagerResult_InvalidStateTransition,
MLPowerManagerResult_StateTransitionsDisabled,
MLPowerManagerResult_UnsupportedState,
MLPowerManagerResult_Ensure32Bits = 0x7FFFFFFF
}
Power Manager specific return codes.
enumMLPowerManagerComponent
{
MLPowerManagerComponent_None = 0,
MLPowerManagerComponent_Controller = 1,
MLPowerManagerComponent_Ensure32Bits = 0x7FFFFFFF
}
Represents the different components which can be accessed/controlled using the Power Manager.
enumMLPowerManagerError
{
MLPowerManagerError_InvalidSKU = 0,
MLPowerManagerError_Ensure32Bits = 0x7FFFFFFF
}
Power Manager error codes.
enumMLPowerManagerPowerState
{
MLPowerManagerPowerState_None = 0,
MLPowerManagerPowerState_Normal = 1,
MLPowerManagerPowerState_DisabledWhileCharging = 2,
MLPowerManagerPowerState_Standby = 3,
MLPowerManagerPowerState_Sleep = 4,
MLPowerManagerPowerState_Ensure32Bits = 0x7FFFFFFF
}
Power states. Query MLPowerManagerGetAvailablePowerStates() to determine which power state is available for each component.
enumMLPowerManagerChargingState
{
MLPowerManagerChargingState_NotCharging = 0,
MLPowerManagerChargingState_ChargingNormally = 1,
MLPowerManagerChargingState_Ensure32Bits = 0x7FFFFFFF
}
Power Manager charging states.
enumMLPowerManagerConnectionState
{
MLPowerManagerConnectionState_Connected = 0,
MLPowerManagerConnectionState_Disconnected = 1,
MLPowerManagerConnectionState_Ensure32Bits = 0x7FFFFFFF
}
Connection state of the component.
enumMLPowerManagerBatteryInfo
{
MLPowerManagerBatteryInfo_OK = 0,
MLPowerManagerBatteryInfo_BatteryLow = 1,
MLPowerManagerBatteryInfo_BatteryCritical = 2,
MLPowerManagerBatteryInfo_Ensure32Bits = 0x7FFFFFFF
}
Battery info/warning codes.
enumMLPowerManagerPropertyType
{
MLPowerManagerPropertyType_BatteryInfo = 0,
MLPowerManagerPropertyType_BatteryLevel = 1,
MLPowerManagerPropertyType_ChargingState = 2,
MLPowerManagerPropertyType_ConnectionState = 3,
MLPowerManagerPropertyType_Ensure32Bits = 0x7FFFFFFF
}
Power Manager property types. Query MLPowerManagerGetAvailableProperties() to determine which Power Manager properties are available for each component.

Functions

Name
voidMLPowerManagerPropertyTypeInfoInit(MLPowerManagerPropertyTypeInfo * inout_property_type_info)
Initializes the default values for MLPowerManagerPropertyTypeInfo.
voidMLPowerManagerPropertyInfoInit(MLPowerManagerPropertyInfo * inout_property_info)
Initializes the default values for MLPowerManagerPropertyInfo.
voidMLPowerManagerPowerStateSettingsInit(MLPowerManagerPowerStateSettings * inout_power_settings)
Initializes the default values for MLPowerManagerPowerStateSettings.
voidMLPowerManagerPowerStateInfoInit(MLPowerManagerPowerStateInfo * inout_power_info)
Initializes the default values for MLPowerManagerPowerStateInfo.
voidMLPowerManagerCallbacksInit(MLPowerManagerCallbacks * inout_cb)
Initializes the default values for MLPowerManagerCallbacks.
MLResultMLPowerManagerCreate(MLPowerManagerComponent component, MLHandle * out_handle)
Creates a Power Manager handle for a specified component.
MLResultMLPowerManagerDestroy(MLHandle handle)
Destroys a Power Manager handle.
MLResultMLPowerManagerSetCallbacks(MLHandle handle, MLPowerManagerCallbacks cb, void user_data)
Register Power Manager callbacks for a specific handle.
MLResultMLPowerManagerSetPowerState(MLHandle handle, const MLPowerManagerPowerStateSettings * settings)
Sets the power state of a component. The new power state of a component will persist if the application loses focus, or exits.
MLResultMLPowerManagerGetComponentProperties(MLHandle handle, const MLPowerManagerPropertyInfo in_info, MLPowerManagerPropertyData out_properties)
Gets the power manager properties of a component.
MLResultMLPowerManagerReleasePropertyData(MLHandle handle, MLPowerManagerPropertyData * properties)
Releases specified MLPowerManagerPropertyData.
MLResultMLPowerManagerGetAvailablePowerStates(MLHandle handle, const MLPowerManagerPowerStateInfo in_info, MLPowerManagerPowerStateData out_states)
Query available power states for a component.
MLResultMLPowerManagerGetPowerState(MLHandle handle, const MLPowerManagerPowerStateInfo in_info, MLPowerManagerPowerStateData out_state)
Gets the power state of a component.
MLResultMLPowerManagerReleasePowerStateData(MLHandle handle, MLPowerManagerPowerStateData * power_states)
Releases specified MLPowerManagerPowerStateData.
MLResultMLPowerManagerGetAvailableProperties(MLHandle handle, const MLPowerManagerPropertyTypeInfo in_info, MLPowerManagerPropertyTypeData out_properties)
Request a list of the available MLPowerManagerPropertyType.
MLResultMLPowerManagerReleasePropertyTypeData(MLHandle handle, MLPowerManagerPropertyTypeData * properties)
Releases specified MLPowerManagerPropertyTypeData.
const char *MLPowerManagerGetResultString(MLResult result_code)
Returns an ASCII string for each result code.

Detailed Description

Power Manager provides a set of power management APIs that allow applications to receive callbacks when the power state, properties or error conditions of components change, as well as APIs to get device components power state and properties, and to set certain component power states.

The API uses component specific handles, as such an application should create a handle for each kind of component it wishes to get/set power state or properties for.

Shared Object:

  • power_manager.magicleap*

Enums Documentation

Anonymous Enum 24

EnumeratorValueDescription
MLResultAPIPrefix_PowerManager( 0x4c8a << 16)Defines the prefix for Power Manager return codes.

MLPowerManagerResult

EnumeratorValueDescription
MLPowerManagerResult_NotConnectedMLResultAPIPrefix_PowerManagerIndicates the component is not connected.
MLPowerManagerResult_InvalidStateTransitionIndicates the component does not currently support transitioning to requested state.
MLPowerManagerResult_StateTransitionsDisabledIndicates the component does not currently support transitioning to a different state.
MLPowerManagerResult_UnsupportedStateIndicates the component does not support the requested power state.
MLPowerManagerResult_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Power Manager specific return codes.

API Level:

  • 27

MLPowerManagerComponent

EnumeratorValueDescription
MLPowerManagerComponent_None0Invalid or no component.
MLPowerManagerComponent_Controller1Controller.
MLPowerManagerComponent_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Represents the different components which can be accessed/controlled using the Power Manager.

API Level:

  • 27

MLPowerManagerError

EnumeratorValueDescription
MLPowerManagerError_InvalidSKU0Controller component could not be connected due to Invalid SKU.
MLPowerManagerError_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Power Manager error codes.

API Level:

  • 27

MLPowerManagerPowerState

EnumeratorValueDescription
MLPowerManagerPowerState_None0Invalid or no power state.
MLPowerManagerPowerState_Normal1Normal mode, this is the default or active state of the component.
MLPowerManagerPowerState_DisabledWhileCharging2Charging only mode. When charging component it cannot be used.
MLPowerManagerPowerState_Standby3Standby mode.
MLPowerManagerPowerState_Sleep4Sleep mode.
MLPowerManagerPowerState_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Power states. Query MLPowerManagerGetAvailablePowerStates() to determine which power state is available for each component.

ComponentPower StateDescription
ControllerNormalController is active
Disabled While ChargingCertain SKUs cannot use controller while charging
StandbyController is turned on but inactive, press home button to switch to active manually
SleepNot supported for this component

API Level:

  • 27

MLPowerManagerChargingState

EnumeratorValueDescription
MLPowerManagerChargingState_NotCharging0Not charging.
MLPowerManagerChargingState_ChargingNormally1Charging normally.
MLPowerManagerChargingState_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Power Manager charging states.

API Level:

  • 27

MLPowerManagerConnectionState

EnumeratorValueDescription
MLPowerManagerConnectionState_Connected0Component is connected.
MLPowerManagerConnectionState_Disconnected1Component is disconnected.
MLPowerManagerConnectionState_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Connection state of the component.

API Level:

  • 27

MLPowerManagerBatteryInfo

EnumeratorValueDescription
MLPowerManagerBatteryInfo_OK0No issues reported.
MLPowerManagerBatteryInfo_BatteryLow1Charge the component soon.
MLPowerManagerBatteryInfo_BatteryCritical2Charge the component immediately.
MLPowerManagerBatteryInfo_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Battery info/warning codes.

API Level:

  • 27

MLPowerManagerPropertyType

EnumeratorValueDescription
MLPowerManagerPropertyType_BatteryInfo0Extra info about battery, as represented by MLPowerManagerBatteryInfo.
MLPowerManagerPropertyType_BatteryLevel1Battery level. Range is between 0 and 100.
MLPowerManagerPropertyType_ChargingState2Charging state.
MLPowerManagerPropertyType_ConnectionState3Connection state.
MLPowerManagerPropertyType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Power Manager property types. Query MLPowerManagerGetAvailableProperties() to determine which Power Manager properties are available for each component.

API Level:

  • 27

Types Documentation

MLPowerManagerComponentProperty

typedef struct MLPowerManagerComponentProperty MLPowerManagerComponentProperty;

A structure to encapsulate the data for each MLPowerManagerPropertyType.

This struct and union is used as a flexible way for each component to output an array containing distinct types of data.

The below code shows how a Controller could output battery_info, battery_level, charging_state or connection_state. Where data is an instance of MLPowerManagerPropertyData returned from MLPowerManagerGetComponentProperties.

auto properties = data.properties;
for (int num = 0; num < data.size; num++) {
switch (properties[num]->property_type) {
case (MLPowerManagerPropertyType_BatteryInfo):
// Process properties[num]->battery_info enum
break;
case (MLPowerManagerPropertyType_BatteryLevel):
// Process properties[num]->battery_level as integer
break;
case (MLPowerManagerPropertyType_ChargingState):
// Process properties[num]->charging_state as enum
break;
case (MLPowerManagerPropertyType_ConnectionState):
// Process properties[num]->connection_state as enum
break;
default:
// Error handle if default case
break;
}
}

More Info

API Level:

  • 27

MLPowerManagerPropertyData

typedef struct MLPowerManagerPropertyData MLPowerManagerPropertyData;

A structure to encapsulate output data when getting the current properties.

More Info

API Level:

  • 27

MLPowerManagerPropertyTypeData

typedef struct MLPowerManagerPropertyTypeData MLPowerManagerPropertyTypeData;

A structure to encapsulate output data when getting a component's available property types.

More Info

API Level:

  • 27

MLPowerManagerPropertyTypeInfo

typedef struct MLPowerManagerPropertyTypeInfo MLPowerManagerPropertyTypeInfo;

A structure to encapsulate information used by the Power Manager when getting the available property types.

This structure must be initialized by calling MLPowerManagerPropertyTypeInfoInit before use.

More Info

API Level:

  • 27

MLPowerManagerPropertyInfo

typedef struct MLPowerManagerPropertyInfo MLPowerManagerPropertyInfo;

A structure to encapsulate info data used by the Power Manager when getting the current properties.

This structure must be initialized by calling MLPowerManagerPropertyInfoInit before use.

More Info

API Level:

  • 27

MLPowerManagerPowerStateSettings

typedef struct MLPowerManagerPowerStateSettings MLPowerManagerPowerStateSettings;

A structure to encapsulate settings used by the Power Manager when requesting the power state to be changed.

This structure must be initialized by calling MLPowerManagerPowerStateSettingsInit before use.

More Info

API Level:

  • 27

MLPowerManagerPowerStateInfo

typedef struct MLPowerManagerPowerStateInfo MLPowerManagerPowerStateInfo;

A structure to encapsulate info data used by the Power Manager when getting the current power state.

This structure must be initialized by calling MLPowerManagerPowerStateInfoInit before use.

More Info

API Level:

  • 27

MLPowerManagerPowerStateData

typedef struct MLPowerManagerPowerStateData MLPowerManagerPowerStateData;

A structure to encapsulate output data when either getting available power states, or the current power state.

More Info

API Level:

  • 27

MLPowerManagerCallbacks

typedef struct MLPowerManagerCallbacks MLPowerManagerCallbacks;

A structure containing Power Manager callback events. Individual callbacks which are not required by the Power Manager can be NULL.

More Info

API Level:

  • 27

Functions Documentation

MLPowerManagerPropertyTypeInfoInit

static inline void MLPowerManagerPropertyTypeInfoInit(
MLPowerManagerPropertyTypeInfo * inout_property_type_info
)

Initializes the default values for MLPowerManagerPropertyTypeInfo.

Parameters

MLPowerManagerPropertyTypeInfo *inout_property_type_infoThe object to initialize with default values.

API Level:

  • 27

MLPowerManagerPropertyInfoInit

static inline void MLPowerManagerPropertyInfoInit(
MLPowerManagerPropertyInfo * inout_property_info
)

Initializes the default values for MLPowerManagerPropertyInfo.

Parameters

MLPowerManagerPropertyInfo *inout_property_infoThe object to initialize with default values.

API Level:

  • 27

MLPowerManagerPowerStateSettingsInit

static inline void MLPowerManagerPowerStateSettingsInit(
MLPowerManagerPowerStateSettings * inout_power_settings
)

Initializes the default values for MLPowerManagerPowerStateSettings.

Parameters

MLPowerManagerPowerStateSettings *inout_power_settingsThe object to initialize with default values.

API Level:

  • 27

MLPowerManagerPowerStateInfoInit

static inline void MLPowerManagerPowerStateInfoInit(
MLPowerManagerPowerStateInfo * inout_power_info
)

Initializes the default values for MLPowerManagerPowerStateInfo.

Parameters

MLPowerManagerPowerStateInfo *inout_power_infoThe object to initialize with default values.

API Level:

  • 27

MLPowerManagerCallbacksInit

static inline void MLPowerManagerCallbacksInit(
MLPowerManagerCallbacks * inout_cb
)

Initializes the default values for MLPowerManagerCallbacks.

Parameters

MLPowerManagerCallbacks *inout_cbThe object to initialize with default values.

API Level:

  • 27

MLPowerManagerCreate

MLResult MLPowerManagerCreate(
MLPowerManagerComponent component,
MLHandle * out_handle
)

Creates a Power Manager handle for a specified component.

Parameters

MLPowerManagerComponentcomponentThe component specific to the handle to be created.
MLHandle *out_handleThe handle to be created.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMlResult_HandleExistsHandle for this component already exists.
MLResultMLResult_OkPower Manager handle was successfully created.
MLResultMLResult_UnspecifiedFailurePower Manager handle failed to be created.

Required Permissions:

  • none

In a single application multiple calls to this API method, for the same component type will return a new handle each time. The handle is valid until MLPowerManagerDestroy for that specific handle is called.

API Level:

  • 27

MLPowerManagerDestroy

MLResult MLPowerManagerDestroy(
MLHandle handle
)

Destroys a Power Manager handle.

Parameters

MLHandlehandleThe Power Manager handle for a specific component to be destroyed.

Returns

MLResultMLResult_InvalidParamPassed handle was invalid.
MLResultMLResult_OkPower Manager handle was successfully destroyed.

Required Permissions:

  • None

API Level:

  • 27

MLPowerManagerSetCallbacks

MLResult MLPowerManagerSetCallbacks(
MLHandle handle,
MLPowerManagerCallbacks * cb,
void * user_data
)

Register Power Manager callbacks for a specific handle.

Parameters

MLHandlehandlePower Manager handle for component to set MLPowerManagerCallbacks for.
MLPowerManagerCallbacks *cbCallbacks to receive Power Manager events. Set this to NULL to unregister callbacks.
void *user_dataThe caller can pass in user context data that will be returned in the callback (can be NULL).

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkThe callbacks have been registered.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

The MLPowerManagerCallbacks structure can be set for each handle, whether those handles are for the same or different component types.

API Level:

  • 27

MLPowerManagerSetPowerState

MLResult MLPowerManagerSetPowerState(
MLHandle handle,
const MLPowerManagerPowerStateSettings * settings
)

Sets the power state of a component. The new power state of a component will persist if the application loses focus, or exits.

Parameters

MLHandlehandlePower Manager handle for component to set power state for.
const MLPowerManagerPowerStateSettings *settingsSettings used by the Power Manager updating a component's power state.

Returns

MLResultMLResult_IllegalStateThe component does not support the requested power state.
MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLPowerManagerResult_InvalidStateTransitionThe component does not support transitioning to the requested state.
MLResultMLPowerManagerResult_NotConnectedThe component is not connected.
MLResultMLResult_OkThe power state of the controller was set successfully.
MLResultMLPowerManagerResult_StateTransitionsDisabledThe component currently does not support transitioning to a different state.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.
MLResultMLPowerManagerResult_UnsupportedStateThe component does not support the requested power state.

Required Permissions:

  • None

API Level:

  • 27

MLPowerManagerGetComponentProperties

MLResult MLPowerManagerGetComponentProperties(
MLHandle handle,
const MLPowerManagerPropertyInfo * in_info,
MLPowerManagerPropertyData * out_properties
)

Gets the power manager properties of a component.

Parameters

MLHandlehandlePower Manager handle for component to get properties of.
const MLPowerManagerPropertyInfo *in_infoMLPowerManagerPropertyInfo struct filled with information about the power manager properties of a component to request.
MLPowerManagerPropertyData *out_propertiesInformation about the properties of a component. Must be released using MLPowerManagerReleasePropertyData after each successful call.

Returns

MLResultMLResult_AllocFailedFailed due to memory allocation failure.
MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkThe property of the controller was retrieved successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

API Level:

  • 27

MLPowerManagerReleasePropertyData

MLResult MLPowerManagerReleasePropertyData(
MLHandle handle,
MLPowerManagerPropertyData * properties
)

Releases specified MLPowerManagerPropertyData.

Parameters

MLHandlehandlePower Manager handle for component relating to MLPowerManagerPropertyData.
MLPowerManagerPropertyData *propertiesPointer to a MLPowerManagerPropertyData returned from MLPowerManagerGetComponentProperties.

Returns

MLResultMLResult_OkSuccessfully released MLPowerManagerPropertyData.
MLResultMLResult_InvalidParamproperties parameter was not valid (NULL).
MLResultMLResult_UnspecifiedFailureFailed due to internal error.

Required Permissions:

  • None

This function should be called exactly once for each successful call to MLPowerManagerGetComponentProperties.


MLPowerManagerGetAvailablePowerStates

MLResult MLPowerManagerGetAvailablePowerStates(
MLHandle handle,
const MLPowerManagerPowerStateInfo * in_info,
MLPowerManagerPowerStateData * out_states
)

Query available power states for a component.

Parameters

MLHandlehandlePower Manager handle for component to get list of all available power states for.
const MLPowerManagerPowerStateInfo *in_infoMLPowerManagerPowerStateInfo struct filled with data to be used by the Power Manager when requesting/receiving all available power states.
MLPowerManagerPowerStateData *out_statesMLPowerManagerPowerStateData holding list of available power states. Must be released using MLPowerManagerReleasePowerStateData after each successful call.

Returns

MLResultMLResult_AllocFailedFailed due to memory allocation failure.
MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkQuery completed and out_states has been populated.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

API Level:

  • 27

MLPowerManagerGetPowerState

MLResult MLPowerManagerGetPowerState(
MLHandle handle,
const MLPowerManagerPowerStateInfo * in_info,
MLPowerManagerPowerStateData * out_state
)

Gets the power state of a component.

Parameters

MLHandlehandlePower Manager handle for component to get power state from.
const MLPowerManagerPowerStateInfo *in_infoMLPowerManagerPowerStateInfo struct filled with data to be used by the Power Manager when requesting/receiving power state.
MLPowerManagerPowerStateData *power_stateMLPowerManagerPowerStateData with the current power state. Must be released using MLPowerManagerReleasePowerStateData after each successful call.

Returns

MLResultMLPowerManagerResult_NotConnectedThe component is not connected.
MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkThe power state of the controller was retrieved successfully.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

API Level:

  • 27

MLPowerManagerReleasePowerStateData

MLResult MLPowerManagerReleasePowerStateData(
MLHandle handle,
MLPowerManagerPowerStateData * power_states
)

Releases specified MLPowerManagerPowerStateData.

Parameters

MLHandlehandlePower Manager handle for component relating to MLPowerManagerPowerStateData.
MLPowerManagerPowerStateData *power_statesPointer to a MLPowerManagerPowerStateData.

Returns

MLResultMLResult_OkSuccessfully released MLPowerManagerPowerStateData.
MLResultMLResult_InvalidParampower_states parameter was not valid (NULL).
MLResultMLResult_UnspecifiedFailureFailed due to internal error.

Required Permissions:

  • None

This function should be called exactly once for each successful call to MLPowerManagerGetAvailablePowerStates.


MLPowerManagerGetAvailableProperties

MLResult MLPowerManagerGetAvailableProperties(
MLHandle handle,
const MLPowerManagerPropertyTypeInfo * in_info,
MLPowerManagerPropertyTypeData * out_properties
)

Request a list of the available MLPowerManagerPropertyType.

Parameters

MLHandlehandlePower Manager handle for component to get properties from.
const MLPowerManagerPropertyTypeInfo *in_infoMLPowerManagerPropertyTypeInfo struct filled with data to be used by the Power Manager when requesting/receiving available property types.
MLPowerManagerPropertyTypeData *out_propertiesInformation about the properties of a component. Must be released using MLPowerManagerReleasePropertyTypeData after each successful call.

Returns

MLResultMLResult_AllocFailedFailed due to memory allocation failure.
MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkQuery completed and out_properties has been populated.
MLResultMLResult_UnspecifiedFailureThe operation failed with an unspecified error.

Required Permissions:

  • None

API Level:

  • 27

MLPowerManagerReleasePropertyTypeData

MLResult MLPowerManagerReleasePropertyTypeData(
MLHandle handle,
MLPowerManagerPropertyTypeData * properties
)

Releases specified MLPowerManagerPropertyTypeData.

Parameters

MLHandlehandlePower Manager handle for component relating to MLPowerManagerPropertyTypeData.
MLPowerManagerPropertyTypeData *propertiesPointer to a MLPowerManagerPropertyTypeData.

Returns

MLResultMLResult_OkSuccessfully MLPowerManagerPropertyTypeData.
MLResultMLResult_InvalidParamproperties parameter was not valid (NULL).
MLResultMLResult_UnspecifiedFailureFailed due to internal error.

Required Permissions:

  • None

This function should be called exactly once for each successful call to MLPowerManagerGetAvailableProperties.


MLPowerManagerGetResultString

const char * MLPowerManagerGetResultString(
MLResult result_code
)

Returns an ASCII string for each result code.

Parameters

MLResultresult_codeMLResult to select the result code.

Returns

const char *ASCIIstring containing readable version of result code.

Required Permissions:

  • None

API Level:

  • 27