c796d118e313b23c603fd4cce94fcb71ed81c14e
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Calendar / plugin_config.cpp
1 /*
2  * Copyright (c) 2011 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
18 #include <Commons/FunctionDefinition.h>
19 #include <Commons/FunctionDeclaration.h>
20 #include <iostream>
21 #include <Commons/Exception.h>
22 #include <dpl/exception.h>
23 #include <map>
24
25 #include "plugin_config.h"
26
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"
30
31 #define CALENDAR_DEVICE_CAP_READ "calendar.read"
32 #define CALENDAR_DEVICE_CAP_WRITE "calendar.write"
33
34 using namespace WrtDeviceApis::Commons;
35
36 namespace TizenApis {
37 namespace Tizen1_0 {
38 namespace Calendar {
39
40 static FunctionMapping createCalendarFunctions();
41
42 static FunctionMapping CalendarFunctions =
43     createCalendarFunctions();
44
45 DEFINE_FUNCTION_GETTER(Calendar, CalendarFunctions);
46
47 static FunctionMapping createCalendarFunctions()
48 {
49     /**
50      * Device capabilities
51      */
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);
54
55     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CALENDAR_READ);
56     ACE_ADD_DEVICE_CAP(DEVICE_LIST_CALENDAR_READ, DEVICE_CAP_CALENDAR_READ);
57
58     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_CALENDAR_WRITE);
59     ACE_ADD_DEVICE_CAP(DEVICE_LIST_CALENDAR_WRITE, DEVICE_CAP_CALENDAR_WRITE);
60
61     /**
62      * Api Features
63      */
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);
67
68     ACE_CREATE_FEATURE_LIST(CALENDAR_FEATURES_CALENDAR_READ_WRITE);
69     ACE_ADD_API_FEATURE(CALENDAR_FEATURES_CALENDAR_READ_WRITE,
70                         FEATURE_CALENDAR);
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);
75
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);
79
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);
84
85     /**
86      * Functions
87      */
88
89     FunctionMapping calendarMapping;
90
91     //getCalendars
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);
97
98     calendarMapping.insert(std::make_pair(
99                                CALENDAR_FUNCTION_API_GET_CALENDARS,
100                                getCalendarsFunc));
101
102     //getDefaultCalendar
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);
108
109     calendarMapping.insert(std::make_pair(
110                                CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR,
111                                getDefaultCalendarFunc));
112
113
114     //find
115     AceFunction findFunc = ACE_CREATE_FUNCTION(
116             FUNCTION_FIND,
117             CALENDAR_FUNCTION_API_FIND,
118             CALENDAR_FEATURES_CALENDAR_READ,
119             DEVICE_LIST_CALENDAR_READ);
120
121     calendarMapping.insert(std::make_pair(
122                                CALENDAR_FUNCTION_API_FIND,
123                                findFunc));
124
125     //add
126     AceFunction addFunc = ACE_CREATE_FUNCTION(
127             FUNCTION_ADD,
128             CALENDAR_FUNCTION_API_ADD,
129             CALENDAR_FEATURES_CALENDAR_WRITE,
130             DEVICE_LIST_CALENDAR_WRITE);
131
132     calendarMapping.insert(std::make_pair(
133                                CALENDAR_FUNCTION_API_ADD,
134                                addFunc));
135
136     //addBatch
137     AceFunction addBatchFunc = ACE_CREATE_FUNCTION(
138             FUNCTION_ADD_BATCH,
139             CALENDAR_FUNCTION_API_ADD_BATCH,
140             CALENDAR_FEATURES_CALENDAR_WRITE,
141             DEVICE_LIST_CALENDAR_WRITE);
142
143     calendarMapping.insert(std::make_pair(
144                                CALENDAR_FUNCTION_API_ADD_BATCH,
145                                addBatchFunc));
146
147     //update
148     AceFunction updateFunc = ACE_CREATE_FUNCTION(
149             FUNCTION_UPDATE,
150             CALENDAR_FUNCTION_API_UPDATE,
151             CALENDAR_FEATURES_CALENDAR_WRITE,
152             DEVICE_LIST_CALENDAR_WRITE);
153
154     calendarMapping.insert(std::make_pair(
155                                CALENDAR_FUNCTION_API_UPDATE,
156                                updateFunc));
157
158     //updateBatch
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);
164
165     calendarMapping.insert(std::make_pair(
166                                CALENDAR_FUNCTION_API_UPDATE_BATCH,
167                                updateBatchFunc));
168
169     //remove
170     AceFunction removeFunc = ACE_CREATE_FUNCTION(
171             FUNCTION_REMOVE,
172             CALENDAR_FUNCTION_API_REMOVE,
173             CALENDAR_FEATURES_CALENDAR_WRITE,
174             DEVICE_LIST_CALENDAR_WRITE);
175
176     calendarMapping.insert(std::make_pair(
177                                CALENDAR_FUNCTION_API_REMOVE,
178                                removeFunc));
179
180     //removeBatch
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);
186
187     calendarMapping.insert(std::make_pair(
188                                CALENDAR_FUNCTION_API_REMOVE_BATCH,
189                                removeBatchFunc));
190
191     //convertFromString
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);
197
198     calendarMapping.insert(std::make_pair(
199                                CALENDAR_FUNCTION_API_CONVERT_FROM_STRING,
200                                convertFromStringFunc));
201
202     //convertToString
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);
208
209     calendarMapping.insert(std::make_pair(
210                                CALENDAR_FUNCTION_API_CONVERT_TO_STRING,
211                                convertToStringFunc));
212
213     //addChangeListener
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);
219
220     calendarMapping.insert(std::make_pair(
221                                CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER,
222                                addChangeListenerFunc));
223
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);
230
231     calendarMapping.insert(std::make_pair(
232                                CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER,
233                                removeChangeListenerFunc));
234
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);
241
242     calendarMapping.insert(std::make_pair(
243                                CALENDAR_FUNCTION_API_EXPAND_EVENT_RECURRENCE,
244                                expandEventRecurrenceFunc));
245
246     return calendarMapping;
247 }
248
249 }
250
251