2 * Copyright (c) 2011 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 #include <Commons/FunctionDefinition.h>
19 #include <Commons/FunctionDeclaration.h>
21 #include <Commons/Exception.h>
22 #include <dpl/exception.h>
25 #include "plugin_config.h"
27 #define CALENDAR_FEATURE_API "http://tizen.org/api/calendar"
28 #define CALENDAR_FEATURE_API_READ "http://tizen.org/api/calendar.read"
29 #define CALENDAR_FEATURE_API_WRITE "http://tizen.org/api/calendar.write"
31 #define CALENDAR_DEVICE_CAP_READ "calendar.read"
32 #define CALENDAR_DEVICE_CAP_WRITE "calendar.write"
34 using namespace WrtDeviceApis::Commons;
40 static FunctionMapping createCalendarFunctions();
42 static FunctionMapping CalendarFunctions =
43 createCalendarFunctions();
45 DEFINE_FUNCTION_GETTER(Calendar, CalendarFunctions);
47 static FunctionMapping createCalendarFunctions()
52 ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CALENDAR_READ, CALENDAR_DEVICE_CAP_READ);
53 ACE_CREATE_DEVICE_CAP(DEVICE_CAP_CALENDAR_WRITE, CALENDAR_DEVICE_CAP_WRITE);
55 ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CALENDAR_READ);
56 ACE_ADD_DEVICE_CAP(DEVICE_LIST_CALENDAR_READ, DEVICE_CAP_CALENDAR_READ);
58 ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CALENDAR_WRITE);
59 ACE_ADD_DEVICE_CAP(DEVICE_LIST_CALENDAR_WRITE, DEVICE_CAP_CALENDAR_WRITE);
64 ACE_CREATE_FEATURE(FEATURE_CALENDAR, CALENDAR_FEATURE_API);
65 ACE_CREATE_FEATURE(FEATURE_CALENDAR_READ, CALENDAR_FEATURE_API_READ);
66 ACE_CREATE_FEATURE(FEATURE_CALENDAR_WRITE, CALENDAR_FEATURE_API_WRITE);
68 ACE_CREATE_FEATURE_LIST(CALENDAR_FEATURES_CALENDAR_READ_WRITE);
69 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_READ_WRITE,
71 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_READ_WRITE,
72 FEATURE_CALENDAR_READ);
73 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_READ_WRITE,
74 FEATURE_CALENDAR_WRITE);
76 ACE_CREATE_FEATURE_LIST(CALENDAR_FEATURES_CALENDAR_READ);
77 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_READ, FEATURE_CALENDAR);
78 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_READ, FEATURE_CALENDAR_READ);
80 ACE_CREATE_FEATURE_LIST(CALENDAR_FEATURES_CALENDAR_WRITE);
81 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_WRITE, FEATURE_CALENDAR);
82 ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_WRITE,
83 FEATURE_CALENDAR_WRITE);
89 FunctionMapping calendarMapping;
92 AceFunction getCalendarsFunc = ACE_CREATE_FUNCTION(
93 FUNCTION_GET_CALENDARS,
94 CALENDAR_FUNCTION_API_GET_CALENDARS,
95 CALENDAR_FEATURES_CALENDAR_READ_WRITE,
96 DEVICE_LIST_CALENDAR_READ);
98 calendarMapping.insert(std::make_pair(
99 CALENDAR_FUNCTION_API_GET_CALENDARS,
103 AceFunction getDefaultCalendarFunc = ACE_CREATE_FUNCTION(
104 FUNCTION_GET_DEFAULT_CALENDAR,
105 CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR,
106 CALENDAR_FEATURES_CALENDAR_READ_WRITE,
107 DEVICE_LIST_CALENDAR_READ);
109 calendarMapping.insert(std::make_pair(
110 CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR,
111 getDefaultCalendarFunc));
115 AceFunction findFunc = ACE_CREATE_FUNCTION(
117 CALENDAR_FUNCTION_API_FIND,
118 CALENDAR_FEATURES_CALENDAR_READ,
119 DEVICE_LIST_CALENDAR_READ);
121 calendarMapping.insert(std::make_pair(
122 CALENDAR_FUNCTION_API_FIND,
126 AceFunction addFunc = ACE_CREATE_FUNCTION(
128 CALENDAR_FUNCTION_API_ADD,
129 CALENDAR_FEATURES_CALENDAR_WRITE,
130 DEVICE_LIST_CALENDAR_WRITE);
132 calendarMapping.insert(std::make_pair(
133 CALENDAR_FUNCTION_API_ADD,
137 AceFunction addBatchFunc = ACE_CREATE_FUNCTION(
139 CALENDAR_FUNCTION_API_ADD_BATCH,
140 CALENDAR_FEATURES_CALENDAR_WRITE,
141 DEVICE_LIST_CALENDAR_WRITE);
143 calendarMapping.insert(std::make_pair(
144 CALENDAR_FUNCTION_API_ADD_BATCH,
148 AceFunction updateFunc = ACE_CREATE_FUNCTION(
150 CALENDAR_FUNCTION_API_UPDATE,
151 CALENDAR_FEATURES_CALENDAR_WRITE,
152 DEVICE_LIST_CALENDAR_WRITE);
154 calendarMapping.insert(std::make_pair(
155 CALENDAR_FUNCTION_API_UPDATE,
159 AceFunction updateBatchFunc = ACE_CREATE_FUNCTION(
160 FUNCTION_UPDATE_BATCH,
161 CALENDAR_FUNCTION_API_UPDATE_BATCH,
162 CALENDAR_FEATURES_CALENDAR_WRITE,
163 DEVICE_LIST_CALENDAR_WRITE);
165 calendarMapping.insert(std::make_pair(
166 CALENDAR_FUNCTION_API_UPDATE_BATCH,
170 AceFunction removeFunc = ACE_CREATE_FUNCTION(
172 CALENDAR_FUNCTION_API_REMOVE,
173 CALENDAR_FEATURES_CALENDAR_WRITE,
174 DEVICE_LIST_CALENDAR_WRITE);
176 calendarMapping.insert(std::make_pair(
177 CALENDAR_FUNCTION_API_REMOVE,
181 AceFunction removeBatchFunc = ACE_CREATE_FUNCTION(
182 FUNCTION_REMOVE_BATCH,
183 CALENDAR_FUNCTION_API_REMOVE_BATCH,
184 CALENDAR_FEATURES_CALENDAR_WRITE,
185 DEVICE_LIST_CALENDAR_WRITE);
187 calendarMapping.insert(std::make_pair(
188 CALENDAR_FUNCTION_API_REMOVE_BATCH,
192 AceFunction convertFromStringFunc = ACE_CREATE_FUNCTION(
193 FUNCTION_CONVERT_FROM_STRING,
194 CALENDAR_FUNCTION_API_CONVERT_FROM_STRING,
195 CALENDAR_FEATURES_CALENDAR_READ_WRITE,
196 DEVICE_LIST_CALENDAR_READ);
198 calendarMapping.insert(std::make_pair(
199 CALENDAR_FUNCTION_API_CONVERT_FROM_STRING,
200 convertFromStringFunc));
203 AceFunction convertToStringFunc = ACE_CREATE_FUNCTION(
204 FUNCTION_CONVERT_TO_STRING,
205 CALENDAR_FUNCTION_API_CONVERT_TO_STRING,
206 CALENDAR_FEATURES_CALENDAR_READ_WRITE,
207 DEVICE_LIST_CALENDAR_READ);
209 calendarMapping.insert(std::make_pair(
210 CALENDAR_FUNCTION_API_CONVERT_TO_STRING,
211 convertToStringFunc));
214 AceFunction addChangeListenerFunc = ACE_CREATE_FUNCTION(
215 FUNCTION_ADD_CHANGE_LISTENER,
216 CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER,
217 CALENDAR_FEATURES_CALENDAR_READ,
218 DEVICE_LIST_CALENDAR_READ);
220 calendarMapping.insert(std::make_pair(
221 CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER,
222 addChangeListenerFunc));
224 //removeChangeListener
225 AceFunction removeChangeListenerFunc = ACE_CREATE_FUNCTION(
226 FUNCTION_REMOVE_CHANGE_LISTENER,
227 CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER,
228 CALENDAR_FEATURES_CALENDAR_READ,
229 DEVICE_LIST_CALENDAR_READ);
231 calendarMapping.insert(std::make_pair(
232 CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER,
233 removeChangeListenerFunc));
235 //expandEventRecurrence
236 AceFunction expandEventRecurrenceFunc = ACE_CREATE_FUNCTION(
237 FUNCTION_EXPAND_EVENT_RECURRENCE,
238 CALENDAR_FUNCTION_API_EXPAND_EVENT_RECURRENCE,
239 CALENDAR_FEATURES_CALENDAR_READ,
240 DEVICE_LIST_CALENDAR_READ);
242 calendarMapping.insert(std::make_pair(
243 CALENDAR_FUNCTION_API_EXPAND_EVENT_RECURRENCE,
244 expandEventRecurrenceFunc));
246 return calendarMapping;