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; }
Type | Description |
---|---|
OnErrorOccurredDelegate | This 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; }
Type | Description |
---|---|
OnPowerStateChangedDelegate | This callback will be invoked when #MLPowerManagerPowerState changes. |
OnPropertiesChanged
Event callback fired when a property change occurs.
public static OnPropertiesChangedDelegate OnPropertiesChanged { get; set; }
Type | Description |
---|---|
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 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
Type | Name | Description |
---|---|---|
out PowerStateData | data | A 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
Type | Name | Description |
---|---|---|
out PropertyTypeData | data | A 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_properties
)
Parameters
Type | Name | Description |
---|---|---|
out PropertyData | out_properties | A 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
Type | Name | Description |
---|---|---|
out PowerStateData | data | A 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
Type | Name | Description |
---|---|---|
in Error | error | The error which has occurred. |
delegate void OnPowerStateChangedDelegate
This callback will be invoked when #MLPowerManagerPowerState changes.
public delegate void OnPowerStateChangedDelegate(
in PowerState state
)
Parameters
Type | Name | Description |
---|---|---|
in PowerState | state | #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
Type | Name | Description |
---|---|---|
in PropertyData | properties | #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
Type | Name | Description |
---|---|---|
Settings | settings | A 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.
Enumerator | Value | Description |
---|---|---|
OK | No issues reported. | |
BatteryLow | Charge the component soon. | |
BatteryCritical | Charge the component immediately. |
ChargingState
Power Manager charging states.
Enumerator | Value | Description |
---|---|---|
NotCharging | Not charging. | |
ChargingNormally | Charging normally. |
Component
Represents the different components which can be accessed/controlled using the Power Manager.
Enumerator | Value | Description |
---|---|---|
None | Invalid or no component. | |
Controller | Controller. |
ConnectionState
Connection state of the component.
Enumerator | Value | Description |
---|---|---|
Connected | Component is connected. | |
Disconnected | Component is disconnected. |
Error
Power Manager error codes.
Enumerator | Value | Description |
---|---|---|
InvalidSKU | Controller component could not be connected due to Invalid SKU. |
PowerState
Power states.
Enumerator | Value | Description |
---|---|---|
None | Invalid or no power state. | |
Normal | Normal mode, this is the default or active state of the component. | |
DisabledWhileCharging | Charging only mode. When charging component it cannot be used. | |
Standby | Standby mode. | |
Sleep | Sleep mode. |
PropertyType
Power Manager property types.
Enumerator | Value | Description |
---|---|---|
BatteryInfo | Extra info about battery, as represented by MLPowerManagerBatteryInfo. | |
BatteryLevel | Battery level. Range is between 0 and 100. | |
ChargingState | Charging state. | |
ConnectionState | Connection state. |