upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / POI / POIAce.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 <Commons/FunctionDefinition.h>
18 #include <Commons/FunctionDeclaration.h>
19 #include <iostream>
20 #include <vector>
21 #include "POIAce.h"
22
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"
29
30
31 using namespace WrtDeviceApis::Commons;
32
33 namespace TizenApis {
34 namespace Tizen1_0 {
35 namespace LBS {
36
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();
42
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();
48
49 static AceFunction __create_poi_basic_function()
50 {
51         AceFeature poi_feature_all(FEATURE_POI_ALL);
52         AceFeature poi_feature_read(FEATURE_POI_READ);
53         AceFeature poi_feature_write(FEATURE_POI_WRITE);        
54
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);   
60
61         
62         return {POI_FUNCTION_CATEGORY_BASIC , executable_feature_list, empty_device_caps };
63 }
64
65
66
67 static AceFunction __create_poi_read_function()
68 {
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());
72
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);
78
79         return {POI_FUNCTION_CATEGORY_READ , executable_feature_list, required_device_caps };
80 }
81
82 static AceFunction __create_poi_read_with_net_function()
83 {
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());
88
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);        
95
96         return {POI_FUNCTION_CATEGORY_READ_WITH_NETWORK , executable_feature_list, required_device_caps };
97 }
98 static AceFunction __create_poi_write_function()
99 {
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());
103
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);
109
110         return {POI_FUNCTION_CATEGORY_WRITE , executable_feature_list, required_device_caps };
111 }
112 static AceFunction __create_poi_write_with_net_function()
113 {
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());
118
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);        
125
126         return {POI_FUNCTION_CATEGORY_WRITE_WITH_NETWORK , executable_feature_list, required_device_caps };
127 }
128
129
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();
142 }
143         
144 } //LBS
145 } // Tizen1_0
146 } //TizenApis
147
148