tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / SystemSetting / 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 #include <map>
19 #include <utility>
20 #include <Commons/FunctionDefinition.h>
21 #include <Commons/FunctionDeclaration.h>
22 #include <Commons/Exception.h>
23 #include "plugin_config.h"
24 #include "plugin_config_impl.h"
25
26 #define SYSTEMSETTING_FEATURE_API "http://tizen.org/privilege/setting"
27 //#define SYSTEMSETTING_FEATURE_API_READ "http://tizen.org/privilege/setting.read"
28 //#define SYSTEMSETTING_FEATURE_API_WRITE "http://tizen.org/privilege/setting.write"
29
30 #define SYSTEMSETTING_DEVICE_CAP "setting"
31 //#define SYSTEMSETTING_DEVICE_CAP_READ "setting"
32 //#define SYSTEMSETTING_DEVICE_CAP_WRITE "setting"
33
34
35 namespace DeviceAPI {
36 namespace SystemSetting {
37
38 static WrtDeviceApis::Commons::FunctionMapping createSystemSettingFunctions();
39
40 static WrtDeviceApis::Commons::FunctionMapping SystemSettingFunctions =
41     createSystemSettingFunctions();
42
43 DEFINE_FUNCTION_GETTER(SystemSetting, SystemSettingFunctions);
44
45 static WrtDeviceApis::Commons::FunctionMapping createSystemSettingFunctions()
46 {
47     using namespace WrtDeviceApis::Commons;
48
49     /**
50      * Device capabilities
51      */
52
53     ACE_CREATE_DEVICE_CAP(DEVICE_CAP_SYSTEMSETTING, SYSTEMSETTING_DEVICE_CAP);
54
55     ACE_CREATE_DEVICE_CAPS_LIST(EMPTY_DEVICE_LIST);
56
57     ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_SYSTEMSETTING);
58     ACE_ADD_DEVICE_CAP(DEVICE_LIST_SYSTEMSETTING, DEVICE_CAP_SYSTEMSETTING);
59
60     /**
61      * Api Features
62      */
63
64     ACE_CREATE_FEATURE(FEATURE_SYSTEMSETTING, SYSTEMSETTING_FEATURE_API);
65
66     ACE_CREATE_FEATURE_LIST(SYSTEMSETTING_FEATURES_SYSTEMSETTING);
67     ACE_ADD_API_FEATURE(SYSTEMSETTING_FEATURES_SYSTEMSETTING, FEATURE_SYSTEMSETTING);
68
69     /**
70     * Functions
71     */
72
73     FunctionMapping SystemSettingFunctions;
74
75     /**  Read  **/
76     AceFunction getPropertyFunc = ACE_CREATE_FUNCTION(
77             FUNCTION_GET_PROPERTY,
78             SYSTEMSETTING_FUNCTION_API_GET_PROPERTY,
79             SYSTEMSETTING_FEATURES_SYSTEMSETTING,
80             DEVICE_LIST_SYSTEMSETTING);
81
82     SystemSettingFunctions.insert( std::make_pair(
83             SYSTEMSETTING_FUNCTION_API_GET_PROPERTY,
84             getPropertyFunc));
85
86     /**  Write  **/
87     AceFunction setPropertyFunc = ACE_CREATE_FUNCTION(
88             FUNCTION_SET_PROPERTY,
89             SYSTEMSETTING_FUNCTION_API_SET_PROPERTY,
90             SYSTEMSETTING_FEATURES_SYSTEMSETTING,
91             DEVICE_LIST_SYSTEMSETTING);
92
93     SystemSettingFunctions.insert( std::make_pair(
94             SYSTEMSETTING_FUNCTION_API_SET_PROPERTY,
95             setPropertyFunc));
96
97     return SystemSettingFunctions;
98 }
99 }
100 }
101
102 #undef SYSTEMSETTING_FEATURE_API
103 #undef SYSTEMSETTING_DEVICE_CAP
104