4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 #include "location-log.h"
27 #include "location-types.h"
28 #include "module-internal.h"
29 #include "location-route.h"
30 #include "location-map-ielement.h"
31 #include "map-service.h"
34 map_service_get_geocode (LocationMapIElement *self,
35 const LocationAddress *address,
36 const LocationMapPref *svc_pref,
37 GList **position_list,
38 GList **accuracy_list)
40 LOCATION_LOGD("map_service_get_geocode");
41 MapServicePrivate* priv = GET_PRIVATE(self);
42 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
43 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
44 g_return_val_if_fail (priv->mod->ops.get_geocode, LOCATION_ERROR_NOT_AVAILABLE);
45 return (priv->mod->ops.get_geocode)(priv->mod->handler, address, svc_pref, position_list, accuracy_list);
49 map_service_get_geocode_freeform (LocationMapIElement *self,
51 const LocationMapPref *svc_pref,
52 GList **position_list,
53 GList **accuracy_list)
55 LOCATION_LOGD("map_service_get_geocode_freeform");
56 MapServicePrivate* priv = GET_PRIVATE(self);
57 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
58 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
59 g_return_val_if_fail (priv->mod->ops.get_geocode_freetext, LOCATION_ERROR_NOT_AVAILABLE);
60 return (priv->mod->ops.get_geocode_freetext)(priv->mod->handler, address, svc_pref, position_list, accuracy_list);
64 map_service_get_reversegeocode (LocationMapIElement *self,
65 const LocationPosition *position,
66 const LocationMapPref *svc_pref,
67 LocationAddress **address,
68 LocationAccuracy **accuracy)
70 LOCATION_LOGD("map_service_get_reversegeocode");
71 MapServicePrivate* priv = GET_PRIVATE(self);
72 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
73 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
74 g_return_val_if_fail (priv->mod->ops.get_reverse_geocode, LOCATION_ERROR_NOT_AVAILABLE);
75 return (priv->mod->ops.get_reverse_geocode)(priv->mod->handler, position, svc_pref, address, accuracy);
79 map_service_get_geocode_async (LocationMapIElement *self,
80 const LocationAddress *address,
81 const LocationMapPref *svc_pref,
82 LocationPositionCB callback,
85 LOCATION_LOGD("map_service_get_geocode_async");
86 MapServicePrivate* priv = GET_PRIVATE(self);
87 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
88 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
89 g_return_val_if_fail (priv->mod->ops.get_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
90 return (priv->mod->ops.get_geocode_async)(priv->mod->handler, address, svc_pref, callback, userdata);
94 map_service_get_geocode_freeform_async (LocationMapIElement *self,
96 const LocationMapPref *svc_pref,
97 LocationPositionCB callback,
100 LOCATION_LOGD("map_service_get_geocode_freeform_async");
101 MapServicePrivate* priv = GET_PRIVATE(self);
102 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
103 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
104 g_return_val_if_fail (priv->mod->ops.get_geocode_freetext_async, LOCATION_ERROR_NOT_AVAILABLE);
105 return (priv->mod->ops.get_geocode_freetext_async)(priv->mod->handler, address, svc_pref, callback, userdata);
109 map_service_get_reversegeocode_async (LocationMapIElement *self,
110 const LocationPosition *position,
111 const LocationMapPref *svc_pref,
112 LocationAddressCB callback,
115 LOCATION_LOGD("map_service_get_reversegeocode_async");
116 MapServicePrivate* priv = GET_PRIVATE(self);
117 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
118 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
119 g_return_val_if_fail (priv->mod->ops.get_reverse_geocode_async, LOCATION_ERROR_NOT_AVAILABLE);
120 return (priv->mod->ops.get_reverse_geocode_async)(priv->mod->handler, position, svc_pref, callback, userdata);
124 map_service_search_poi (LocationMapIElement *self,
125 const LocationPOIFilter *filter, const LocationPosition *position,
126 const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
127 LocationPOICB cb, const gpointer user_data, guint *req_id)
129 LOCATION_LOGD("map_service_search_poi");
130 MapServicePrivate* priv = GET_PRIVATE(self);
131 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
132 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
133 g_return_val_if_fail (priv->mod->ops.search_poi, LOCATION_ERROR_NOT_AVAILABLE);
134 return (priv->mod->ops.search_poi)(priv->mod->handler, filter, position, svc_pref, pref, cb, user_data, req_id);
138 map_service_search_poi_by_area (LocationMapIElement *self,
139 const LocationPOIFilter * filter, const LocationBoundary *boundary,
140 const LocationMapPref *svc_pref, const LocationPOIPreference * pref,
141 LocationPOICB cb, const gpointer user_data, guint *req_id)
143 LOCATION_LOGD("map_service_search_poi_by_area");
144 MapServicePrivate* priv = GET_PRIVATE(self);
145 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
146 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
147 g_return_val_if_fail (priv->mod->ops.search_poi_by_area, LOCATION_ERROR_NOT_AVAILABLE);
148 return (priv->mod->ops.search_poi_by_area)(priv->mod->handler, filter, boundary, svc_pref, pref, cb, user_data, req_id);
152 map_service_search_poi_by_address (LocationMapIElement *self,
153 const LocationPOIFilter *filter, const LocationAddress *address,
154 const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
155 LocationPOICB cb, const gpointer user_data, guint *req_id)
157 LOCATION_LOGD("map_service_search_poi_by_address");
158 MapServicePrivate* priv = GET_PRIVATE(self);
159 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
160 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
161 g_return_val_if_fail (priv->mod->ops.search_poi_by_address, LOCATION_ERROR_NOT_AVAILABLE);
162 return (priv->mod->ops.search_poi_by_address)(priv->mod->handler, filter, address, svc_pref, pref, cb, user_data, req_id);
166 map_service_search_poi_by_freeform (LocationMapIElement *self,
167 const LocationPOIFilter *filter, const gchar *freeform,
168 const LocationMapPref *svc_pref, const LocationPOIPreference *pref,
169 LocationPOICB cb, const gpointer user_data, guint *req_id)
171 LOCATION_LOGD("map_service_search_poi_by_freeform");
172 MapServicePrivate* priv = GET_PRIVATE(self);
173 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
174 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
175 g_return_val_if_fail (priv->mod->ops.search_poi_by_freeform, LOCATION_ERROR_NOT_AVAILABLE);
176 return (priv->mod->ops.search_poi_by_freeform)(priv->mod->handler, filter, freeform, svc_pref, pref, cb, user_data, req_id);
180 map_service_cancel_poi_request (LocationMapIElement *self, guint req_id)
182 LOCATION_LOGD("map_service_cancel_poi_request");
183 MapServicePrivate* priv = GET_PRIVATE(self);
184 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
185 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
186 g_return_val_if_fail (priv->mod->ops.cancel_poi_request, LOCATION_ERROR_NOT_AVAILABLE);
187 return (priv->mod->ops.cancel_poi_request)(priv->mod->handler, req_id);
192 map_service_request_route (LocationMapIElement *self,
193 const LocationPosition *origin, const LocationPosition *destination, GList *waypoint,
194 const LocationMapPref *svc_pref, const LocationRoutePreference * pref,
195 LocationRouteCB cb, const gpointer user_data, guint * req_id)
197 LOCATION_LOGD("map_service_request_route");
198 MapServicePrivate* priv = GET_PRIVATE(self);
199 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
200 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
201 g_return_val_if_fail (priv->mod->ops.request_route, LOCATION_ERROR_NOT_AVAILABLE);
203 return (priv->mod->ops.request_route)(priv->mod->handler, origin, destination, waypoint, svc_pref, pref, cb, user_data, req_id);
207 map_service_cancel_route_request (LocationMapIElement *self, guint req_id)
209 LOCATION_LOGD("map_service_cancel_route_request");
210 MapServicePrivate* priv = GET_PRIVATE(self);
211 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
212 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
213 g_return_val_if_fail (priv->mod->ops.cancel_route_request, LOCATION_ERROR_NOT_AVAILABLE);
215 return (priv->mod->ops.cancel_route_request)(priv->mod->handler, req_id);
219 map_service_is_supported_provider_capability (LocationMapIElement *self, LocationMapServiceType type)
221 LOCATION_LOGD("map_service_is_supported_provider_capability");
222 MapServicePrivate* priv = GET_PRIVATE(self);
223 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
224 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
225 g_return_val_if_fail (priv->mod->ops.is_supported_provider_capability, LOCATION_ERROR_NOT_AVAILABLE);
227 return (priv->mod->ops.is_supported_provider_capability)(priv->mod->handler, type);
231 map_service_get_provider_capability_key (LocationMapIElement *self, LocationMapServiceType type, GList **key)
233 LOCATION_LOGD("map_service_get_provider_capability_key");
234 MapServicePrivate* priv = GET_PRIVATE(self);
235 g_return_val_if_fail (priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
236 g_return_val_if_fail (priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
237 g_return_val_if_fail (priv->mod->ops.get_provider_capability_key, LOCATION_ERROR_NOT_AVAILABLE);
239 return (priv->mod->ops.get_provider_capability_key)(priv->mod->handler, type, key);