*/
using System;
+using System.ComponentModel;
namespace Tizen.System
{
throw DeviceExceptionFactory.CreateException(res, "unable to release power lock.");
}
}
+ /// <summary>
+ /// Power off the device.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/reboot</privilege>
+ /// <privlevel>platform</privlevel>
+ /// <exception cref="UnauthorizedAccessException">If the privilege is not set.</exception>
+ /// <exception cref="InvalidOperationException">In case of any system error.</exception>
+ /// <example>
+ /// <code>
+ /// Tizen.System.Power.PowerOff();
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void PowerOff()
+ {
+ DeviceError res = (DeviceError)Interop.Device.DevicePowerPowerOff();
+ if (res != DeviceError.None)
+ {
+ throw DeviceExceptionFactory.CreateException(res, "unable to power off the device.");
+ }
+ }
+ /// <summary>
+ /// Reboot the device.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/reboot</privilege>
+ /// <privlevel>platform</privlevel>
+ /// <exception cref="UnauthorizedAccessException">If the privilege is not set.</exception>
+ /// <exception cref="InvalidOperationException">In case of any system error.</exception>
+ /// <example>
+ /// <code>
+ /// Tizen.System.Power.Reboot(null);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void Reboot(string reason)
+ {
+ DeviceError res = (DeviceError)Interop.Device.DevicePowerReboot(reason);
+ if (res != DeviceError.None)
+ {
+ throw DeviceExceptionFactory.CreateException(res, "unable to reboot the device.");
+ }
+ }
}
}
internal static extern int DevicePowerRequestLock(PowerLock type, int timeout_ms);
[DllImport(Libraries.Device, EntryPoint = "device_power_release_lock", CallingConvention = CallingConvention.Cdecl)]
internal static extern int DevicePowerReleaseLock(PowerLock type);
+ [DllImport(Libraries.Device, EntryPoint = "device_power_poweroff", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int DevicePowerPowerOff();
+ [DllImport(Libraries.Device, EntryPoint = "device_power_reboot", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int DevicePowerReboot(string reason);
//IR
[DllImport(Libraries.Device, EntryPoint = "device_ir_is_available", CallingConvention = CallingConvention.Cdecl)]