2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <Commons/FunctionDefinition.h>
20 #include <Commons/FunctionDeclaration.h>
21 #include <Commons/Exception.h>
22 #include "plugin_config.h"
24 #define SYSTEMINFO_FEATURE_API "http://tizen.org/api/systeminfo"
26 #define SYSTEMINFO_DEVICE_CAP "systeminfo"
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";
36 static WrtDeviceApis::Commons::FunctionMapping createSysteminfoFunctions();
38 static WrtDeviceApis::Commons::FunctionMapping SysteminfoFunctions =
39 createSysteminfoFunctions();
41 DEFINE_FUNCTION_GETTER(Systeminfo, SysteminfoFunctions);
43 static WrtDeviceApis::Commons::FunctionMapping createSysteminfoFunctions()
45 using namespace WrtDeviceApis::Commons;
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);
51 ACE_ADD_DEVICE_CAP(DEVICE_LIST_SYSTEMINFO, DEVICE_CAP_SYSTEMINFO);
53 ACE_CREATE_FEATURE(FEATURE_SYSTEMINFO, SYSTEMINFO_FEATURE_API);
54 ACE_CREATE_FEATURE_LIST(SYSTEMINFO_FEATURES);
56 ACE_ADD_API_FEATURE(SYSTEMINFO_FEATURES, FEATURE_SYSTEMINFO);
58 FunctionMapping SysteminfoFunctions;
60 AceFunction isSupportedFunc = ACE_CREATE_FUNCTION(
61 FUNCTION_IS_SUPPORTED,
62 SYSTEMINFO_FUNCTION_API_IS_SUPPORTED,
64 DEVICE_LIST_SYSTEMINFO);
66 SysteminfoFunctions.insert(std::make_pair(
67 SYSTEMINFO_FUNCTION_API_IS_SUPPORTED,
71 AceFunction getPropertyValueFunc = ACE_CREATE_FUNCTION(
72 FUNCTION_GET_PROPERTY_VALUE,
73 SYSTEMINFO_FUNCTION_API_GET_PROPERTY_VALUE,
75 DEVICE_LIST_SYSTEMINFO);
77 SysteminfoFunctions.insert(std::make_pair(
78 SYSTEMINFO_FUNCTION_API_GET_PROPERTY_VALUE,
79 getPropertyValueFunc));
82 AceFunction addPropertyValueChangedListenerFunc = ACE_CREATE_FUNCTION(
83 FUNCTION_ADD_PROPERTY_VALUE_CHANGED_LISTENER,
84 SYSTEMINFO_FUNCTION_API_ADD_PROPERTY_VALUE_CHANGED_LISTENER,
86 DEVICE_LIST_SYSTEMINFO);
88 SysteminfoFunctions.insert(std::make_pair(
89 SYSTEMINFO_FUNCTION_API_ADD_PROPERTY_VALUE_CHANGED_LISTENER,
90 addPropertyValueChangedListenerFunc));
93 AceFunction removePropertyChangedListenerFunc = ACE_CREATE_FUNCTION(
94 FUNCTION_REMOVE_PROPERTY_CHANGED_LISTENER,
95 SYSTEMINFO_FUNCTION_API_REMOVE_PROPERTY_CHANGED_LISTENER,
97 DEVICE_LIST_SYSTEMINFO);
99 SysteminfoFunctions.insert(std::make_pair(
100 SYSTEMINFO_FUNCTION_API_REMOVE_PROPERTY_CHANGED_LISTENER,
101 removePropertyChangedListenerFunc));
103 return SysteminfoFunctions;
108 #undef SYSTEMINFO_FEATURE_API