Skip to main content
Version: 21 Aug 2024

NativeBindings

See ml_power_manager.h for additional comments.

Inherits from:
MagicLeapNativeBindings

Public Methods

void HandleOnErrorOccurred

public static void HandleOnErrorOccurred(
Error error,
in IntPtr user_data
)

Parameters

TypeNameDescription
ErrorerrorPower Manager error codes.
in IntPtruser_data

void HandleOnPowerChanged

public static void HandleOnPowerChanged(
PowerState state,
in IntPtr user_data
)

Parameters

TypeNameDescription
PowerStatestatePower states.
in IntPtruser_data

void HandleOnPropertiesChanged

public static void HandleOnPropertiesChanged(
in MLPowerManagerPropertyData properties,
in IntPtr user_data
)

Parameters

TypeNameDescription
in MLPowerManagerPropertyDatapropertiesA structure to encapsulate output data when getting the current properties.
in IntPtruser_data

MLResult.Code MLPowerManagerCreate

Creates a Power Manager handle for a specified component.

public static MLResult.Code MLPowerManagerCreate(
Component component,
out ulong handle
)

Parameters

TypeNameDescription
ComponentcomponentThe component specific to the handle to be created.
out ulonghandleThe handle to be created.

MLResult.Code MLPowerManagerDestroy

Destroys a Power Manager handle.

public static MLResult.Code MLPowerManagerDestroy(
ulong handle
)

Parameters

TypeNameDescription
ulonghandleThe Power Manager handle for a specific component to be destroyed.

MLResult.Code MLPowerManagerGetAvailablePowerStates

Query available power states for a component.

public static MLResult.Code MLPowerManagerGetAvailablePowerStates(
ulong handle,
in MLPowerManagerPowerStateInfo in_info,
out MLPowerManagerPowerStateData out_states
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component to get list of all available power states for.
in MLPowerManagerPowerStateInfoin_info#MLPowerManagerPowerStateInfo struct filled with data to be used by the Power Manager when requesting/receiving all available power states.
out MLPowerManagerPowerStateDataout_states#MLPowerManagerPowerStateData holding list of available power states.

MLResult.Code MLPowerManagerGetAvailableProperties

Request a list of the available #MLPowerManagerPropertyType.

public static MLResult.Code MLPowerManagerGetAvailableProperties(
ulong handle,
in MLPowerManagerPropertyTypeInfo in_info,
out MLPowerManagerPropertyTypeData out_properties
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component to get properties from.
in MLPowerManagerPropertyTypeInfoin_info#MLPowerManagerPropertyTypeInfo struct filled with data to be used by the Power Manager when requesting/receiving available property types.
out MLPowerManagerPropertyTypeDataout_propertiesInformation about the properties of a component. Must be released using #MLPowerManagerReleasePropertyTypeData after each successful call.

MLResult.Code MLPowerManagerGetComponentProperties

Gets the power manager properties of a component.

public static MLResult.Code MLPowerManagerGetComponentProperties(
ulong handle,
in MLPowerManagerPropertyInfo in_info,
out MLPowerManagerPropertyData out_properties
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component to get properties of.
in MLPowerManagerPropertyInfoin_info#MLPowerManagerPropertyInfo struct filled with information about the power manager properties of a component to request.
out MLPowerManagerPropertyDataout_propertiesInformation about the properties of a component. Must be released using #MLPowerManagerReleasePropertyData after each successful call.

MLResult.Code MLPowerManagerGetPowerState

Gets the power state of a component.

public static MLResult.Code MLPowerManagerGetPowerState(
ulong handle,
in MLPowerManagerPowerStateInfo in_info,
out MLPowerManagerPowerStateData out_state
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component to get power state from.
in MLPowerManagerPowerStateInfoin_info#MLPowerManagerPowerStateInfo struct filled with data to be used by the Power Manager when requesting/receiving power state.
out MLPowerManagerPowerStateDataout_state#MLPowerManagerPowerStateData with the current power state.Must be released using #MLPowerManagerReleasePowerStateData after each successful call.

MLResult.Code MLPowerManagerReleasePowerStateData

Releases specified #MLPowerManagerPowerStateData.

public static MLResult.Code MLPowerManagerReleasePowerStateData(
ulong handle,
in MLPowerManagerPowerStateData power_states
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component relating to #MLPowerManagerPowerStateData.
in MLPowerManagerPowerStateDatapower_statesPointer to a #MLPowerManagerPowerStateData.

MLResult.Code MLPowerManagerReleasePropertyData

Releases specified #MLPowerManagerPropertyData.

public static MLResult.Code MLPowerManagerReleasePropertyData(
ulong handle,
in MLPowerManagerPropertyData properties
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component relating to #MLPowerManagerPropertyData.
in MLPowerManagerPropertyDatapropertiesPointer to a #MLPowerManagerPropertyData returned from #MLPowerManagerGetComponentProperties.

MLResult.Code MLPowerManagerReleasePropertyTypeData

Releases specified #MLPowerManagerPropertyTypeData.

public static MLResult.Code MLPowerManagerReleasePropertyTypeData(
ulong handle,
in MLPowerManagerPropertyTypeData properties
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component relating to #MLPowerManagerPropertyTypeData.
in MLPowerManagerPropertyTypeDatapropertiesPointer to a #MLPowerManagerPropertyTypeData.

MLResult.Code MLPowerManagerSetCallbacks

Register Power Manager callbacks for a specific handle.

public static MLResult.Code MLPowerManagerSetCallbacks(
ulong handle,
in MLPowerManagerCallbacks callbacks,
in IntPtr user_data
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component to set #MLPowerManagerCallbacks for.
in MLPowerManagerCallbackscallbacksCallbacks to receive Power Manager events. Set this to NULL to unregister callbacks.
in IntPtruser_dataThe caller can pass in user context data that will be returned in the callback(can be NULL).

MLResult.Code MLPowerManagerSetPowerState

Sets the power state of a component.

public static MLResult.Code MLPowerManagerSetPowerState(
ulong handle,
in MLPowerManagerPowerStateSettings settings
)

Parameters

TypeNameDescription
ulonghandlePower Manager handle for component to set power state for.
in MLPowerManagerPowerStateSettingssettingsSettings used by the Power Manager updating a component's power state.