Skip to main content
Version: 12 Dec 2024

MLPowerManager

NameSpace: MagicLeap

Inherits from:
MLAutoAPISingleton< MLPowerManager >,
MLLazySingleton< T >

Public Fields

OnErrorOccurred

Event callback fired when an error occurs.


public static OnErrorOccurredDelegate OnErrorOccurred { get; set; }

TypeDescription
OnErrorOccurredDelegateThis callback will be invoked when an #MLPowerManagerError occurs on one of the components.

OnPowerStateChanged

Event callback fired when a power state change occurs.


public static OnPowerStateChangedDelegate OnPowerStateChanged { get; set; }

TypeDescription
OnPowerStateChangedDelegateThis callback will be invoked when #MLPowerManagerPowerState changes.

OnPropertiesChanged

Event callback fired when a property change occurs.


public static OnPropertiesChangedDelegate OnPropertiesChanged { get; set; }

TypeDescription
OnPropertiesChangedDelegateThis callback will be invoked when #MLPowerManagerPropertyData of a component changes. Only the properties that have changed will be returned, the component may support additional properties which values were not returned.

Public Methods

MLResult.Code GetAvailablePowerStates

Get available power states for a component. data#PowerStateData holding list of available power states.

public static MLResult.Code GetAvailablePowerStates(
out PowerStateData data
)

Parameters

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

MLResult.Code GetAvailableProperties

Request a list of the available PropertyType. dataInformation about the properties of a component.

public static MLResult.Code GetAvailableProperties(
out PropertyTypeData data
)

Parameters

TypeNameDescription
out PropertyTypeDatadataA structure to encapsulate output data when getting a component's available property types.

MLResult.Code GetComponentProperties

Get controller component properties. out_propertiesInformation about the properties of a component.

public static MLResult.Code GetComponentProperties(
out PropertyData out&#95;properties
)

Parameters

TypeNameDescription
out PropertyDataout_propertiesA structure to encapsulate output data when getting the current properties.

MLResult.Code GetPowerState

Get the current power state for a component. data#PowerStateData with the current power state of the component.

public static MLResult.Code GetPowerState(
out PowerStateData data
)

Parameters

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

delegate void OnErrorOccurredDelegate

This callback will be invoked when an #MLPowerManagerError occurs on one of the components.

public delegate void OnErrorOccurredDelegate(
in Error error
)

Parameters

TypeNameDescription
in ErrorerrorThe error which has occurred.

delegate void OnPowerStateChangedDelegate

This callback will be invoked when #MLPowerManagerPowerState changes.

public delegate void OnPowerStateChangedDelegate(
in PowerState state
)

Parameters

TypeNameDescription
in PowerStatestate#MLPowerManagerPowerState representing the new power state.

delegate void OnPropertiesChangedDelegate

This callback will be invoked when #MLPowerManagerPropertyData of a component changes. Only the properties that have changed will be returned, the component may support additional properties which values were not returned.

public delegate void OnPropertiesChangedDelegate(
in PropertyData properties
)

Parameters

TypeNameDescription
in PropertyDataproperties#MLPowerManagerPropertyData struct encapsulating the properties changed.

MLResult.Code SetPowerState

Sets the power state of a component. settingsSettings used by the Power Manager updating a component's power state.

public static MLResult.Code SetPowerState(
Settings settings
)

Parameters

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

Protected Methods

StartAPI

Start the API.

protected virtual override MLResult.Code StartAPI()

Reimplements: StartAPI


StopAPI

Stop the API.

protected virtual override MLResult.Code StopAPI()

Reimplements: StopAPI


Public Enums

BatteryInfo

Battery info/warning codes.

EnumeratorValueDescription
OKNo issues reported.
BatteryLowCharge the component soon.
BatteryCriticalCharge the component immediately.

ChargingState

Power Manager charging states.

EnumeratorValueDescription
NotChargingNot charging.
ChargingNormallyCharging normally.

Component

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

EnumeratorValueDescription
NoneInvalid or no component.
ControllerController.

ConnectionState

Connection state of the component.

EnumeratorValueDescription
ConnectedComponent is connected.
DisconnectedComponent is disconnected.

Error

Power Manager error codes.

EnumeratorValueDescription
InvalidSKUController component could not be connected due to Invalid SKU.

PowerState

Power states.

EnumeratorValueDescription
NoneInvalid or no power state.
NormalNormal mode, this is the default or active state of the component.
DisabledWhileChargingCharging only mode. When charging component it cannot be used.
StandbyStandby mode.
SleepSleep mode.

PropertyType

Power Manager property types.

EnumeratorValueDescription
BatteryInfoExtra info about battery, as represented by MLPowerManagerBatteryInfo.
BatteryLevelBattery level. Range is between 0 and 100.
ChargingStateCharging state.
ConnectionStateConnection state.