tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Push / plugin_config.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18
19 #include <Commons/FunctionDefinition.h>
20 #include <Commons/FunctionDeclaration.h>
21 #include <Commons/Exception.h>
22 #include <map>
23
24 #include "plugin_config.h"
25
26 #define PUSH_FEATURE_API "http://tizen.org/privilege/push"
27
28 #define PUSH_DEVICE_CAP "push"
29
30 using namespace WrtDeviceApis::Commons;
31
32 namespace DeviceAPI {
33 namespace Push {
34
35 static FunctionMapping createPushFunctions();
36 static FunctionMapping PushFunctions = createPushFunctions();
37
38 #pragma GCC visibility push(default)
39 DEFINE_FUNCTION_GETTER(Push, PushFunctions);
40 #pragma GCC visibility pop
41
42 static FunctionMapping createPushFunctions()
43 {
44     /**
45      * Device capabilities
46      */
47     ACE_CREATE_DEVICE_CAP(DEVICE_CAP_PUSH, PUSH_DEVICE_CAP);
48
49     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_PUSH);
50     ACE_ADD_DEVICE_CAP(DEVICE_LIST_PUSH, DEVICE_CAP_PUSH);
51
52     /**
53      * Api Features
54      */
55     ACE_CREATE_FEATURE(FEATURE_PUSH, PUSH_FEATURE_API);
56
57     ACE_CREATE_FEATURE_LIST(PUSH_FEATURES);
58     ACE_ADD_API_FEATURE(PUSH_FEATURES, FEATURE_PUSH);
59
60     /**
61      * Functions
62      */
63     FunctionMapping pushMapping;
64
65     // registerService
66     AceFunction registerServiceFunc = ACE_CREATE_FUNCTION(
67             FUNCTION_REGISTER_SERVICE,
68             PUSH_MANAGER_API_REGISTER_SERVICE,
69             PUSH_FEATURES,
70             DEVICE_LIST_PUSH);
71
72     pushMapping.insert(std::make_pair(
73                                PUSH_MANAGER_API_REGISTER_SERVICE,
74                                registerServiceFunc));
75
76     // unregisterService
77     AceFunction unregisterServiceFunc = ACE_CREATE_FUNCTION(
78             FUNCTION_UNREGISTER_SERVICE,
79             PUSH_MANAGER_API_UNREGISTER_SERVICE,
80             PUSH_FEATURES,
81             DEVICE_LIST_PUSH);
82
83     pushMapping.insert(std::make_pair(
84                                PUSH_MANAGER_API_UNREGISTER_SERVICE,
85                                unregisterServiceFunc));
86
87     // connectService
88     AceFunction connectServiceFunc = ACE_CREATE_FUNCTION(
89             FUNCTION_CONNECT_SERVICE,
90             PUSH_MANAGER_API_CONNECT_SERVICE,
91             PUSH_FEATURES,
92             DEVICE_LIST_PUSH);
93
94     pushMapping.insert(std::make_pair(
95                                PUSH_MANAGER_API_CONNECT_SERVICE,
96                                connectServiceFunc));
97
98     // disconnectService
99     AceFunction disconnectServiceFunc = ACE_CREATE_FUNCTION(
100             FUNCTION_DISCONNECT_SERVICE,
101             PUSH_MANAGER_API_DISCONNECT_SERVICE,
102             PUSH_FEATURES,
103             DEVICE_LIST_PUSH);
104
105     pushMapping.insert(std::make_pair(
106                                PUSH_MANAGER_API_DISCONNECT_SERVICE,
107                                disconnectServiceFunc));
108
109     // getRegistrationId
110     AceFunction getRegistrationIdFunc = ACE_CREATE_FUNCTION(
111             FUNCTION_GET_REGISTRATION_ID,
112             PUSH_MANAGER_API_GET_REGISTRATION_ID,
113             PUSH_FEATURES,
114             DEVICE_LIST_PUSH);
115
116     pushMapping.insert(std::make_pair(
117                                PUSH_MANAGER_API_GET_REGISTRATION_ID,
118                                getRegistrationIdFunc));
119
120     // getUnreadNotifications
121     AceFunction getUnreadNotificationsFunc = ACE_CREATE_FUNCTION(
122             FUNCTION_GET_UNREAD_NOTIFICATIONS,
123             PUSH_MANAGER_API_GET_UNREAD_NOTIFICATIONS,
124             PUSH_FEATURES,
125             DEVICE_LIST_PUSH);
126
127     pushMapping.insert(std::make_pair(
128                                PUSH_MANAGER_API_GET_UNREAD_NOTIFICATIONS,
129                                getUnreadNotificationsFunc));
130
131     return pushMapping;
132 }
133
134 } // Push
135 } // DeviceAPI