2 * Copyright (c) 2016 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;
20 using Tizen.Internals.Errors;
21 using Tizen.Applications;
22 using Tizen.Applications.Notifications;
24 internal static partial class Interop
26 internal static partial class Alarm
28 [StructLayout(LayoutKind.Sequential)]
29 internal struct DateTime
34 internal int mday; /* day of the month, range 1 to 31*/
37 internal int wday; /* day of the week, range 0 to 6*/
38 internal int yday; /* day in the year, range 0 to 365*/
39 internal int isdst; /* daylight saving time*/
40 internal long tm_gmtoff;
41 internal IntPtr tm_zone;
44 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_after_delay")]
45 internal static extern int CreateAlarmAfterDelay(SafeAppControlHandle appControl, int delay, int period, out int alarmId);
47 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_once_after_delay")]
48 internal static extern int CreateAlarmOnceAfterDelay(SafeAppControlHandle appControl, int delay, out int alarmId);
50 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_once_at_date")]
51 internal static extern int CreateAlarmOnceAtDate(SafeAppControlHandle appControl, ref DateTime date, out int alarmId);
53 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_with_recurrence_week_flag")]
54 internal static extern int CreateAlarmRecurWeek(SafeAppControlHandle appControl, ref DateTime date, int week, out int alarmId);
56 [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_recurrence_week_flag")]
57 internal static extern int GetAlarmWeekFlag(int alarmId, out int weekFlag);
59 [DllImport(Libraries.Alarm, EntryPoint = "alarm_cancel")]
60 internal static extern int CancelAlarm(int alarmId);
62 [DllImport(Libraries.Alarm, EntryPoint = "alarm_cancel_all")]
63 internal static extern int CancelAllAlarms();
65 [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_date")]
66 internal static extern int GetAlarmScheduledDate(int alarmId, out DateTime date);
68 [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_current_time")]
69 internal static extern int GetCurrentTime(out DateTime date);
71 [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_app_control")]
72 internal static extern int GetAlarmAppControl(int alarmId, out SafeAppControlHandle control);
74 [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_period")]
75 internal static extern int GetAlarmScheduledPeriod(int alarmId, out int period);
77 [DllImport(Libraries.Alarm, EntryPoint = "alarm_set_global")]
78 internal static extern int SetAlarmGlobalFlag(int alarmId, bool global);
80 [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_global")]
81 internal static extern int GetAlarmGlobalFlag(int alarmId, out bool global);
83 [DllImport(Libraries.Alarm, EntryPoint = "alarm_foreach_registered_alarm")]
84 internal static extern int GetAllRegisteredAlarms(RegisteredAlarmCallback callback, IntPtr userData);
86 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_once_at_date")]
87 internal static extern AlarmError CreateAlarmNotiOnceAtDate(NotificationSafeHandle noti, ref DateTime date, out int alarmId);
89 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_after_delay")]
90 internal static extern AlarmError CreateAlarmNotiAfterDelay(NotificationSafeHandle noti, int delay, int period, out int alarmId);
92 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_once_after_delay")]
93 internal static extern AlarmError CreateAlarmNotiOnceAfterDelay(NotificationSafeHandle noti, int delay, out int alarmId);
95 [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_with_recurrence_week_flag")]
96 internal static extern AlarmError CreateAlarmNotiRecurWeek(NotificationSafeHandle noti, ref DateTime date, int week, out int alarmId);
98 [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_delay")]
99 internal static extern AlarmError UpdateDelay(int alarmId, int delay);
101 [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_date")]
102 internal static extern AlarmError UpdateDate(int alarmId, ref DateTime date);
104 [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_period")]
105 internal static extern AlarmError UpdatePeriod(int alarmId, int period);
107 [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_week_flag")]
108 internal static extern AlarmError UpdateWeekFlag(int alarmId, int week);
111 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
112 internal delegate bool RegisteredAlarmCallback(int alarmId, IntPtr userData);