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.
17 #include <Commons/FunctionDefinition.h>
18 #include <Commons/FunctionDeclaration.h>
23 #define FEATURE_POI_ALL "http://tizen.org/api/poi"
24 #define FEATURE_POI_READ "http://tizen.org/api/poi.read"
25 #define FEATURE_POI_WRITE "http://tizen.org/api/poi.write"
26 #define DEVICE_CAPABILITY_EXT_NET "externalNetworkAccess"
27 #define DEVICE_CAPABILITY_POI_READ "poi.read"
28 #define DEVICE_CAPABILITY_POI_WRITE "poi.write"
31 using namespace WrtDeviceApis::Commons;
37 static AceFunction __create_poi_basic_function();
38 static AceFunction __create_poi_read_function();
39 static AceFunction __create_poi_read_with_net_function();
40 static AceFunction __create_poi_write_function();
41 static AceFunction __create_poi_write_with_net_function();
43 static AceFunction poi_basic_function = __create_poi_basic_function();
44 static AceFunction poi_read_function = __create_poi_read_function();
45 static AceFunction poi_read_with_net_function= __create_poi_read_with_net_function();
46 static AceFunction poi_write_function = __create_poi_write_function();
47 static AceFunction poi_write_with_net_function = __create_poi_write_with_net_function();
49 static AceFunction __create_poi_basic_function()
51 AceFeature poi_feature_all(FEATURE_POI_ALL);
52 AceFeature poi_feature_read(FEATURE_POI_READ);
53 AceFeature poi_feature_write(FEATURE_POI_WRITE);
55 AceDeviceCaps empty_device_caps;
56 AceFeatures executable_feature_list;
57 executable_feature_list.push_back(poi_feature_all);
58 executable_feature_list.push_back(poi_feature_read);
59 executable_feature_list.push_back(poi_feature_write);
62 return {POI_FUNCTION_CATEGORY_BASIC , executable_feature_list, empty_device_caps };
67 static AceFunction __create_poi_read_function()
69 AceFeature poi_feature_all(FEATURE_POI_ALL);
70 AceFeature poi_feature_read(FEATURE_POI_READ);
71 AceDeviceCapability poi_read_cap(DEVICE_CAPABILITY_POI_READ, WrtDeviceApis::Commons::AceDeviceCapParams());
73 AceDeviceCaps required_device_caps;
74 AceFeatures executable_feature_list;
75 executable_feature_list.push_back(poi_feature_all);
76 executable_feature_list.push_back(poi_feature_read);
77 required_device_caps.push_back(poi_read_cap);
79 return {POI_FUNCTION_CATEGORY_READ , executable_feature_list, required_device_caps };
82 static AceFunction __create_poi_read_with_net_function()
84 AceFeature poi_feature_all(FEATURE_POI_ALL);
85 AceFeature poi_feature_read(FEATURE_POI_READ);
86 AceDeviceCapability poi_read_cap(DEVICE_CAPABILITY_POI_READ, WrtDeviceApis::Commons::AceDeviceCapParams());
87 AceDeviceCapability ext_network_cap(DEVICE_CAPABILITY_EXT_NET, WrtDeviceApis::Commons::AceDeviceCapParams());
89 AceDeviceCaps required_device_caps;
90 AceFeatures executable_feature_list;
91 executable_feature_list.push_back(poi_feature_all);
92 executable_feature_list.push_back(poi_feature_read);
93 required_device_caps.push_back(poi_read_cap);
94 required_device_caps.push_back(ext_network_cap);
96 return {POI_FUNCTION_CATEGORY_READ_WITH_NETWORK , executable_feature_list, required_device_caps };
98 static AceFunction __create_poi_write_function()
100 AceFeature poi_feature_all(FEATURE_POI_ALL);
101 AceFeature poi_feature_write(FEATURE_POI_WRITE);
102 AceDeviceCapability poi_write_cap(DEVICE_CAPABILITY_POI_WRITE, WrtDeviceApis::Commons::AceDeviceCapParams());
104 AceDeviceCaps required_device_caps;
105 AceFeatures executable_feature_list;
106 executable_feature_list.push_back(poi_feature_all);
107 executable_feature_list.push_back(poi_feature_write);
108 required_device_caps.push_back(poi_write_cap);
110 return {POI_FUNCTION_CATEGORY_WRITE , executable_feature_list, required_device_caps };
112 static AceFunction __create_poi_write_with_net_function()
114 AceFeature poi_feature_all(FEATURE_POI_ALL);
115 AceFeature poi_feature_write(FEATURE_POI_WRITE);
116 AceDeviceCapability poi_write_cap(DEVICE_CAPABILITY_POI_WRITE, WrtDeviceApis::Commons::AceDeviceCapParams());
117 AceDeviceCapability ext_network_cap(DEVICE_CAPABILITY_EXT_NET, WrtDeviceApis::Commons::AceDeviceCapParams());
119 AceDeviceCaps required_device_caps;
120 AceFeatures executable_feature_list;
121 executable_feature_list.push_back(poi_feature_all);
122 executable_feature_list.push_back(poi_feature_write);
123 required_device_caps.push_back(poi_write_cap);
124 required_device_caps.push_back(ext_network_cap);
126 return {POI_FUNCTION_CATEGORY_WRITE_WITH_NETWORK , executable_feature_list, required_device_caps };
130 AceFunction getPOIFunctionData(const std::string & functionId){
131 if( functionId == POI_FUNCTION_CATEGORY_READ )
132 return poi_read_function;
133 else if( functionId == POI_FUNCTION_CATEGORY_WRITE)
134 return poi_write_function;
135 else if( functionId == POI_FUNCTION_CATEGORY_READ_WITH_NETWORK )
136 return poi_read_with_net_function;
137 else if( functionId == POI_FUNCTION_CATEGORY_WRITE_WITH_NETWORK )
138 return poi_write_with_net_function;
139 else if( functionId == POI_FUNCTION_CATEGORY_BASIC )
140 return poi_basic_function;
141 return AceFunction();