2 * Copyright (c) 2017 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;
19 using Tizen.Applications;
20 using Tizen.Applications.Notifications;
22 internal static partial class Interop
24 internal static class Notification
26 internal delegate void ResponseEventCallback(IntPtr ptr, int type, IntPtr userData);
28 [DllImport(Libraries.Notification, EntryPoint = "notification_create")]
29 internal static extern IntPtr Create(NotificationType type);
31 [DllImport(Libraries.Notification, EntryPoint = "notification_free")]
32 internal static extern NotificationError Destroy(IntPtr handle);
34 [DllImport(Libraries.Notification, EntryPoint = "notification_get_text")]
35 internal static extern NotificationError GetTextReferenceType(NotificationSafeHandle handle, NotificationText type, out IntPtr text);
37 [DllImport(Libraries.Notification, EntryPoint = "notification_set_text")]
38 internal static extern NotificationError SetText(NotificationSafeHandle handle, NotificationText type, string text, string key, int args);
40 [DllImport(Libraries.Notification, EntryPoint = "notification_get_image")]
41 internal static extern NotificationError GetImageReferenceType(NotificationSafeHandle handle, NotificationImage type, out IntPtr path);
43 [DllImport(Libraries.Notification, EntryPoint = "notification_set_image")]
44 internal static extern NotificationError SetImage(NotificationSafeHandle handle, NotificationImage type, string path);
46 [DllImport(Libraries.Notification, EntryPoint = "notification_get_time")]
47 internal static extern NotificationError GetTime(NotificationSafeHandle handle, out int time);
49 [DllImport(Libraries.Notification, EntryPoint = "notification_set_time")]
50 internal static extern NotificationError SetTime(NotificationSafeHandle handle, int time);
52 [DllImport(Libraries.Notification, EntryPoint = "notification_get_insert_time")]
53 internal static extern NotificationError GetInsertTime(NotificationSafeHandle handle, out long time);
55 [DllImport(Libraries.Notification, EntryPoint = "notification_get_sound")]
56 internal static extern NotificationError GetSoundReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
58 [DllImport(Libraries.Notification, EntryPoint = "notification_set_sound")]
59 internal static extern NotificationError SetSound(NotificationSafeHandle handle, AccessoryOption type, string path);
61 [DllImport(Libraries.Notification, EntryPoint = "notification_get_vibration")]
62 internal static extern NotificationError GetVibrationReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
64 [DllImport(Libraries.Notification, EntryPoint = "notification_set_vibration")]
65 internal static extern NotificationError SetVibration(NotificationSafeHandle handle, AccessoryOption type, string path);
67 [DllImport(Libraries.Notification, EntryPoint = "notification_get_led")]
68 internal static extern NotificationError GetLed(NotificationSafeHandle handle, out AccessoryOption type, out int color);
70 [DllImport(Libraries.Notification, EntryPoint = "notification_set_led")]
71 internal static extern NotificationError SetLed(NotificationSafeHandle handle, AccessoryOption type, int color);
73 [DllImport(Libraries.Notification, EntryPoint = "notification_get_led_time_period")]
74 internal static extern NotificationError GetLedTimePeriod(NotificationSafeHandle handle, out int onMillisecond, out int offMillisecond);
76 [DllImport(Libraries.Notification, EntryPoint = "notification_set_led_time_period")]
77 internal static extern NotificationError SetLedTimePeriod(NotificationSafeHandle handle, int onMillisecond, int offMillisecond);
79 [DllImport(Libraries.Notification, EntryPoint = "notification_get_launch_option")]
80 internal static extern NotificationError GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle apphandle);
82 [DllImport(Libraries.Notification, EntryPoint = "notification_set_launch_option")]
83 internal static extern NotificationError SetAppControl(NotificationSafeHandle handle, LaunchOption type, SafeAppControlHandle appHandle);
85 [DllImport(Libraries.Notification, EntryPoint = "notification_get_event_handler")]
86 internal static extern NotificationError GetEventHandler(NotificationSafeHandle handle, int type, out SafeAppControlHandle appHandle);
88 [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
89 internal static extern NotificationError SetEventHandler(NotificationSafeHandle handle, int type, SafeAppControlHandle appHandle);
91 [DllImport(Libraries.Notification, EntryPoint = "notification_get_property")]
92 internal static extern NotificationError GetProperties(NotificationSafeHandle handle, out int flags);
94 [DllImport(Libraries.Notification, EntryPoint = "notification_set_property")]
95 internal static extern NotificationError SetProperties(NotificationSafeHandle handle, int flags);
97 [DllImport(Libraries.Notification, EntryPoint = "notification_get_display_applist")]
98 internal static extern NotificationError GetApplist(NotificationSafeHandle handle, out int flags);
100 [DllImport(Libraries.Notification, EntryPoint = "notification_set_display_applist")]
101 internal static extern NotificationError SetApplist(NotificationSafeHandle handle, int flags);
103 [DllImport(Libraries.Notification, EntryPoint = "notification_get_size")]
104 internal static extern NotificationError GetProgressSize(NotificationSafeHandle handle, out double size);
106 [DllImport(Libraries.Notification, EntryPoint = "notification_set_size")]
107 internal static extern NotificationError SetProgressSize(NotificationSafeHandle handle, double size);
109 [DllImport(Libraries.Notification, EntryPoint = "notification_get_progress")]
110 internal static extern NotificationError GetProgress(NotificationSafeHandle handle, out double progress);
112 [DllImport(Libraries.Notification, EntryPoint = "notification_set_progress")]
113 internal static extern NotificationError SetProgress(NotificationSafeHandle handle, double progress);
115 [DllImport(Libraries.Notification, EntryPoint = "notification_get_layout")]
116 internal static extern NotificationError GetLayout(NotificationSafeHandle handle, out NotificationLayout layout);
118 [DllImport(Libraries.Notification, EntryPoint = "notification_set_layout")]
119 internal static extern NotificationError SetLayout(NotificationSafeHandle handle, NotificationLayout layout);
121 [DllImport(Libraries.Notification, EntryPoint = "notification_get_type")]
122 internal static extern NotificationError GetType(NotificationSafeHandle handle, out NotificationType type);
124 [DllImport(Libraries.Notification, EntryPoint = "notification_update")]
125 internal static extern NotificationError Update(NotificationSafeHandle handle);
127 [DllImport(Libraries.Notification, EntryPoint = "notification_delete")]
128 internal static extern NotificationError Delete(NotificationSafeHandle handle);
130 [DllImport(Libraries.Notification, EntryPoint = "notification_delete_all")]
131 internal static extern NotificationError DeleteAll(int type);
133 [DllImport(Libraries.Notification, EntryPoint = "notification_post")]
134 internal static extern NotificationError Post(NotificationSafeHandle handle);
136 [DllImport(Libraries.Notification, EntryPoint = "notification_post_with_event_cb")]
137 internal static extern NotificationError PostWithEventCallback(NotificationSafeHandle handle, ResponseEventCallback cb, IntPtr userdata);
139 [DllImport(Libraries.Notification, EntryPoint = "notification_get_pkgname")]
140 internal static extern NotificationError GetPackageName(NotificationSafeHandle handle, out IntPtr name);
142 [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
143 internal static extern NotificationError AddButtonAction(NotificationSafeHandle handle, ButtonIndex type, SafeAppControlHandle appcontrol);
145 [DllImport(Libraries.Notification, EntryPoint = "notification_remove_button")]
146 internal static extern NotificationError RemoveButton(NotificationSafeHandle handle, ButtonIndex index);
148 [DllImport(Libraries.Notification, EntryPoint = "notification_set_tag")]
149 internal static extern NotificationError SetTag(NotificationSafeHandle handle, string tag);
151 [DllImport(Libraries.Notification, EntryPoint = "notification_get_tag")]
152 internal static extern NotificationError GetTagReferenceType(NotificationSafeHandle handle, out IntPtr tag);
154 [DllImport(Libraries.Notification, EntryPoint = "notification_load_by_tag")]
155 internal static extern IntPtr Load(string text);
157 [DllImport(Libraries.Notification, EntryPoint = "notification_get_id")]
158 internal static extern NotificationError GetID(NotificationSafeHandle handle, out int groupID, out int privID);
160 [DllImport(Libraries.Notification, EntryPoint = "notification_set_priv_id")]
161 internal static extern NotificationError SetID(NotificationSafeHandle handle, int privID);
163 [DllImport(Libraries.Notification, EntryPoint = "notification_save_as_template")]
164 internal static extern NotificationError SaveTemplate(NotificationSafeHandle handle, string name);
166 [DllImport(Libraries.Notification, EntryPoint = "notification_create_from_template")]
167 internal static extern IntPtr LoadTemplate(string name);
169 [DllImport(Libraries.Notification, EntryPoint = "notification_get_noti_block_state")]
170 internal static extern NotificationError GetBlockState(out NotificationBlockState status);
172 [DllImport(Libraries.Notification, EntryPoint = "notification_set_auto_remove")]
173 internal static extern NotificationError SetAutoRemove(NotificationSafeHandle handle, bool autoRemove);
175 [DllImport(Libraries.Notification, EntryPoint = "notification_get_auto_remove")]
176 internal static extern NotificationError GetAutoRemove(NotificationSafeHandle handle, out bool autoRemove);
178 [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_value_type")]
179 internal static extern NotificationError SetProgressType(NotificationSafeHandle handle, ProgressCategory category);
181 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_value_type")]
182 internal static extern NotificationError GetProgressType(NotificationSafeHandle handle, out ProgressCategory category);
184 [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_flag")]
185 internal static extern NotificationError SetOngoingFlag(NotificationSafeHandle handle, bool flag);
187 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
188 internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, bool flag);
190 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
191 internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, out bool flag);
193 [DllImport(Libraries.Notification, EntryPoint = "notification_set_text_input")]
194 internal static extern NotificationError SetPlaceHolderLength(NotificationSafeHandle handle, int length);
196 [DllImport(Libraries.Notification, EntryPoint = "notification_get_text_input_max_length")]
197 internal static extern NotificationError GetPlaceHolderLength(NotificationSafeHandle handle, out int length);
199 [DllImport(Libraries.Notification, EntryPoint = "notification_get_hide_timeout")]
200 internal static extern NotificationError GetHideTime(NotificationSafeHandle handle, out int timeout);
202 [DllImport(Libraries.Notification, EntryPoint = "notification_set_hide_timeout")]
203 internal static extern NotificationError SetHideTime(NotificationSafeHandle handle, int timeout);
205 [DllImport(Libraries.Notification, EntryPoint = "notification_get_delete_timeout")]
206 internal static extern NotificationError GetDeleteTime(NotificationSafeHandle handle, out int timeout);
208 [DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")]
209 internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout);
211 [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_data")]
212 internal static extern NotificationError SetExtensionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
214 [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_data")]
215 internal static extern NotificationError GetExtensionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
217 [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")]
218 internal static extern NotificationError GetExtensionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
220 [DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")]
221 internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index);
223 [DllImport(Libraries.Notification, EntryPoint = "notification_set_default_button")]
224 internal static extern NotificationError SetDefaultButton(NotificationSafeHandle handle, int index);
226 [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_event_handler")]
227 internal static extern NotificationError SetExtensionAction(NotificationSafeHandle handle, NotificationEventType type, SafeAppControlHandle appcontrol);
229 [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_event_handler")]
230 internal static extern NotificationError GetExtensionAction(NotificationSafeHandle handle, NotificationEventType type, out SafeAppControlHandle appcontrol);
232 [DllImport(Libraries.Notification, EntryPoint = "notification_clone")]
233 internal static extern NotificationError Clone(IntPtr handle, out IntPtr cloned);
235 [DllImport(Libraries.Notification, EntryPoint = "notification_set_check_box")]
236 internal static extern NotificationError SetCheckBox(NotificationSafeHandle handle, bool flag, bool checkedValue);
238 [DllImport(Libraries.Notification, EntryPoint = "notification_get_check_box")]
239 internal static extern NotificationError GetCheckBox(NotificationSafeHandle handle, out bool flag, out bool checkedValue);
241 internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text)
243 NotificationError ret;
245 ret = GetTextReferenceType(handle, type, out ptr);
247 if (ptr == IntPtr.Zero)
253 text = Marshal.PtrToStringAnsi(ptr);
259 internal static NotificationError GetImage(NotificationSafeHandle handle, NotificationImage type, out string path)
261 NotificationError ret;
263 ret = GetImageReferenceType(handle, type, out ptr);
265 if (ptr == IntPtr.Zero)
271 path = Marshal.PtrToStringAnsi(ptr);
277 internal static NotificationError GetSound(NotificationSafeHandle handle, out AccessoryOption type, out string path)
279 NotificationError ret;
281 ret = GetSoundReferenceType(handle, out type, out ptr);
283 if (ptr == IntPtr.Zero)
289 path = Marshal.PtrToStringAnsi(ptr);
295 internal static NotificationError GetVibration(NotificationSafeHandle handle, out AccessoryOption type, out string path)
297 NotificationError ret;
299 ret = GetVibrationReferenceType(handle, out type, out ptr);
301 if (ptr == IntPtr.Zero)
307 path = Marshal.PtrToStringAnsi(ptr);
313 internal static NotificationError GetTag(NotificationSafeHandle handle, out string tag)
315 NotificationError ret;
317 ret = GetTagReferenceType(handle, out ptr);
319 if (ptr == IntPtr.Zero)
325 tag = Marshal.PtrToStringAnsi(ptr);