// %BANNER_BEGIN% // --------------------------------------------------------------------- // %COPYRIGHT_BEGIN% // Copyright (c) 2023 Magic Leap, Inc. All Rights Reserved. // Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2 // Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein. // %COPYRIGHT_END% // --------------------------------------------------------------------- // %BANNER_END% namespace UnityEngine.XR.MagicLeap { public partial class MLPowerManager : MLAutoAPISingleton { /// /// Start the API. /// protected override MLResult.Code StartAPI() => Instance.InternalCreateManager(); /// /// Stop the API. /// protected override MLResult.Code StopAPI() => Instance.InternalDestroyManager(); /// /// Sets the power state of a component. /// /// Settings used by the Power Manager updating a component's power state. /// /// public static MLResult.Code SetPowerState(Settings settings) => Instance.InternalSetPowerState(settings); /// /// Get controller component properties. /// Information about the properties of a component. /// public static MLResult.Code GetComponentProperties(out PropertyData out_properties) => Instance.InternalGetComponentProperties(out out_properties); /// /// Get available power states for a component. /// /// #PowerStateData holding list of available power states. /// /// public static MLResult.Code GetAvailablePowerStates(out PowerStateData data) => Instance.InternalGetAvailablePowerStates(out data); /// /// Get the current power state for a component. /// /// #PowerStateData with the current power state of the component. /// /// public static MLResult.Code GetPowerState(out PowerStateData data) => Instance.InternalGetPowerState(out data); /// /// Request a list of the available #PropertyType. /// /// Information about the properties of a component. /// /// public static MLResult.Code GetAvailableProperties(out PropertyTypeData data) => Instance.InternalGetAvailableProperties(out data); #region Delegates private static event OnErrorOccurredDelegate OnErrorOccurredEvent = delegate { }; /// /// This callback will be invoked when an #MLPowerManagerError occurs on one of the components. /// /// The error which has occurred. public delegate void OnErrorOccurredDelegate(in Error error); private static event OnPowerStateChangedDelegate OnPowerStateChangedEvent = delegate { }; /// /// This callback will be invoked when #MLPowerManagerPowerState changes. /// /// #MLPowerManagerPowerState representing the new power state. public delegate void OnPowerStateChangedDelegate(in PowerState state); private static event OnPropertiesChangedDelegate OnPropertiesChangedEvent = delegate { }; /// /// 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. /// /// #MLPowerManagerPropertyData struct encapsulating the properties changed. public delegate void OnPropertiesChangedDelegate(in PropertyData properties); /// /// Event callback fired when an error occurs. /// public static event OnErrorOccurredDelegate OnErrorOccurred { add { OnErrorOccurredEvent += value; } remove { OnErrorOccurredEvent -= value; } } /// /// Event callback fired when a power state change occurs. /// public static event OnPowerStateChangedDelegate OnPowerStateChanged { add { OnPowerStateChangedEvent += value; } remove { OnPowerStateChangedEvent -= value; } } /// /// Event callback fired when a property change occurs. /// public static event OnPropertiesChangedDelegate OnPropertiesChanged { add { OnPropertiesChangedEvent += value; } remove { OnPropertiesChangedEvent -= value; } } #endregion } }