[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Alarm / Interop / Interop.Alarm.cs
1 /*
2  * Copyright (c) 2016 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
20 using Tizen.Internals.Errors;
21 using Tizen.Applications;
22 using Tizen.Applications.Notifications;
23
24 internal static partial class Interop
25 {
26     internal static partial class Alarm
27     {
28         [StructLayout(LayoutKind.Sequential)]
29         internal struct DateTime
30         {
31             internal int sec;
32             internal int min;
33             internal int hour;
34             internal int mday; /* day of the month, range 1 to 31*/
35             internal int mon;
36             internal int year;
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;
42         };
43
44         [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_after_delay")]
45         internal static extern int CreateAlarmAfterDelay(SafeAppControlHandle appControl, int delay, int period, out int alarmId);
46
47         [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_once_after_delay")]
48         internal static extern int CreateAlarmOnceAfterDelay(SafeAppControlHandle appControl, int delay, out int alarmId);
49
50         [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_once_at_date")]
51         internal static extern int CreateAlarmOnceAtDate(SafeAppControlHandle appControl, ref DateTime date, out int alarmId);
52
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);
55
56         [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_recurrence_week_flag")]
57         internal static extern int GetAlarmWeekFlag(int alarmId, out int weekFlag);
58
59         [DllImport(Libraries.Alarm, EntryPoint = "alarm_cancel")]
60         internal static extern int CancelAlarm(int alarmId);
61
62         [DllImport(Libraries.Alarm, EntryPoint = "alarm_cancel_all")]
63         internal static extern int CancelAllAlarms();
64
65         [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_date")]
66         internal static extern int GetAlarmScheduledDate(int alarmId, out DateTime date);
67
68         [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_current_time")]
69         internal static extern int GetCurrentTime(out DateTime date);
70
71         [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_app_control")]
72         internal static extern int GetAlarmAppControl(int alarmId, out SafeAppControlHandle control);
73
74         [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_period")]
75         internal static extern int GetAlarmScheduledPeriod(int alarmId, out int period);
76
77         [DllImport(Libraries.Alarm, EntryPoint = "alarm_set_global")]
78         internal static extern int SetAlarmGlobalFlag(int alarmId, bool global);
79
80         [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_global")]
81         internal static extern int GetAlarmGlobalFlag(int alarmId, out bool global);
82
83         [DllImport(Libraries.Alarm, EntryPoint = "alarm_foreach_registered_alarm")]
84         internal static extern int GetAllRegisteredAlarms(RegisteredAlarmCallback callback, IntPtr userData);
85
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);
88
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);
91
92         [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_once_after_delay")]
93         internal static extern AlarmError CreateAlarmNotiOnceAfterDelay(NotificationSafeHandle noti, int delay, out int alarmId);
94
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);
97
98         [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_delay")]
99         internal static extern AlarmError UpdateDelay(int alarmId, int delay);
100
101         [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_date")]
102         internal static extern AlarmError UpdateDate(int alarmId, ref DateTime date);
103
104         [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_period")]
105         internal static extern AlarmError UpdatePeriod(int alarmId, int period);
106
107         [DllImport(Libraries.Alarm, EntryPoint = "alarm_update_week_flag")]
108         internal static extern AlarmError UpdateWeekFlag(int alarmId, int week);
109
110         //callback
111         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
112         internal delegate bool RegisteredAlarmCallback(int alarmId, IntPtr userData);
113     }
114 }