2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
20 namespace Tizen.System
22 internal enum EventType
31 internal static partial class Interop
33 internal static partial class Device
36 [DllImport(Libraries.Device, EntryPoint = "device_battery_get_percent", CallingConvention = CallingConvention.Cdecl)]
37 public static extern int DeviceBatteryGetPercent(out int percent);
38 [DllImport(Libraries.Device, EntryPoint = "device_battery_is_charging", CallingConvention = CallingConvention.Cdecl)]
39 public static extern int DeviceBatteryIsCharging(out bool charging);
40 [DllImport(Libraries.Device, EntryPoint = "device_battery_get_level_status", CallingConvention = CallingConvention.Cdecl)]
41 public static extern int DeviceBatteryGetLevelStatus(out int status);
44 [DllImport(Libraries.Device, EntryPoint = "device_display_get_numbers", CallingConvention = CallingConvention.Cdecl)]
45 public static extern int DeviceDisplayGetNumbers(out int device_number);
46 [DllImport(Libraries.Device, EntryPoint = "device_display_get_max_brightness", CallingConvention = CallingConvention.Cdecl)]
47 public static extern int DeviceDisplayGetMaxBrightness(int index, out int max_brightness);
48 [DllImport(Libraries.Device, EntryPoint = "device_display_get_brightness", CallingConvention = CallingConvention.Cdecl)]
49 public static extern int DeviceDisplayGetBrightness(int index, out int status);
50 [DllImport(Libraries.Device, EntryPoint = "device_display_set_brightness", CallingConvention = CallingConvention.Cdecl)]
51 public static extern int DeviceDisplaySetBrightness(int index, int brightness);
52 [DllImport(Libraries.Device, EntryPoint = "device_display_get_state", CallingConvention = CallingConvention.Cdecl)]
53 public static extern int DeviceDisplayGetState(out int state);
54 [DllImport(Libraries.Device, EntryPoint = "device_display_change_state", CallingConvention = CallingConvention.Cdecl)]
55 public static extern int DeviceDisplayChangeState(int state);
58 [DllImport(Libraries.Device, EntryPoint = "device_haptic_get_count", CallingConvention = CallingConvention.Cdecl)]
59 internal static extern int DeviceHapticGetCount(out int device_number);
60 [DllImport(Libraries.Device, EntryPoint = "device_haptic_open", CallingConvention = CallingConvention.Cdecl)]
61 internal static extern int DeviceHapticOpen(int index, out IntPtr handle);
62 [DllImport(Libraries.Device, EntryPoint = "device_haptic_close", CallingConvention = CallingConvention.Cdecl)]
63 internal static extern int DeviceHapticClose(IntPtr handle);
64 [DllImport(Libraries.Device, EntryPoint = "device_haptic_vibrate", CallingConvention = CallingConvention.Cdecl)]
65 internal static extern int DeviceHapticVibrate(IntPtr handle, int duration, int feedback, out IntPtr effect);
66 [DllImport(Libraries.Device, EntryPoint = "device_haptic_stop", CallingConvention = CallingConvention.Cdecl)]
67 internal static extern int DeviceHapticStop(IntPtr handle, IntPtr effect);
70 [DllImport(Libraries.Device, EntryPoint = "device_flash_get_max_brightness", CallingConvention = CallingConvention.Cdecl)]
71 internal static extern int DeviceFlashGetMaxBrightness(out int max_brightness);
72 [DllImport(Libraries.Device, EntryPoint = "device_flash_get_brightness", CallingConvention = CallingConvention.Cdecl)]
73 internal static extern int DeviceFlashGetBrightness(out int brightness);
74 [DllImport(Libraries.Device, EntryPoint = "device_flash_set_brightness", CallingConvention = CallingConvention.Cdecl)]
75 internal static extern int DeviceFlashSetBrightness(int brightness);
76 [DllImport(Libraries.Device, EntryPoint = "device_led_play_custom", CallingConvention = CallingConvention.Cdecl)]
77 internal static extern int DeviceLedPlayCustom(int on, int off, uint color, uint flags);
78 [DllImport(Libraries.Device, EntryPoint = "device_led_stop_custom", CallingConvention = CallingConvention.Cdecl)]
79 internal static extern int DeviceLedStopCustom();
82 [DllImport(Libraries.Device, EntryPoint = "device_power_request_lock", CallingConvention = CallingConvention.Cdecl)]
83 internal static extern int DevicePowerRequestLock(int type, int timeout_ms);
84 [DllImport(Libraries.Device, EntryPoint = "device_power_release_lock", CallingConvention = CallingConvention.Cdecl)]
85 internal static extern int DevicePowerReleaseLock(int type);
88 [DllImport(Libraries.Device, EntryPoint = "device_ir_is_available", CallingConvention = CallingConvention.Cdecl)]
89 internal static extern int DeviceIRIsAvailable(out bool available);
90 [DllImport(Libraries.Device, EntryPoint = "device_ir_transmit", CallingConvention = CallingConvention.Cdecl)]
91 internal static extern int DeviceIRTransmit(int carrierFreequency, int[] pattern, int size);
94 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
95 internal delegate bool deviceCallback(int type, IntPtr value, IntPtr data);
96 [DllImport(Libraries.Device, EntryPoint = "device_add_callback", CallingConvention = CallingConvention.Cdecl)]
97 internal static extern int DeviceAddCallback(Tizen.System.EventType type, deviceCallback cb, IntPtr data);
98 [DllImport(Libraries.Device, EntryPoint = "device_remove_callback", CallingConvention = CallingConvention.Cdecl)]
99 internal static extern int DeviceRemoveCallback(Tizen.System.EventType type, deviceCallback cb);