2 * Copyright (c) 2014 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.
20 #include <maps_plugin.h>
22 #include "here_types.h"
23 #include "here_utils.h"
28 EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
30 int ret = HerePluginInit(plugin);
32 MAPS_LOGD("here_error_e = %d", ret);
34 return ConvertToMapsError(ret);
37 EXPORT_API int maps_plugin_init_module(maps_plugin_h *plugin, const char *module)
39 int ret = HerePluginInit(plugin, module);
41 MAPS_LOGD("here_error_e = %d", ret);
43 return ConvertToMapsError(ret);
46 EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
48 int ret = HerePluginShutdown(plugin);
50 MAPS_LOGD("here_error_e = %d", ret);
52 return ConvertToMapsError(ret);
55 EXPORT_API int maps_plugin_get_info(maps_plugin_info_h* info)
57 int ret = maps_plugin_info_create(info);
59 if (ret == MAPS_ERROR_NONE)
60 ret = maps_plugin_info_set_provider_name(*info, "HERE");
65 EXPORT_API int maps_plugin_set_provider_key(const char* provider_key)
67 int ret = HerePluginSetProviderKey(provider_key);
69 MAPS_LOGD("here_error_e = %d", ret);
71 return ConvertToMapsError(ret);
74 EXPORT_API int maps_plugin_get_provider_key(char** provider_key)
76 int ret = HerePluginGetProviderKey(provider_key);
78 MAPS_LOGD("here_error_e = %d", ret);
80 return ConvertToMapsError(ret);
83 EXPORT_API int maps_plugin_set_preference(maps_preference_h preference)
85 int ret = HerePluginSetPreference(preference);
87 MAPS_LOGD("here_error_e = %d", ret);
89 return ConvertToMapsError(ret);
92 EXPORT_API int maps_plugin_get_preference(maps_preference_h* preference)
94 int ret = HerePluginGetPreference(preference);
96 MAPS_LOGD("here_error_e = %d", ret);
98 return ConvertToMapsError(ret);
101 EXPORT_API int maps_plugin_is_service_supported(maps_service_e service, bool *supported)
104 return MAPS_ERROR_INVALID_PARAMETER;
108 case MAPS_SERVICE_GEOCODE:
109 case MAPS_SERVICE_GEOCODE_INSIDE_AREA:
110 case MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS:
111 case MAPS_SERVICE_REVERSE_GEOCODE:
112 case MAPS_SERVICE_SEARCH_PLACE:
113 case MAPS_SERVICE_SEARCH_PLACE_BY_AREA:
114 case MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS:
115 case MAPS_SERVICE_SEARCH_ROUTE:
116 case MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS:
117 case MAPS_SERVICE_CANCEL_REQUEST:
118 case MAPS_SERVICE_MULTI_REVERSE_GEOCODE:
119 case MAPS_SERVICE_SEARCH_PLACE_LIST:
120 case MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS:
127 return MAPS_ERROR_NONE;
130 EXPORT_API int maps_plugin_is_data_supported(maps_service_data_e service, bool *supported)
133 return MAPS_ERROR_INVALID_PARAMETER;
137 case MAPS_PLACE_ADDRESS:
138 case MAPS_PLACE_RATING:
139 case MAPS_PLACE_CATEGORIES:
140 case MAPS_PLACE_ATTRIBUTES:
141 case MAPS_PLACE_CONTACTS:
142 case MAPS_PLACE_EDITORIALS:
143 case MAPS_PLACE_REVIEWS:
144 case MAPS_PLACE_IMAGE:
145 case MAPS_PLACE_SUPPLIER:
146 case MAPS_PLACE_RELATED:
147 case MAPS_ROUTE_PATH:
148 case MAPS_ROUTE_SEGMENTS_PATH:
149 case MAPS_ROUTE_SEGMENTS_MANEUVERS:
156 return MAPS_ERROR_NONE;
159 EXPORT_API int maps_plugin_geocode(const char* address, const maps_preference_h preference,
160 maps_service_geocode_cb callback, void *user_data, int* request_id)
162 int ret = HerePluginGeocode(address, preference, callback, user_data, request_id);
164 MAPS_LOGD("here_error_e = %d", ret);
166 return ConvertToMapsError(ret);
169 EXPORT_API int maps_plugin_geocode_inside_area(const char* address, const maps_area_h bounds,
170 const maps_preference_h preference, maps_service_geocode_cb callback,
171 void* user_data, int* request_id)
173 int ret = HerePluginGeocodeInsideArea(address, bounds, preference, callback, user_data, request_id);
175 MAPS_LOGD("here_error_e = %d", ret);
177 return ConvertToMapsError(ret);
180 EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h address,
181 const maps_preference_h preference, maps_service_geocode_cb callback,
182 void *user_data, int* request_id)
184 int ret = HerePluginGeocodeByStructuredAddress(address, preference, callback, user_data, request_id);
186 MAPS_LOGD("here_error_e = %d", ret);
188 return ConvertToMapsError(ret);
191 EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
192 const maps_preference_h preference, maps_service_reverse_geocode_cb callback,
193 void *user_data, int* request_id)
195 int ret = HerePluginReverseGeocode(latitude, longitude, preference, callback, user_data, request_id);
197 MAPS_LOGD("here_error_e = %d", ret);
199 return ConvertToMapsError(ret);
202 EXPORT_API int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h geocode_list,
203 const maps_preference_h preference, maps_service_multi_reverse_geocode_cb callback,
204 void *user_data, int *request_id)
206 int ret = HerePluginMultiReverseGeocode(geocode_list, preference, callback, user_data, request_id);
208 MAPS_LOGD("here_error_e = %d", ret);
210 return ConvertToMapsError(ret);
213 EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position, int distance,
214 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
215 void* user_data, int* request_id)
217 int ret = HerePluginSearchPlace(position, distance, preference, filter, callback, user_data, request_id);
219 MAPS_LOGD("here_error_e = %d", ret);
221 return ConvertToMapsError(ret);
224 EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary,
225 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
226 void* user_data, int* request_id)
228 int ret = HerePluginSearchPlaceByArea(boundary, preference, filter, callback, user_data, request_id);
230 MAPS_LOGD("here_error_e = %d", ret);
232 return ConvertToMapsError(ret);
235 EXPORT_API int maps_plugin_search_place_by_address(const char* address, const maps_area_h boundary,
236 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
237 void* user_data, int* request_id)
239 int ret = HerePluginSearchPlaceByAddress(address, boundary, preference, filter, callback, user_data, request_id);
241 MAPS_LOGD("here_error_e = %d", ret);
243 return ConvertToMapsError(ret);
246 EXPORT_API int maps_plugin_search_place_list(const maps_area_h boundary, const maps_place_filter_h filter,
247 maps_preference_h preference, maps_service_search_place_list_cb callback, void* user_data, int* request_id)
249 int ret = HerePluginSearchPlaceList(boundary, preference, filter, callback, user_data, request_id);
251 MAPS_LOGD("here_error_e = %d", ret);
253 return ConvertToMapsError(ret);
256 EXPORT_API int maps_plugin_get_place_details(const char* url,
257 maps_service_get_place_details_cb callback, void* user_data, int* request_id)
259 int ret = HerePluginSearchPlaceDetails(url, callback, user_data, request_id);
261 MAPS_LOGD("here_error_e = %d", ret);
263 return ConvertToMapsError(ret);
266 EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin, const maps_coordinates_h destination,
267 maps_preference_h preference, maps_service_search_route_cb callback,
268 void* user_data, int* request_id)
270 int ret = HerePluginSearchRoute(origin, destination, preference, callback, user_data, request_id);
272 MAPS_LOGD("here_error_e = %d", ret);
274 return ConvertToMapsError(ret);
277 EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h* waypoint_list, int waypoint_num,
278 maps_preference_h preference, maps_service_search_route_cb callback,
279 void* user_data, int* request_id)
281 int ret = HerePluginSearchRouteWaypoints(waypoint_list, waypoint_num, preference, callback, user_data, request_id);
283 MAPS_LOGD("here_error_e = %d", ret);
285 return ConvertToMapsError(ret);
288 EXPORT_API int maps_plugin_cancel_request(int request_id)
290 int ret = HerePluginCancelRequest(request_id);
292 MAPS_LOGD("here_error_e = %d", ret);
294 return ConvertToMapsError(ret);
298 EXPORT_API int maps_plugin_set_map_view(const maps_view_h view, maps_plugin_map_view_ready_cb pCbFunc)
300 int ret = HerePluginSetMapView(view, pCbFunc);
302 MAPS_LOGD("here_error_e = %d", ret);
304 return ConvertToMapsError(ret);
307 EXPORT_API int maps_plugin_render_map(const maps_coordinates_h coordinates,
308 const double zoom_factor,
309 const double rotation_angle,
310 maps_plugin_render_map_cb callback,
315 int ret = HerePluginRenderMap(coordinates, zoom_factor, rotation_angle,
316 callback, user_data, request_id);
318 if (ret != HERE_ERROR_NONE)
319 MAPS_LOGD("here_error_e = %d", ret);
321 return ConvertToMapsError(ret);
324 EXPORT_API int maps_plugin_render_map_area(const maps_area_h area,
325 const double zoom_factor,
326 const double rotation_angle,
327 maps_plugin_render_map_cb callback,
331 int ret = HerePluginRenderMapArea(area, zoom_factor, rotation_angle,
332 callback, user_data, request_id);
334 if (ret != HERE_ERROR_NONE)
335 MAPS_LOGD("here_error_e = %d", ret);
337 return ConvertToMapsError(ret);
340 EXPORT_API int maps_plugin_move_center(const int delta_x, const int delta_y,
341 maps_plugin_render_map_cb callback,
345 int ret = HerePluginMoveCenter(delta_x, delta_y,
346 callback, user_data, request_id);
348 if (ret != HERE_ERROR_NONE)
349 MAPS_LOGD("here_error_e = %d", ret);
351 return ConvertToMapsError(ret);
354 EXPORT_API int maps_plugin_set_scalebar(bool enable)
356 int ret = HerePluginSetScalebar(enable);
358 if (ret != HERE_ERROR_NONE)
359 MAPS_LOGD("here_error_e = %d", ret);
361 return ConvertToMapsError(ret);
364 EXPORT_API int maps_plugin_get_scalebar(bool *enabled)
366 int ret = HerePluginGetScalebar(enabled);
367 return ConvertToMapsError(ret);
370 EXPORT_API int maps_plugin_draw_map(Evas* canvas, const int x, const int y,
371 const int width, const int height)
373 int ret = HerePluginDrawMap(canvas, x, y, width, height);
375 if (ret != HERE_ERROR_NONE)
376 MAPS_LOGD("here_error_e = %d", ret);
378 return ConvertToMapsError(ret);
381 EXPORT_API int maps_plugin_get_center(maps_coordinates_h *center)
383 int ret = HerePluginGetCenter(center);
384 return ConvertToMapsError(ret);
387 EXPORT_API int maps_plugin_screen_to_geography(const int x, const int y,
388 maps_coordinates_h *mapsCoord)
390 int ret = HerePluginScreenToGeography(x, y, mapsCoord);
391 return ConvertToMapsError(ret);
394 EXPORT_API int maps_plugin_geography_to_screen(const maps_coordinates_h mapsCoord,
397 int ret = HerePluginGeographyToScreen(mapsCoord, x, y);
398 return ConvertToMapsError(ret);
401 EXPORT_API int maps_plugin_get_min_zoom_level(int *min_zoom_level)
403 int ret = HerePluginGetMinZoomLevel(min_zoom_level);
404 return ConvertToMapsError(ret);
407 EXPORT_API int maps_plugin_get_max_zoom_level(int *max_zoom_level)
409 int ret = HerePluginGetMaxZoomLevel(max_zoom_level);
410 return ConvertToMapsError(ret);
413 EXPORT_API int maps_plugin_on_object(const maps_view_object_h object,
414 const maps_view_object_operation_e operation)
416 int ret = HerePluginOnViewObject(object, operation);
418 if (ret != HERE_ERROR_NONE)
419 MAPS_LOGD("here_error_e = %d", ret);
421 return ConvertToMapsError(ret);
425 } // end of extern "C"