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