1 /// Copyright 2016 by Samsung Electronics, Inc.,
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
11 using System.Runtime.InteropServices;
13 namespace Tizen.System
15 internal enum EventType
25 internal static class Interop
27 internal static partial class Device
30 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_battery_get_percent", CallingConvention = CallingConvention.Cdecl)]
31 public static extern int DeviceBatteryGetPercent(out int percent);
32 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_battery_is_charging", CallingConvention = CallingConvention.Cdecl)]
33 public static extern int DeviceBatteryIsCharging(out bool charging);
34 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_battery_get_level_status", CallingConvention = CallingConvention.Cdecl)]
35 public static extern int DeviceBatteryGetLevelStatus(out int status);
38 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_display_get_numbers", CallingConvention = CallingConvention.Cdecl)]
39 public static extern int DeviceDisplayGetNumbers(out int device_number);
40 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_display_get_max_brightness", CallingConvention = CallingConvention.Cdecl)]
41 public static extern int DeviceDisplayGetMaxBrightness(int index, out int max_brightness);
42 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_display_get_brightness", CallingConvention = CallingConvention.Cdecl)]
43 public static extern int DeviceDisplayGetBrightness(int index, out int status);
44 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_display_set_brightness", CallingConvention = CallingConvention.Cdecl)]
45 public static extern int DeviceDisplaySetBrightness(int index, int brightness);
46 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_display_get_state", CallingConvention = CallingConvention.Cdecl)]
47 public static extern int DeviceDisplayGetState(out int state);
48 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_display_change_state", CallingConvention = CallingConvention.Cdecl)]
49 public static extern int DeviceDisplayChangeState(int state);
52 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_haptic_get_count", CallingConvention = CallingConvention.Cdecl)]
53 internal static extern int DeviceHapticGetCount(out int device_number);
54 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_haptic_open", CallingConvention = CallingConvention.Cdecl)]
55 internal static extern int DeviceHapticOpen(int index, out IntPtr handle);
56 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_haptic_close", CallingConvention = CallingConvention.Cdecl)]
57 internal static extern int DeviceHapticClose(IntPtr handle);
58 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_haptic_vibrate", CallingConvention = CallingConvention.Cdecl)]
59 internal static extern int DeviceHapticVibrate(IntPtr handle, int duration, int feedback, out IntPtr effect);
60 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_haptic_stop", CallingConvention = CallingConvention.Cdecl)]
61 internal static extern int DeviceHapticStop(IntPtr handle, IntPtr effect);
64 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_flash_get_max_brightness", CallingConvention = CallingConvention.Cdecl)]
65 internal static extern int DeviceFlashGetMaxBrightness(out int max_brightness);
66 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_flash_get_brightness", CallingConvention = CallingConvention.Cdecl)]
67 internal static extern int DeviceFlashGetBrightness(out int brightness);
68 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_flash_set_brightness", CallingConvention = CallingConvention.Cdecl)]
69 internal static extern int DeviceFlashSetBrightness(int brightness);
70 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_led_play_custom", CallingConvention = CallingConvention.Cdecl)]
71 internal static extern int DeviceLedPlayCustom(int on, int off, uint color, uint flags);
72 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_led_stop_custom", CallingConvention = CallingConvention.Cdecl)]
73 internal static extern int DeviceLedStopCustom();
76 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_power_request_lock", CallingConvention = CallingConvention.Cdecl)]
77 internal static extern int DevicePowerRequestLock(int type, int timeout_ms);
78 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_power_release_lock", CallingConvention = CallingConvention.Cdecl)]
79 internal static extern int DevicePowerReleaseLock(int type);
82 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
83 internal delegate bool deviceCallback(int type, IntPtr value, IntPtr data);
84 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_add_callback", CallingConvention = CallingConvention.Cdecl)]
85 internal static extern int DeviceAddCallback(Tizen.System.EventType type, deviceCallback cb, IntPtr data);
86 [DllImport("libcapi-system-device.so.0", EntryPoint = "device_remove_callback", CallingConvention = CallingConvention.Cdecl)]
87 internal static extern int DeviceRemoveCallback(Tizen.System.EventType type, deviceCallback cb);