Class Power

    Definition

    Namespace:
    Tizen.System
    Assembly:
    Tizen.System.dll

    The Power class provides methods to control the power service.

    public static class Power
    Inheritance
    object
    Power
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Methods

    View Source

    CancelWaitCallback(UInt64)

    Notify the deviced that it needs undoing the current transition.

    Declaration
    public static void CancelWaitCallback(UInt64 wait_callback_id)
    Parameters
    Type Name Description
    UInt64 wait_callback_id

    Wait callback id to cancel.

    Remarks

    Notify the deviced that the current transition should be rewinded. This function only works on the id received from device_power_state_wait_callback() and device_power_transient_state_wait_callback(). Above functions are mapped to (PowerState)StateWaitCallback/(PowerTransientState)StateWaitCallback Event handler.

    Examples
    public static void MyPowerCallback(object sender, PowerStateWaitEventArgs args)
    {
        Do something with args...
        Power.CancelWaitCallback(args.WaitCallbackId);
    }
    View Source

    ChangeState(PowerState, int)

    Send request for changing power state asynchronously.

    Declaration
    public static void ChangeState(PowerState state, int timeout_sec)
    Parameters
    Type Name Description
    PowerState state

    Target state.

    int timeout_sec

    Timeout for the async reply in second, maximum of 10 seconds. If you put 0, then it will be set 10 sec automatically.

    Remarks

    If it is need to get result callback event, then follow below description. However, if it is not necessary, skip add callback event. After change state request, callback event is called only once per change request.

    1. Add callback event to power state request callback that you want to change.
    2. This callback event will be invoked later by timeout or success/failure.
    3. After callback event is called, it is better to clean up that subscribed callback events.
    Examples
    public static void PowerStateChangedCallback(Object sender, PowerStateChangeRequestEventArgs args)
    {
        args.Retval // If this value is negative, this means that the request failed.
        Do something with args...
    }
    Power.SleepStateChangeRequestCallback += PowerStateChangedCallback;
    Power.ChangeState(PowerState.Sleep, 5);
    
    or just use like below
    Power.ChangeState(PowerState.Normal, 10);
    View Source

    CheckRebootAllowed()

    Check if reboot is possible on the current device state.

    Declaration
    public static int CheckRebootAllowed()
    Returns
    Type Description
    int
    Remarks

    The return value will be 0(not possible) or 1(possible).

    Examples
    int retval = 0;
    retval = Power.CheckRebootAllowed();
    View Source

    ConfirmWaitCallback(UInt64)

    Notify the deviced that it is ready for the actual action.

    Declaration
    public static void ConfirmWaitCallback(UInt64 wait_callback_id)
    Parameters
    Type Name Description
    UInt64 wait_callback_id

    Wait callback id to confirm.

    Remarks

    Notify the deviced that it is ok to take an actual action of change state. This function only works on the id received from device_power_state_wait_callback() and device_power_transient_state_wait_callback(). Above functions are mapped to (PowerState)StateWaitCallback/(PowerTransientState)StateWaitCallback Event handler.

    Examples
    public static void MyPowerCallback(object sender, PowerStateWaitEventArgs args)
    {
        Do Something...
        Power.ConfirmWaitCallback(args.WaitCallbackId);
    }
    View Source

    GetLockState(PowerLock)

    Gets the status of power lock.

    Declaration
    public static PowerLockState GetLockState(PowerLock type)
    Parameters
    Type Name Description
    PowerLock type

    Type of power lock.

    Returns
    Type Description
    PowerLockState
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    PowerLockState lock_state = Power.GetLockState(PowerLock.Cpu);
    View Source

    GetWakeupReason()

    Get wakeup reason.

    Declaration
    public static PowerTransitionReason GetWakeupReason()
    Returns
    Type Description
    PowerTransitionReason
    Remarks

    This api is not supported at TV profile.

    Examples
    PowerTransitionReason transition_reason = Power.GetWakeupReason();
    View Source

    PowerOff()

    Power off the device.

    Declaration
    public static void PowerOff()
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    Tizen.System.Power.PowerOff();
    View Source

    Reboot(string)

    Reboot the device.

    Declaration
    public static void Reboot(string reason)
    Parameters
    Type Name Description
    string reason
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    Tizen.System.Power.Reboot(null);
    View Source

    ReleaseCpuLock()

    [Obsolete("Please do not use! this will be deprecated")]

    Declaration
    public static void ReleaseCpuLock()
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    View Source

    ReleaseLock(PowerLock)

    Releases the lock state.

    Declaration
    public static void ReleaseLock(PowerLock type)
    Parameters
    Type Name Description
    PowerLock type

    The power type to request lock.

    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    Tizen.System.Power.ReleaseLock(Tizen.System.Power.PowerLock.Cpu);
    View Source

    RequestCpuLock(int)

    [Obsolete("Please do not use! this will be deprecated")]

    Declaration
    public static void RequestCpuLock(int timeout)
    Parameters
    Type Name Description
    int timeout

    The positive number in milliseconds or 0 for the permanent lock. So you must release the permanent lock of the power state with ReleaseCpuLock() if timeout_ms is zero.

    Remarks

    If the process dies, then every lock will be removed.

    View Source

    RequestLock(PowerLock, int)

    Locks the given lock state for a specified time. After the given timeout (in milliseconds), unlock the given lock state automatically.

    Declaration
    public static void RequestLock(PowerLock type, int timeout)
    Parameters
    Type Name Description
    PowerLock type

    The power type to request lock.

    int timeout

    The positive number in milliseconds or 0 for the permanent lock. So you must release the permanent lock of the power state with ReleaseLock() if timeout_ms is zero.

    Remarks

    If the process dies, then every lock will be removed.

    Examples
    Tizen.System.Power.RequestLock(Tizen.System.Power.PowerLock.Cpu, 2000);

    Events

    View Source

    CpuLockStateChangedCallback

    CpuLockStateChangedCallback is triggered when the PowerLock.Cpu status is changed to Lock or Unlock

    Declaration
    public static event EventHandler<PowerLockStateChangedEventArgs> CpuLockStateChangedCallback
    Event Type
    Type Description
    EventHandler<><PowerLockStateChangedEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerLockStateChangeCallback(object sender, PowerLockStateChangedEventArgs args)
    {
        PowerLock lock_type = args.PowerLockType;
        PowerLockState lock_state = args.PowerLockState;
    }
    Power.CpuLockStateChangedCallback += PowerLockStateChangeCallback;
    View Source

    DisplayDimLockStateChangedCallback

    DisplayDimLockStateChangedCallback is triggered when the PowerLock.DisplayDim status is changed to Lock or Unlock

    Declaration
    public static event EventHandler<PowerLockStateChangedEventArgs> DisplayDimLockStateChangedCallback
    Event Type
    Type Description
    EventHandler<><PowerLockStateChangedEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerLockStateChangeCallback(object sender, PowerLockStateChangedEventArgs args)
    {
        PowerLock lock_type = args.PowerLockType;
        PowerLockState lock_state = args.PowerLockState;
    }
    Power.DisplayDimLockStateChangedCallback += PowerLockStateChangeCallback;
    View Source

    DisplayNormalLockStateChangedCallback

    DisplayNormalLockStateChangedCallback is triggered when the PowerLock.DisplayNormal status is changed to Lock or Unlock

    Declaration
    public static event EventHandler<PowerLockStateChangedEventArgs> DisplayNormalLockStateChangedCallback
    Event Type
    Type Description
    EventHandler<><PowerLockStateChangedEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerLockStateChangeCallback(object sender, PowerLockStateChangedEventArgs args)
    {
        PowerLock lock_type = args.PowerLockType;
        PowerLockState lock_state = args.PowerLockState;
    }
    Power.DisplayNormalLockStateChangedCallback += PowerLockStateChangeCallback;
    View Source

    ExitStateChangeRequestCallback

    ExitStateChangeRequestCallback is triggered when the request to change to Exit power state is handled from deviced.

    Declaration
    public static event EventHandler<PowerStateChangeRequestEventArgs> ExitStateChangeRequestCallback
    Event Type
    Type Description
    EventHandler<><PowerStateChangeRequestEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateChangeRequestCallback(object sender, PowerStateChangeRequestEventArgs args)
    {
        PowerState power_state = args.PowerState;
        int retval = args.Retval;
    }
    Power.ExitStateChangeRequestCallback += PowerStateChangeRequestCallback;
    View Source

    ExitStateWaitCallback

    ExitStateWaitCallback is triggered when the Power state changes to Exit.

    Declaration
    public static event EventHandler<PowerStateWaitEventArgs> ExitStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateWaitCallback(object sender, PowerStateWaitEventArgs args)
    {
        PowerState prev_state = args.PrevState;
        PowerState next_state = args.NextState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.ExitStateWaitCallback += PowerStateWaitCallback;
    View Source

    NormalStateChangeRequestCallback

    NormalStateChangeRequestCallback is triggered when the request to change to Normal power state is handled from deviced.

    Declaration
    public static event EventHandler<PowerStateChangeRequestEventArgs> NormalStateChangeRequestCallback
    Event Type
    Type Description
    EventHandler<><PowerStateChangeRequestEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateChangeRequestCallback(object sender, PowerStateChangeRequestEventArgs args)
    {
        PowerState power_state = args.PowerState;
        int retval = args.Retval;
    }
    Power.NormalStateChangeRequestCallback += PowerStateChangeRequestCallback;
    View Source

    NormalStateWaitCallback

    NormalStateWaitCallback is triggered when the Power state changes to Normal.

    Declaration
    public static event EventHandler<PowerStateWaitEventArgs> NormalStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateWaitCallback(object sender, PowerStateWaitEventArgs args)
    {
        PowerState prev_state = args.PrevState;
        PowerState next_state = args.NextState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.NormalStateWaitCallback += PowerStateWaitCallback;
    View Source

    PoweroffStateChangeRequestCallback

    PoweroffStateChangeRequestCallback is triggered when the request to change to Poweroff power state is handled from deviced.

    Declaration
    public static event EventHandler<PowerStateChangeRequestEventArgs> PoweroffStateChangeRequestCallback
    Event Type
    Type Description
    EventHandler<><PowerStateChangeRequestEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateChangeRequestCallback(object sender, PowerStateChangeRequestEventArgs args)
    {
        PowerState power_state = args.PowerState;
        int retval = args.Retval;
    }
    Power.PoweroffStateChangeRequestCallback += PowerStateChangeRequestCallback;
    View Source

    PoweroffStateWaitCallback

    PoweroffStateWaitCallback is triggered when the Power state changes to Poweroff.

    Declaration
    public static event EventHandler<PowerStateWaitEventArgs> PoweroffStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateWaitCallback(object sender, PowerStateWaitEventArgs args)
    {
        PowerState prev_state = args.PrevState;
        PowerState next_state = args.NextState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.PoweroffStateWaitCallback += PowerStateWaitCallback;
    View Source

    RebootStateChangeRequestCallback

    RebootStateChangeRequestCallback is triggered when the request to change to Reboot power state is handled from deviced.

    Declaration
    public static event EventHandler<PowerStateChangeRequestEventArgs> RebootStateChangeRequestCallback
    Event Type
    Type Description
    EventHandler<><PowerStateChangeRequestEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateChangeRequestCallback(object sender, PowerStateChangeRequestEventArgs args)
    {
        PowerState power_state = args.PowerState;
        int retval = args.Retval;
    }
    Power.RebootStateChangeRequestCallback += PowerStateChangeRequestCallback;
    View Source

    RebootStateWaitCallback

    RebootStateWaitCallback is triggered when the Power state changes to Reboot.

    Declaration
    public static event EventHandler<PowerStateWaitEventArgs> RebootStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateWaitCallback(object sender, PowerStateWaitEventArgs args)
    {
        PowerState prev_state = args.PrevState;
        PowerState next_state = args.NextState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.RebootStateWaitCallback += PowerStateWaitCallback;
    View Source

    SleepStateChangeRequestCallback

    SleepStateChangeRequestCallback is triggered when the request to change to Sleep power state is handled from deviced.

    Declaration
    public static event EventHandler<PowerStateChangeRequestEventArgs> SleepStateChangeRequestCallback
    Event Type
    Type Description
    EventHandler<><PowerStateChangeRequestEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateChangeRequestCallback(object sender, PowerStateChangeRequestEventArgs args)
    {
        PowerState power_state = args.PowerState;
        int retval = args.Retval;
    }
    Power.SleepStateChangeRequestCallback += PowerStateChangeRequestCallback;
    View Source

    SleepStateWaitCallback

    SleepStateWaitCallback is triggered when the Power state changes to Sleep.

    Declaration
    public static event EventHandler<PowerStateWaitEventArgs> SleepStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateWaitCallback(object sender, PowerStateWaitEventArgs args)
    {
        PowerState prev_state = args.PrevState;
        PowerState next_state = args.NextState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.SleepStateWaitCallback += PowerStateWaitCallback;
    View Source

    StartStateChangeRequestCallback

    StartStateChangeRequestCallback is triggered when the request to change to Start power state is handled from deviced.

    Declaration
    public static event EventHandler<PowerStateChangeRequestEventArgs> StartStateChangeRequestCallback
    Event Type
    Type Description
    EventHandler<><PowerStateChangeRequestEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateChangeRequestCallback(object sender, PowerStateChangeRequestEventArgs args)
    {
        PowerState power_state = args.PowerState;
        int retval = args.Retval;
    }
    Power.StartStateChangeRequestCallback += PowerStateChangeRequestCallback;
    View Source

    StartStateWaitCallback

    StartStateWaitCallback is triggered when the Power state changes to Start.

    Declaration
    public static event EventHandler<PowerStateWaitEventArgs> StartStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerStateWaitCallback(object sender, PowerStateWaitEventArgs args)
    {
        PowerState prev_state = args.PrevState;
        PowerState next_state = args.NextState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.StartStateWaitCallback += PowerStateWaitCallback;
    View Source

    TransientResumingEarlyStateWaitCallback

    TransientResumingEarlyStateWaitCallback is triggered when the Power transient state changes to ResumingEarly.

    Declaration
    public static event EventHandler<PowerTransientStateWaitEventArgs> TransientResumingEarlyStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerTransientStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerTransientStateWaitCallback(object sender, PowerTransientStateWaitEventArgs args)
    {
        PowerTransientState transient_state = args.TransientState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.TransientResumingEarlyStateWaitCallback += PowerTransientStateWaitCallback;
    View Source

    TransientResumingLateStateWaitCallback

    TransientResumingLateStateWaitCallback is triggered when the Power transient state changes to ResumingLate.

    Declaration
    public static event EventHandler<PowerTransientStateWaitEventArgs> TransientResumingLateStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerTransientStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerTransientStateWaitCallback(object sender, PowerTransientStateWaitEventArgs args)
    {
        PowerTransientState transient_state = args.TransientState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.TransientResumingLateStateWaitCallback += PowerTransientStateWaitCallback;
    View Source

    TransientResumingStateWaitCallback

    TransientResumingStateWaitCallback is triggered when the Power transient state changes to Resuming.

    Declaration
    public static event EventHandler<PowerTransientStateWaitEventArgs> TransientResumingStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerTransientStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerTransientStateWaitCallback(object sender, PowerTransientStateWaitEventArgs args)
    {
        PowerTransientState transient_state = args.TransientState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.TransientResumingStateWaitCallback += PowerTransientStateWaitCallback;
    View Source

    TransientSuspendingEarlyStateWaitCallback

    TransientSuspendingEarlyStateWaitCallback is triggered when the Power transient state changes to SuspendingEarly.

    Declaration
    public static event EventHandler<PowerTransientStateWaitEventArgs> TransientSuspendingEarlyStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerTransientStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerTransientStateWaitCallback(object sender, PowerTransientStateWaitEventArgs args)
    {
        PowerTransientState transient_state = args.TransientState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.TransientSuspendingEarlyStateWaitCallback += PowerTransientStateWaitCallback;
    View Source

    TransientSuspendingLateStateWaitCallback

    TransientSuspendingLateStateWaitCallback is triggered when the Power transient state changes to SuspendingLate.

    Declaration
    public static event EventHandler<PowerTransientStateWaitEventArgs> TransientSuspendingLateStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerTransientStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerTransientStateWaitCallback(object sender, PowerTransientStateWaitEventArgs args)
    {
        PowerTransientState transient_state = args.TransientState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.TransientSuspendingLateStateWaitCallback += PowerTransientStateWaitCallback;
    View Source

    TransientSuspendingStateWaitCallback

    TransientSuspendingStateWaitCallback is triggered when the Power transient state changes to Suspending.

    Declaration
    public static event EventHandler<PowerTransientStateWaitEventArgs> TransientSuspendingStateWaitCallback
    Event Type
    Type Description
    EventHandler<><PowerTransientStateWaitEventArgs>
    Remarks

    The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.

    Examples
    public static void PowerTransientStateWaitCallback(object sender, PowerTransientStateWaitEventArgs args)
    {
        PowerTransientState transient_state = args.TransientState;
        ulong wait_callback_id = args.WaitCallbackId;
        PowerTransitionReason transition_reason = args.TransitionReason;
    }
    Power.TransientSuspendingStateWaitCallback += PowerTransientStateWaitCallback;
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX