Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Systeminfo / 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 #include <map>
18 #include <utility>
19 #include <Commons/FunctionDefinition.h>
20 #include <Commons/FunctionDeclaration.h>
21 #include <Commons/Exception.h>
22 #include "plugin_config.h"
23
24 #define SYSTEMINFO_FEATURE_API "http://tizen.org/api/systeminfo"
25
26 #define SYSTEMINFO_DEVICE_CAP "systeminfo"
27
28 namespace TizenApis {
29 namespace Tizen1_0 {
30
31 const char* SYSTEMINFO_FUNCTION_API_IS_SUPPORTED = "isSupported";
32 const char* SYSTEMINFO_FUNCTION_API_GET_PROPERTY_VALUE = "getPropertyValue";
33 const char* SYSTEMINFO_FUNCTION_API_ADD_PROPERTY_VALUE_CHANGED_LISTENER = "addPropertyValueChangedListener";
34 const char* SYSTEMINFO_FUNCTION_API_REMOVE_PROPERTY_CHANGED_LISTENER = "removePropertyChangedListener";
35
36 static WrtDeviceApis::Commons::FunctionMapping createSysteminfoFunctions();
37
38 static WrtDeviceApis::Commons::FunctionMapping SysteminfoFunctions =
39     createSysteminfoFunctions();
40
41 DEFINE_FUNCTION_GETTER(Systeminfo, SysteminfoFunctions);
42
43 static WrtDeviceApis::Commons::FunctionMapping createSysteminfoFunctions()
44 {
45     using namespace WrtDeviceApis::Commons;
46
47     ACE_CREATE_DEVICE_CAP(DEVICE_CAP_SYSTEMINFO, SYSTEMINFO_DEVICE_CAP);
48     ACE_CREATE_DEVICE_CAPS_LIST(EMPTY_DEVICE_LIST);
49     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_SYSTEMINFO);
50
51     ACE_ADD_DEVICE_CAP(DEVICE_LIST_SYSTEMINFO, DEVICE_CAP_SYSTEMINFO);
52
53     ACE_CREATE_FEATURE(FEATURE_SYSTEMINFO, SYSTEMINFO_FEATURE_API);
54     ACE_CREATE_FEATURE_LIST(SYSTEMINFO_FEATURES);
55
56     ACE_ADD_API_FEATURE(SYSTEMINFO_FEATURES, FEATURE_SYSTEMINFO);
57
58     FunctionMapping SysteminfoFunctions;
59
60     AceFunction isSupportedFunc = ACE_CREATE_FUNCTION(
61         FUNCTION_IS_SUPPORTED,
62         SYSTEMINFO_FUNCTION_API_IS_SUPPORTED,
63         SYSTEMINFO_FEATURES,
64         DEVICE_LIST_SYSTEMINFO);
65
66     SysteminfoFunctions.insert(std::make_pair(
67         SYSTEMINFO_FUNCTION_API_IS_SUPPORTED,
68         isSupportedFunc));
69
70
71     AceFunction getPropertyValueFunc = ACE_CREATE_FUNCTION(
72         FUNCTION_GET_PROPERTY_VALUE,
73         SYSTEMINFO_FUNCTION_API_GET_PROPERTY_VALUE,
74         SYSTEMINFO_FEATURES,
75         DEVICE_LIST_SYSTEMINFO);
76
77     SysteminfoFunctions.insert(std::make_pair(
78         SYSTEMINFO_FUNCTION_API_GET_PROPERTY_VALUE,
79         getPropertyValueFunc));
80
81
82     AceFunction addPropertyValueChangedListenerFunc = ACE_CREATE_FUNCTION(
83         FUNCTION_ADD_PROPERTY_VALUE_CHANGED_LISTENER,
84         SYSTEMINFO_FUNCTION_API_ADD_PROPERTY_VALUE_CHANGED_LISTENER,
85         SYSTEMINFO_FEATURES,
86         DEVICE_LIST_SYSTEMINFO);
87
88     SysteminfoFunctions.insert(std::make_pair(
89         SYSTEMINFO_FUNCTION_API_ADD_PROPERTY_VALUE_CHANGED_LISTENER,
90         addPropertyValueChangedListenerFunc));
91
92
93     AceFunction removePropertyChangedListenerFunc = ACE_CREATE_FUNCTION(
94         FUNCTION_REMOVE_PROPERTY_CHANGED_LISTENER,
95         SYSTEMINFO_FUNCTION_API_REMOVE_PROPERTY_CHANGED_LISTENER,
96         SYSTEMINFO_FEATURES,
97         DEVICE_LIST_SYSTEMINFO);
98
99     SysteminfoFunctions.insert(std::make_pair(
100         SYSTEMINFO_FUNCTION_API_REMOVE_PROPERTY_CHANGED_LISTENER,
101         removePropertyChangedListenerFunc));
102
103     return SysteminfoFunctions;
104 }
105 }
106 }
107
108 #undef SYSTEMINFO_FEATURE_API