2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <Commons/FunctionDefinition.h>
20 #include <Commons/FunctionDeclaration.h>
21 #include <Commons/Exception.h>
24 #include "plugin_config.h"
26 #define PUSH_FEATURE_API "http://tizen.org/privilege/push"
28 #define PUSH_DEVICE_CAP "push"
30 using namespace WrtDeviceApis::Commons;
35 static FunctionMapping createPushFunctions();
36 static FunctionMapping PushFunctions = createPushFunctions();
38 #pragma GCC visibility push(default)
39 DEFINE_FUNCTION_GETTER(Push, PushFunctions);
40 #pragma GCC visibility pop
42 static FunctionMapping createPushFunctions()
47 ACE_CREATE_DEVICE_CAP(DEVICE_CAP_PUSH, PUSH_DEVICE_CAP);
49 ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_PUSH);
50 ACE_ADD_DEVICE_CAP(DEVICE_LIST_PUSH, DEVICE_CAP_PUSH);
55 ACE_CREATE_FEATURE(FEATURE_PUSH, PUSH_FEATURE_API);
57 ACE_CREATE_FEATURE_LIST(PUSH_FEATURES);
58 ACE_ADD_API_FEATURE(PUSH_FEATURES, FEATURE_PUSH);
63 FunctionMapping pushMapping;
66 AceFunction registerServiceFunc = ACE_CREATE_FUNCTION(
67 FUNCTION_REGISTER_SERVICE,
68 PUSH_MANAGER_API_REGISTER_SERVICE,
72 pushMapping.insert(std::make_pair(
73 PUSH_MANAGER_API_REGISTER_SERVICE,
74 registerServiceFunc));
77 AceFunction unregisterServiceFunc = ACE_CREATE_FUNCTION(
78 FUNCTION_UNREGISTER_SERVICE,
79 PUSH_MANAGER_API_UNREGISTER_SERVICE,
83 pushMapping.insert(std::make_pair(
84 PUSH_MANAGER_API_UNREGISTER_SERVICE,
85 unregisterServiceFunc));
88 AceFunction connectServiceFunc = ACE_CREATE_FUNCTION(
89 FUNCTION_CONNECT_SERVICE,
90 PUSH_MANAGER_API_CONNECT_SERVICE,
94 pushMapping.insert(std::make_pair(
95 PUSH_MANAGER_API_CONNECT_SERVICE,
99 AceFunction disconnectServiceFunc = ACE_CREATE_FUNCTION(
100 FUNCTION_DISCONNECT_SERVICE,
101 PUSH_MANAGER_API_DISCONNECT_SERVICE,
105 pushMapping.insert(std::make_pair(
106 PUSH_MANAGER_API_DISCONNECT_SERVICE,
107 disconnectServiceFunc));
110 AceFunction getRegistrationIdFunc = ACE_CREATE_FUNCTION(
111 FUNCTION_GET_REGISTRATION_ID,
112 PUSH_MANAGER_API_GET_REGISTRATION_ID,
116 pushMapping.insert(std::make_pair(
117 PUSH_MANAGER_API_GET_REGISTRATION_ID,
118 getRegistrationIdFunc));
120 // getUnreadNotifications
121 AceFunction getUnreadNotificationsFunc = ACE_CREATE_FUNCTION(
122 FUNCTION_GET_UNREAD_NOTIFICATIONS,
123 PUSH_MANAGER_API_GET_UNREAD_NOTIFICATIONS,
127 pushMapping.insert(std::make_pair(
128 PUSH_MANAGER_API_GET_UNREAD_NOTIFICATIONS,
129 getUnreadNotificationsFunc));