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 [DllImport(Libraries.Notification, EntryPoint = "notification_create")]
27 internal static extern IntPtr Create(NotificationType type);
29 [DllImport(Libraries.Notification, EntryPoint = "notification_free")]
30 internal static extern NotificationError Destroy(IntPtr handle);
32 [DllImport(Libraries.Notification, EntryPoint = "notification_get_text")]
33 internal static extern NotificationError GetTextReferenceType(NotificationSafeHandle handle, NotificationText type, out IntPtr text);
35 [DllImport(Libraries.Notification, EntryPoint = "notification_set_text")]
36 internal static extern NotificationError SetText(NotificationSafeHandle handle, NotificationText type, string text, string key, int args);
38 [DllImport(Libraries.Notification, EntryPoint = "notification_get_image")]
39 internal static extern NotificationError GetImageReferenceType(NotificationSafeHandle handle, NotificationImage type, out IntPtr path);
41 [DllImport(Libraries.Notification, EntryPoint = "notification_set_image")]
42 internal static extern NotificationError SetImage(NotificationSafeHandle handle, NotificationImage type, string path);
44 [DllImport(Libraries.Notification, EntryPoint = "notification_get_time")]
45 internal static extern NotificationError GetTime(NotificationSafeHandle handle, out int time);
47 [DllImport(Libraries.Notification, EntryPoint = "notification_set_time")]
48 internal static extern NotificationError SetTime(NotificationSafeHandle handle, int time);
50 [DllImport(Libraries.Notification, EntryPoint = "notification_get_insert_time")]
51 internal static extern NotificationError GetInsertTime(NotificationSafeHandle handle, out long time);
53 [DllImport(Libraries.Notification, EntryPoint = "notification_get_sound")]
54 internal static extern NotificationError GetSoundReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
56 [DllImport(Libraries.Notification, EntryPoint = "notification_set_sound")]
57 internal static extern NotificationError SetSound(NotificationSafeHandle handle, AccessoryOption type, string path);
59 [DllImport(Libraries.Notification, EntryPoint = "notification_get_vibration")]
60 internal static extern NotificationError GetVibrationReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path);
62 [DllImport(Libraries.Notification, EntryPoint = "notification_set_vibration")]
63 internal static extern NotificationError SetVibration(NotificationSafeHandle handle, AccessoryOption type, string path);
65 [DllImport(Libraries.Notification, EntryPoint = "notification_get_led")]
66 internal static extern NotificationError GetLed(NotificationSafeHandle handle, out AccessoryOption type, out int color);
68 [DllImport(Libraries.Notification, EntryPoint = "notification_set_led")]
69 internal static extern NotificationError SetLed(NotificationSafeHandle handle, AccessoryOption type, int color);
71 [DllImport(Libraries.Notification, EntryPoint = "notification_get_led_time_period")]
72 internal static extern NotificationError GetLedTimePeriod(NotificationSafeHandle handle, out int onMillisecond, out int offMillisecond);
74 [DllImport(Libraries.Notification, EntryPoint = "notification_set_led_time_period")]
75 internal static extern NotificationError SetLedTimePeriod(NotificationSafeHandle handle, int onMillisecond, int offMillisecond);
77 [DllImport(Libraries.Notification, EntryPoint = "notification_get_launch_option")]
78 internal static extern NotificationError GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle apphandle);
80 [DllImport(Libraries.Notification, EntryPoint = "notification_set_launch_option")]
81 internal static extern NotificationError SetAppControl(NotificationSafeHandle handle, LaunchOption type, SafeAppControlHandle appHandle);
83 [DllImport(Libraries.Notification, EntryPoint = "notification_get_event_handler")]
84 internal static extern NotificationError GetEventHandler(NotificationSafeHandle handle, int type, out SafeAppControlHandle appHandle);
86 [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
87 internal static extern NotificationError SetEventHandler(NotificationSafeHandle handle, int type, SafeAppControlHandle appHandle);
89 [DllImport(Libraries.Notification, EntryPoint = "notification_get_property")]
90 internal static extern NotificationError GetProperties(NotificationSafeHandle handle, out int flags);
92 [DllImport(Libraries.Notification, EntryPoint = "notification_set_property")]
93 internal static extern NotificationError SetProperties(NotificationSafeHandle handle, int flags);
95 [DllImport(Libraries.Notification, EntryPoint = "notification_get_display_applist")]
96 internal static extern NotificationError GetApplist(NotificationSafeHandle handle, out int flags);
98 [DllImport(Libraries.Notification, EntryPoint = "notification_set_display_applist")]
99 internal static extern NotificationError SetApplist(NotificationSafeHandle handle, int flags);
101 [DllImport(Libraries.Notification, EntryPoint = "notification_get_size")]
102 internal static extern NotificationError GetProgressSize(NotificationSafeHandle handle, out double size);
104 [DllImport(Libraries.Notification, EntryPoint = "notification_set_size")]
105 internal static extern NotificationError SetProgressSize(NotificationSafeHandle handle, double size);
107 [DllImport(Libraries.Notification, EntryPoint = "notification_get_progress")]
108 internal static extern NotificationError GetProgress(NotificationSafeHandle handle, out double progress);
110 [DllImport(Libraries.Notification, EntryPoint = "notification_set_progress")]
111 internal static extern NotificationError SetProgress(NotificationSafeHandle handle, double progress);
113 [DllImport(Libraries.Notification, EntryPoint = "notification_get_layout")]
114 internal static extern NotificationError GetLayout(NotificationSafeHandle handle, out NotificationLayout layout);
116 [DllImport(Libraries.Notification, EntryPoint = "notification_set_layout")]
117 internal static extern NotificationError SetLayout(NotificationSafeHandle handle, NotificationLayout layout);
119 [DllImport(Libraries.Notification, EntryPoint = "notification_get_type")]
120 internal static extern NotificationError GetType(NotificationSafeHandle handle, out NotificationType type);
122 [DllImport(Libraries.Notification, EntryPoint = "notification_update")]
123 internal static extern NotificationError Update(NotificationSafeHandle handle);
125 [DllImport(Libraries.Notification, EntryPoint = "notification_delete")]
126 internal static extern NotificationError Delete(NotificationSafeHandle handle);
128 [DllImport(Libraries.Notification, EntryPoint = "notification_delete_all")]
129 internal static extern NotificationError DeleteAll(int type);
131 [DllImport(Libraries.Notification, EntryPoint = "notification_post")]
132 internal static extern NotificationError Post(NotificationSafeHandle handle);
134 [DllImport(Libraries.Notification, EntryPoint = "notification_get_pkgname")]
135 internal static extern NotificationError GetPackageName(NotificationSafeHandle handle, out IntPtr name);
137 [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")]
138 internal static extern NotificationError AddButtonAction(NotificationSafeHandle handle, ButtonIndex type, SafeAppControlHandle appcontrol);
140 [DllImport(Libraries.Notification, EntryPoint = "notification_remove_button")]
141 internal static extern NotificationError RemoveButton(NotificationSafeHandle handle, ButtonIndex index);
143 [DllImport(Libraries.Notification, EntryPoint = "notification_set_tag")]
144 internal static extern NotificationError SetTag(NotificationSafeHandle handle, string tag);
146 [DllImport(Libraries.Notification, EntryPoint = "notification_get_tag")]
147 internal static extern NotificationError GetTagReferenceType(NotificationSafeHandle handle, out IntPtr tag);
149 [DllImport(Libraries.Notification, EntryPoint = "notification_load_by_tag")]
150 internal static extern IntPtr Load(string text);
152 [DllImport(Libraries.Notification, EntryPoint = "notification_get_id")]
153 internal static extern NotificationError GetID(NotificationSafeHandle handle, out int groupID, out int privID);
155 [DllImport(Libraries.Notification, EntryPoint = "notification_set_priv_id")]
156 internal static extern NotificationError SetID(NotificationSafeHandle handle, int privID);
158 [DllImport(Libraries.Notification, EntryPoint = "notification_save_as_template")]
159 internal static extern NotificationError SaveTemplate(NotificationSafeHandle handle, string name);
161 [DllImport(Libraries.Notification, EntryPoint = "notification_create_from_template")]
162 internal static extern IntPtr LoadTemplate(string name);
164 [DllImport(Libraries.Notification, EntryPoint = "notification_get_noti_block_state")]
165 internal static extern NotificationError GetBlockState(out NotificationBlockState status);
167 [DllImport(Libraries.Notification, EntryPoint = "notification_set_auto_remove")]
168 internal static extern NotificationError SetAutoRemove(NotificationSafeHandle handle, bool autoRemove);
170 [DllImport(Libraries.Notification, EntryPoint = "notification_get_auto_remove")]
171 internal static extern NotificationError GetAutoRemove(NotificationSafeHandle handle, out bool autoRemove);
173 [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_value_type")]
174 internal static extern NotificationError SetProgressType(NotificationSafeHandle handle, ProgressCategory category);
176 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_value_type")]
177 internal static extern NotificationError GetProgressType(NotificationSafeHandle handle, out ProgressCategory category);
179 [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_flag")]
180 internal static extern NotificationError SetOngoingFlag(NotificationSafeHandle handle, bool flag);
182 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
183 internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, bool flag);
185 [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")]
186 internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, out bool flag);
188 [DllImport(Libraries.Notification, EntryPoint = "notification_set_text_input")]
189 internal static extern NotificationError SetPlaceHolderLength(NotificationSafeHandle handle, int length);
191 [DllImport(Libraries.Notification, EntryPoint = "notification_get_text_input_max_length")]
192 internal static extern NotificationError GetPlaceHolderLength(NotificationSafeHandle handle, out int length);
194 [DllImport(Libraries.Notification, EntryPoint = "notification_get_hide_timeout")]
195 internal static extern NotificationError GetHideTime(NotificationSafeHandle handle, out int timeout);
197 [DllImport(Libraries.Notification, EntryPoint = "notification_set_hide_timeout")]
198 internal static extern NotificationError SetHideTime(NotificationSafeHandle handle, int timeout);
200 [DllImport(Libraries.Notification, EntryPoint = "notification_get_delete_timeout")]
201 internal static extern NotificationError GetDeleteTime(NotificationSafeHandle handle, out int timeout);
203 [DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")]
204 internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout);
206 [DllImport(Libraries.Notification, EntryPoint = "notification_set_extention_data")]
207 internal static extern NotificationError SetExtentionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle);
209 [DllImport(Libraries.Notification, EntryPoint = "notification_get_extention_data")]
210 internal static extern NotificationError GetExtentionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
212 [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")]
213 internal static extern NotificationError GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args);
215 [DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")]
216 internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index);
218 [DllImport(Libraries.Notification, EntryPoint = "notification_set_default_button")]
219 internal static extern NotificationError SetDefaultButton(NotificationSafeHandle handle, int index);
221 internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text)
223 NotificationError ret;
225 ret = GetTextReferenceType(handle, type, out ptr);
227 if (ptr == IntPtr.Zero)
233 text = Marshal.PtrToStringAnsi(ptr);
239 internal static NotificationError GetImage(NotificationSafeHandle handle, NotificationImage type, out string path)
241 NotificationError ret;
243 ret = GetImageReferenceType(handle, type, out ptr);
245 if (ptr == IntPtr.Zero)
251 path = Marshal.PtrToStringAnsi(ptr);
257 internal static NotificationError GetSound(NotificationSafeHandle handle, out AccessoryOption type, out string path)
259 NotificationError ret;
261 ret = GetSoundReferenceType(handle, out type, out ptr);
263 if (ptr == IntPtr.Zero)
269 path = Marshal.PtrToStringAnsi(ptr);
275 internal static NotificationError GetVibration(NotificationSafeHandle handle, out AccessoryOption type, out string path)
277 NotificationError ret;
279 ret = GetVibrationReferenceType(handle, out type, out ptr);
281 if (ptr == IntPtr.Zero)
287 path = Marshal.PtrToStringAnsi(ptr);
293 internal static NotificationError GetTag(NotificationSafeHandle handle, out string tag)
295 NotificationError ret;
297 ret = GetTagReferenceType(handle, out ptr);
299 if (ptr == IntPtr.Zero)
305 tag = Marshal.PtrToStringAnsi(ptr);