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.ComponentModel;
19 using System.Runtime.InteropServices;
20 using Tizen.Applications;
21 using Tizen.Applications.Notifications;
23 internal static partial class Interop
25 internal static class Notification
27 [DllImport(Libraries.Notification, EntryPoint = "notification_create")]
28 internal static extern IntPtr Create(NotificationType type);
30 [DllImport(Libraries.Notification, EntryPoint = "notification_free")]
31 internal static extern NotificationError Destroy(IntPtr handle);
33 [DllImport(Libraries.Notification, EntryPoint = "notification_get_text")]
34 internal static extern NotificationError GetTextReferenceType(NotificationSafeHandle handle, NotificationText type, out IntPtr text);
36 [DllImport(Libraries.Notification, EntryPoint = "notification_set_text")]
37 internal static extern NotificationError SetText(NotificationSafeHandle handle, NotificationText type, string text, string key, int args);
39 [DllImport(Libraries.Notification, EntryPoint = "notification_get_image")]
40 internal static extern NotificationError GetImageReferenceType(NotificationSafeHandle handle, NotificationImage type, out IntPtr path);
42 [DllImport(Libraries.Notification, EntryPoint = "notification_set_image")]
43 internal static extern NotificationError SetImage(NotificationSafeHandle handle, NotificationImage type, string path);
45 [DllImport(Libraries.Notification, EntryPoint = "notification_get_time")]
46 internal static extern NotificationError GetTime(NotificationSafeHandle handle, out int time);
48 [DllImport(Libraries.Notification, EntryPoint = "notification_set_time")]
49 internal static extern NotificationError SetTime(NotificationSafeHandle handle, int time);
51 [DllImport(Libraries.Notification, EntryPoint = "notification_get_insert_time")]
52 internal static extern NotificationError GetInsertTime(NotificationSafeHandle handle, out long time);
54 [DllImport(Libraries.Notification, EntryPoint = "notification_get_sound")]
55 internal static extern NotificationError GetSoundReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
57 [DllImport(Libraries.Notification, EntryPoint = "notification_set_sound")]
58 internal static extern NotificationError SetSound(NotificationSafeHandle handle, AccessoryOption type, string path);
60 [DllImport(Libraries.Notification, EntryPoint = "notification_get_vibration")]
61 internal static extern NotificationError GetVibrationReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
63 [DllImport(Libraries.Notification, EntryPoint = "notification_set_vibration")]
64 internal static extern NotificationError SetVibration(NotificationSafeHandle handle, AccessoryOption type, string path);
66 [DllImport(Libraries.Notification, EntryPoint = "notification_get_led")]
67 internal static extern NotificationError GetLed(NotificationSafeHandle handle, out AccessoryOption type, out int color);
69 [DllImport(Libraries.Notification, EntryPoint = "notification_set_led")]
70 internal static extern NotificationError SetLed(NotificationSafeHandle handle, AccessoryOption type, int color);
72 [DllImport(Libraries.Notification, EntryPoint = "notification_get_led_time_period")]
73 internal static extern NotificationError GetLedTimePeriod(NotificationSafeHandle handle, out int onMillisecond, out int offMillisecond);
75 [DllImport(Libraries.Notification, EntryPoint = "notification_set_led_time_period")]
76 internal static extern NotificationError SetLedTimePeriod(NotificationSafeHandle handle, int onMillisecond, int offMillisecond);
78 [DllImport(Libraries.Notification, EntryPoint = "notification_get_launch_option")]
79 internal static extern NotificationError GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle apphandle);
81 [DllImport(Libraries.Notification, EntryPoint = "notification_set_launch_option")]
82 internal static extern NotificationError SetAppControl(NotificationSafeHandle handle, LaunchOption type, SafeAppControlHandle appHandle);
84 [DllImport(Libraries.Notification, EntryPoint = "notification_get_event_handler")]
85 internal static extern NotificationError GetEventHandler(NotificationSafeHandle handle, int type, out SafeAppControlHandle appHandle);
87 [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
88 internal static extern NotificationError SetEventHandler(NotificationSafeHandle handle, int type, SafeAppControlHandle appHandle);
90 [DllImport(Libraries.Notification, EntryPoint = "notification_get_property")]
91 internal static extern NotificationError GetProperties(NotificationSafeHandle handle, out int flags);
93 [DllImport(Libraries.Notification, EntryPoint = "notification_set_property")]
94 internal static extern NotificationError SetProperties(NotificationSafeHandle handle, int flags);
96 [DllImport(Libraries.Notification, EntryPoint = "notification_get_display_applist")]
97 internal static extern NotificationError GetApplist(NotificationSafeHandle handle, out int flags);
99 [DllImport(Libraries.Notification, EntryPoint = "notification_set_display_applist")]
100 internal static extern NotificationError SetApplist(NotificationSafeHandle handle, int flags);
102 [DllImport(Libraries.Notification, EntryPoint = "notification_get_size")]
103 internal static extern NotificationError GetProgressSize(NotificationSafeHandle handle, out double size);
105 [DllImport(Libraries.Notification, EntryPoint = "notification_set_size")]
106 internal static extern NotificationError SetProgressSize(NotificationSafeHandle handle, double size);
108 [DllImport(Libraries.Notification, EntryPoint = "notification_get_progress")]
109 internal static extern NotificationError GetProgress(NotificationSafeHandle handle, out double progress);
111 [DllImport(Libraries.Notification, EntryPoint = "notification_set_progress")]
112 internal static extern NotificationError SetProgress(NotificationSafeHandle handle, double progress);
114 [DllImport(Libraries.Notification, EntryPoint = "notification_get_layout")]
115 internal static extern NotificationError GetLayout(NotificationSafeHandle handle, out NotificationLayout layout);
117 [DllImport(Libraries.Notification, EntryPoint = "notification_set_layout")]
118 internal static extern NotificationError SetLayout(NotificationSafeHandle handle, NotificationLayout layout);
120 [DllImport(Libraries.Notification, EntryPoint = "notification_get_type")]
121 internal static extern NotificationError GetType(NotificationSafeHandle handle, out NotificationType type);
123 [DllImport(Libraries.Notification, EntryPoint = "notification_update")]
124 internal static extern NotificationError Update(NotificationSafeHandle handle);
126 [DllImport(Libraries.Notification, EntryPoint = "notification_delete")]
127 internal static extern NotificationError Delete(NotificationSafeHandle handle);
129 [DllImport(Libraries.Notification, EntryPoint = "notification_delete_all")]
130 internal static extern NotificationError DeleteAll(int type);
132 [DllImport(Libraries.Notification, EntryPoint = "notification_post")]
133 internal static extern NotificationError Post(NotificationSafeHandle handle);
135 [DllImport(Libraries.Notification, EntryPoint = "notification_get_pkgname")]
136 internal static extern NotificationError GetPackageName(NotificationSafeHandle handle, out IntPtr name);
138 [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
139 internal static extern NotificationError AddButtonAction(NotificationSafeHandle handle, ButtonIndex type, SafeAppControlHandle appcontrol);
141 [DllImport(Libraries.Notification, EntryPoint = "notification_remove_button")]
142 internal static extern NotificationError RemoveButton(NotificationSafeHandle handle, ButtonIndex index);
144 [DllImport(Libraries.Notification, EntryPoint = "notification_set_tag")]
145 internal static extern NotificationError SetTag(NotificationSafeHandle handle, string tag);
147 [DllImport(Libraries.Notification, EntryPoint = "notification_get_tag")]
148 internal static extern NotificationError GetTagReferenceType(NotificationSafeHandle handle, out IntPtr tag);
150 [DllImport(Libraries.Notification, EntryPoint = "notification_load_by_tag")]
151 internal static extern IntPtr Load(string text);
153 [DllImport(Libraries.Notification, EntryPoint = "notification_get_id")]
154 internal static extern NotificationError GetID(NotificationSafeHandle handle, out int groupID, out int privID);
156 [DllImport(Libraries.Notification, EntryPoint = "notification_set_priv_id")]
157 internal static extern NotificationError SetID(NotificationSafeHandle handle, int privID);
159 [DllImport(Libraries.Notification, EntryPoint = "notification_save_as_template")]
160 internal static extern NotificationError SaveTemplate(NotificationSafeHandle handle, string name);
162 [DllImport(Libraries.Notification, EntryPoint = "notification_create_from_template")]
163 internal static extern IntPtr LoadTemplate(string name);
165 [DllImport(Libraries.Notification, EntryPoint = "notification_get_noti_block_state")]
166 internal static extern NotificationError GetBlockState(out NotificationBlockState status);
168 [DllImport(Libraries.Notification, EntryPoint = "notification_set_auto_remove")]
169 internal static extern NotificationError SetAutoRemove(NotificationSafeHandle handle, bool autoRemove);
171 [DllImport(Libraries.Notification, EntryPoint = "notification_get_auto_remove")]
172 internal static extern NotificationError GetAutoRemove(NotificationSafeHandle handle, out bool autoRemove);
174 [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_value_type")]
175 internal static extern NotificationError SetProgressType(NotificationSafeHandle handle, ProgressCategory category);
177 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_value_type")]
178 internal static extern NotificationError GetProgressType(NotificationSafeHandle handle, out ProgressCategory category);
180 [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_flag")]
181 internal static extern NotificationError SetOngoingFlag(NotificationSafeHandle handle, bool flag);
183 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
184 internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, bool flag);
186 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
187 internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, out bool flag);
189 [DllImport(Libraries.Notification, EntryPoint = "notification_set_text_input")]
190 internal static extern NotificationError SetPlaceHolderLength(NotificationSafeHandle handle, int length);
192 [DllImport(Libraries.Notification, EntryPoint = "notification_get_text_input_max_length")]
193 internal static extern NotificationError GetPlaceHolderLength(NotificationSafeHandle handle, out int length);
195 [DllImport(Libraries.Notification, EntryPoint = "notification_get_hide_timeout")]
196 internal static extern NotificationError GetHideTime(NotificationSafeHandle handle, out int timeout);
198 [DllImport(Libraries.Notification, EntryPoint = "notification_set_hide_timeout")]
199 internal static extern NotificationError SetHideTime(NotificationSafeHandle handle, int timeout);
201 [DllImport(Libraries.Notification, EntryPoint = "notification_get_delete_timeout")]
202 internal static extern NotificationError GetDeleteTime(NotificationSafeHandle handle, out int timeout);
204 [DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")]
205 internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout);
207 [DllImport(Libraries.Notification, EntryPoint = "notification_set_extension_image_size")]
208 internal static extern NotificationError SetBigPictureSize(NotificationSafeHandle handle, int size);
210 [DllImport(Libraries.Notification, EntryPoint = "notification_get_extension_image_size")]
211 internal static extern NotificationError GetBigPictureSize(NotificationSafeHandle handle, out int size);
213 [DllImport(Libraries.Notification, EntryPoint = "notification_set_extention_data")]
214 internal static extern NotificationError SetExtentionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
216 [DllImport(Libraries.Notification, EntryPoint = "notification_get_extention_data")]
217 internal static extern NotificationError GetExtentionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
219 [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")]
220 internal static extern NotificationError GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
222 internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text)
224 NotificationError ret;
226 ret = GetTextReferenceType(handle, type, out ptr);
228 if (ptr == IntPtr.Zero)
234 text = Marshal.PtrToStringAnsi(ptr);
240 internal static NotificationError GetImage(NotificationSafeHandle handle, NotificationImage type, out string path)
242 NotificationError ret;
244 ret = GetImageReferenceType(handle, type, out ptr);
246 if (ptr == IntPtr.Zero)
252 path = Marshal.PtrToStringAnsi(ptr);
258 internal static NotificationError GetSound(NotificationSafeHandle handle, out AccessoryOption type, out string path)
260 NotificationError ret;
262 ret = GetSoundReferenceType(handle, out type, out ptr);
264 if (ptr == IntPtr.Zero)
270 path = Marshal.PtrToStringAnsi(ptr);
276 internal static NotificationError GetVibration(NotificationSafeHandle handle, out AccessoryOption type, out string path)
278 NotificationError ret;
280 ret = GetVibrationReferenceType(handle, out type, out ptr);
282 if (ptr == IntPtr.Zero)
288 path = Marshal.PtrToStringAnsi(ptr);
294 internal static NotificationError GetTag(NotificationSafeHandle handle, out string tag)
296 NotificationError ret;
298 ret = GetTagReferenceType(handle, out ptr);
300 if (ptr == IntPtr.Zero)
306 tag = Marshal.PtrToStringAnsi(ptr);