[NUI] Update webview TCs.
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Notification / Interop / Interop.Notification.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.Applications;
20 using Tizen.Applications.Notifications;
21
22 internal static partial class Interop
23 {
24     internal static class Notification
25     {
26         internal delegate void ResponseEventCallback(IntPtr ptr, int type, IntPtr userData);
27
28         [DllImport(Libraries.Notification, EntryPoint = "notification_create")]
29         internal static extern IntPtr Create(NotificationType type);
30
31         [DllImport(Libraries.Notification, EntryPoint = "notification_free")]
32         internal static extern NotificationError Destroy(IntPtr handle);
33
34         [DllImport(Libraries.Notification, EntryPoint = "notification_get_text")]
35         internal static extern NotificationError GetTextReferenceType(NotificationSafeHandle handle, NotificationText type, out IntPtr text);
36
37         [DllImport(Libraries.Notification, EntryPoint = "notification_set_text")]
38         internal static extern NotificationError SetText(NotificationSafeHandle handle, NotificationText type, string text, string key, int args);
39
40         [DllImport(Libraries.Notification, EntryPoint = "notification_get_image")]
41         internal static extern NotificationError GetImageReferenceType(NotificationSafeHandle handle, NotificationImage type, out IntPtr path);
42
43         [DllImport(Libraries.Notification, EntryPoint = "notification_set_image")]
44         internal static extern NotificationError SetImage(NotificationSafeHandle handle, NotificationImage type, string path);
45
46         [DllImport(Libraries.Notification, EntryPoint = "notification_get_time")]
47         internal static extern NotificationError GetTime(NotificationSafeHandle handle, out int time);
48
49         [DllImport(Libraries.Notification, EntryPoint = "notification_set_time")]
50         internal static extern NotificationError SetTime(NotificationSafeHandle handle, int time);
51
52         [DllImport(Libraries.Notification, EntryPoint = "notification_get_insert_time")]
53         internal static extern NotificationError GetInsertTime(NotificationSafeHandle handle, out long time);
54
55         [DllImport(Libraries.Notification, EntryPoint = "notification_get_sound")]
56         internal static extern NotificationError GetSoundReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
57
58         [DllImport(Libraries.Notification, EntryPoint = "notification_set_sound")]
59         internal static extern NotificationError SetSound(NotificationSafeHandle handle, AccessoryOption type, string path);
60
61         [DllImport(Libraries.Notification, EntryPoint = "notification_get_vibration")]
62         internal static extern NotificationError GetVibrationReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
63
64         [DllImport(Libraries.Notification, EntryPoint = "notification_set_vibration")]
65         internal static extern NotificationError SetVibration(NotificationSafeHandle handle, AccessoryOption type, string path);
66
67         [DllImport(Libraries.Notification, EntryPoint = "notification_get_led")]
68         internal static extern NotificationError GetLed(NotificationSafeHandle handle, out AccessoryOption type, out int color);
69
70         [DllImport(Libraries.Notification, EntryPoint = "notification_set_led")]
71         internal static extern NotificationError SetLed(NotificationSafeHandle handle, AccessoryOption type, int color);
72
73         [DllImport(Libraries.Notification, EntryPoint = "notification_get_led_time_period")]
74         internal static extern NotificationError GetLedTimePeriod(NotificationSafeHandle handle, out int onMillisecond, out int offMillisecond);
75
76         [DllImport(Libraries.Notification, EntryPoint = "notification_set_led_time_period")]
77         internal static extern NotificationError SetLedTimePeriod(NotificationSafeHandle handle, int onMillisecond, int offMillisecond);
78
79         [DllImport(Libraries.Notification, EntryPoint = "notification_get_launch_option")]
80         internal static extern NotificationError GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle apphandle);
81
82         [DllImport(Libraries.Notification, EntryPoint = "notification_set_launch_option")]
83         internal static extern NotificationError SetAppControl(NotificationSafeHandle handle, LaunchOption type, SafeAppControlHandle appHandle);
84
85         [DllImport(Libraries.Notification, EntryPoint = "notification_get_event_handler")]
86         internal static extern NotificationError GetEventHandler(NotificationSafeHandle handle, int type, out SafeAppControlHandle appHandle);
87
88         [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
89         internal static extern NotificationError SetEventHandler(NotificationSafeHandle handle, int type, SafeAppControlHandle appHandle);
90
91         [DllImport(Libraries.Notification, EntryPoint = "notification_get_property")]
92         internal static extern NotificationError GetProperties(NotificationSafeHandle handle, out int flags);
93
94         [DllImport(Libraries.Notification, EntryPoint = "notification_set_property")]
95         internal static extern NotificationError SetProperties(NotificationSafeHandle handle, int flags);
96
97         [DllImport(Libraries.Notification, EntryPoint = "notification_get_display_applist")]
98         internal static extern NotificationError GetApplist(NotificationSafeHandle handle, out int flags);
99
100         [DllImport(Libraries.Notification, EntryPoint = "notification_set_display_applist")]
101         internal static extern NotificationError SetApplist(NotificationSafeHandle handle, int flags);
102
103         [DllImport(Libraries.Notification, EntryPoint = "notification_get_size")]
104         internal static extern NotificationError GetProgressSize(NotificationSafeHandle handle, out double size);
105
106         [DllImport(Libraries.Notification, EntryPoint = "notification_set_size")]
107         internal static extern NotificationError SetProgressSize(NotificationSafeHandle handle, double size);
108
109         [DllImport(Libraries.Notification, EntryPoint = "notification_get_progress")]
110         internal static extern NotificationError GetProgress(NotificationSafeHandle handle, out double progress);
111
112         [DllImport(Libraries.Notification, EntryPoint = "notification_set_progress")]
113         internal static extern NotificationError SetProgress(NotificationSafeHandle handle, double progress);
114
115         [DllImport(Libraries.Notification, EntryPoint = "notification_get_layout")]
116         internal static extern NotificationError GetLayout(NotificationSafeHandle handle, out NotificationLayout layout);
117
118         [DllImport(Libraries.Notification, EntryPoint = "notification_set_layout")]
119         internal static extern NotificationError SetLayout(NotificationSafeHandle handle, NotificationLayout layout);
120
121         [DllImport(Libraries.Notification, EntryPoint = "notification_get_type")]
122         internal static extern NotificationError GetType(NotificationSafeHandle handle, out NotificationType type);
123
124         [DllImport(Libraries.Notification, EntryPoint = "notification_update")]
125         internal static extern NotificationError Update(NotificationSafeHandle handle);
126
127         [DllImport(Libraries.Notification, EntryPoint = "notification_delete")]
128         internal static extern NotificationError Delete(NotificationSafeHandle handle);
129
130         [DllImport(Libraries.Notification, EntryPoint = "notification_delete_all")]
131         internal static extern NotificationError DeleteAll(int type);
132
133         [DllImport(Libraries.Notification, EntryPoint = "notification_post")]
134         internal static extern NotificationError Post(NotificationSafeHandle handle);
135
136         [DllImport(Libraries.Notification, EntryPoint = "notification_post_with_event_cb")]
137         internal static extern NotificationError PostWithEventCallback(NotificationSafeHandle handle, ResponseEventCallback cb, IntPtr userdata);
138
139         [DllImport(Libraries.Notification, EntryPoint = "notification_get_pkgname")]
140         internal static extern NotificationError GetPackageName(NotificationSafeHandle handle, out IntPtr name);
141
142         [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
143         internal static extern NotificationError AddButtonAction(NotificationSafeHandle handle, ButtonIndex type, SafeAppControlHandle appcontrol);
144
145         [DllImport(Libraries.Notification, EntryPoint = "notification_remove_button")]
146         internal static extern NotificationError RemoveButton(NotificationSafeHandle handle, ButtonIndex index);
147
148         [DllImport(Libraries.Notification, EntryPoint = "notification_set_tag")]
149         internal static extern NotificationError SetTag(NotificationSafeHandle handle, string tag);
150
151         [DllImport(Libraries.Notification, EntryPoint = "notification_get_tag")]
152         internal static extern NotificationError GetTagReferenceType(NotificationSafeHandle handle, out IntPtr tag);
153
154         [DllImport(Libraries.Notification, EntryPoint = "notification_load_by_tag")]
155         internal static extern IntPtr Load(string text);
156
157         [DllImport(Libraries.Notification, EntryPoint = "notification_get_id")]
158         internal static extern NotificationError GetID(NotificationSafeHandle handle, out int groupID, out int privID);
159
160         [DllImport(Libraries.Notification, EntryPoint = "notification_set_priv_id")]
161         internal static extern NotificationError SetID(NotificationSafeHandle handle, int privID);
162
163         [DllImport(Libraries.Notification, EntryPoint = "notification_save_as_template")]
164         internal static extern NotificationError SaveTemplate(NotificationSafeHandle handle, string name);
165
166         [DllImport(Libraries.Notification, EntryPoint = "notification_create_from_template")]
167         internal static extern IntPtr LoadTemplate(string name);
168
169         [DllImport(Libraries.Notification, EntryPoint = "notification_get_noti_block_state")]
170         internal static extern NotificationError GetBlockState(out NotificationBlockState status);
171
172         [DllImport(Libraries.Notification, EntryPoint = "notification_set_auto_remove")]
173         internal static extern NotificationError SetAutoRemove(NotificationSafeHandle handle, bool autoRemove);
174
175         [DllImport(Libraries.Notification, EntryPoint = "notification_get_auto_remove")]
176         internal static extern NotificationError GetAutoRemove(NotificationSafeHandle handle, out bool autoRemove);
177
178         [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_value_type")]
179         internal static extern NotificationError SetProgressType(NotificationSafeHandle handle, ProgressCategory category);
180
181         [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_value_type")]
182         internal static extern NotificationError GetProgressType(NotificationSafeHandle handle, out ProgressCategory category);
183
184         [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_flag")]
185         internal static extern NotificationError SetOngoingFlag(NotificationSafeHandle handle, bool flag);
186
187         [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
188         internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, bool flag);
189
190         [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
191         internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, out bool flag);
192
193         [DllImport(Libraries.Notification, EntryPoint = "notification_set_text_input")]
194         internal static extern NotificationError SetPlaceHolderLength(NotificationSafeHandle handle, int length);
195
196         [DllImport(Libraries.Notification, EntryPoint = "notification_get_text_input_max_length")]
197         internal static extern NotificationError GetPlaceHolderLength(NotificationSafeHandle handle, out int length);
198
199         [DllImport(Libraries.Notification, EntryPoint = "notification_get_hide_timeout")]
200         internal static extern NotificationError GetHideTime(NotificationSafeHandle handle, out int timeout);
201
202         [DllImport(Libraries.Notification, EntryPoint = "notification_set_hide_timeout")]
203         internal static extern NotificationError SetHideTime(NotificationSafeHandle handle, int timeout);
204
205         [DllImport(Libraries.Notification, EntryPoint = "notification_get_delete_timeout")]
206         internal static extern NotificationError GetDeleteTime(NotificationSafeHandle handle, out int timeout);
207
208         [DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")]
209         internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout);
210
211         [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_data")]
212         internal static extern NotificationError SetExtensionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
213
214         [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_data")]
215         internal static extern NotificationError GetExtensionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
216
217         [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")]
218         internal static extern NotificationError GetExtensionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
219
220         [DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")]
221         internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index);
222
223         [DllImport(Libraries.Notification, EntryPoint = "notification_set_default_button")]
224         internal static extern NotificationError SetDefaultButton(NotificationSafeHandle handle, int index);
225
226         [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_event_handler")]
227         internal static extern NotificationError SetExtensionAction(NotificationSafeHandle handle, NotificationEventType type, SafeAppControlHandle appcontrol);
228
229         [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_event_handler")]
230         internal static extern NotificationError GetExtensionAction(NotificationSafeHandle handle, NotificationEventType type, out SafeAppControlHandle appcontrol);
231
232         [DllImport(Libraries.Notification, EntryPoint = "notification_clone")]
233         internal static extern NotificationError Clone(IntPtr handle, out IntPtr cloned);
234
235         internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text)
236         {
237             NotificationError ret;
238             IntPtr ptr;
239             ret = GetTextReferenceType(handle, type, out ptr);
240
241             if (ptr == IntPtr.Zero)
242             {
243                 text = null;
244             }
245             else
246             {
247                 text = Marshal.PtrToStringAnsi(ptr);
248             }
249
250             return ret;
251         }
252
253         internal static NotificationError GetImage(NotificationSafeHandle handle, NotificationImage type, out string path)
254         {
255             NotificationError ret;
256             IntPtr ptr;
257             ret = GetImageReferenceType(handle, type, out ptr);
258
259             if (ptr == IntPtr.Zero)
260             {
261                 path = null;
262             }
263             else
264             {
265                 path = Marshal.PtrToStringAnsi(ptr);
266             }
267
268             return ret;
269         }
270
271         internal static NotificationError GetSound(NotificationSafeHandle handle, out AccessoryOption type, out string path)
272         {
273             NotificationError ret;
274             IntPtr ptr;
275             ret = GetSoundReferenceType(handle, out type, out ptr);
276
277             if (ptr == IntPtr.Zero)
278             {
279                 path = null;
280             }
281             else
282             {
283                 path = Marshal.PtrToStringAnsi(ptr);
284             }
285
286             return ret;
287         }
288
289         internal static NotificationError GetVibration(NotificationSafeHandle handle, out AccessoryOption type, out string path)
290         {
291             NotificationError ret;
292             IntPtr ptr;
293             ret = GetVibrationReferenceType(handle, out type, out ptr);
294
295             if (ptr == IntPtr.Zero)
296             {
297                 path = null;
298             }
299             else
300             {
301                 path = Marshal.PtrToStringAnsi(ptr);
302             }
303
304             return ret;
305         }
306
307         internal static NotificationError GetTag(NotificationSafeHandle handle, out string tag)
308         {
309             NotificationError ret;
310             IntPtr ptr;
311             ret = GetTagReferenceType(handle, out ptr);
312
313             if (ptr == IntPtr.Zero)
314             {
315                 tag = null;
316             }
317             else
318             {
319                 tag = Marshal.PtrToStringAnsi(ptr);
320             }
321
322             return ret;
323         }
324     }
325 }