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"
27 EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
29 int ret = HerePluginInit(plugin);
31 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
33 return ConvertToMapsError(ret);
36 EXPORT_API int maps_plugin_init_module(maps_plugin_h *plugin, const char *module)
38 int ret = HerePluginInit(plugin, module);
40 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
42 return ConvertToMapsError(ret);
45 EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
47 int ret = HerePluginShutdown(plugin);
49 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
51 return ConvertToMapsError(ret);
54 EXPORT_API int maps_plugin_get_info(maps_plugin_info_h* info)
56 int ret = maps_plugin_info_create(info);
58 if (ret == MAPS_ERROR_NONE)
59 ret = maps_plugin_info_set_provider_name(*info, "HERE");
64 EXPORT_API int maps_plugin_set_provider_key(const char* provider_key)
66 int ret = HerePluginSetProviderKey(provider_key);
68 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
70 return ConvertToMapsError(ret);
73 EXPORT_API int maps_plugin_get_provider_key(char** provider_key)
75 int ret = HerePluginGetProviderKey(provider_key);
77 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
79 return ConvertToMapsError(ret);
82 EXPORT_API int maps_plugin_set_preference(maps_preference_h preference)
84 int ret = HerePluginSetPreference(preference);
86 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
88 return ConvertToMapsError(ret);
91 EXPORT_API int maps_plugin_get_preference(maps_preference_h* preference)
93 int ret = HerePluginGetPreference(preference);
95 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
97 return ConvertToMapsError(ret);
100 EXPORT_API int maps_plugin_is_service_supported(maps_service_e service, bool *supported)
103 return MAPS_ERROR_INVALID_PARAMETER;
107 case MAPS_SERVICE_GEOCODE:
108 case MAPS_SERVICE_GEOCODE_INSIDE_AREA:
109 case MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS:
110 case MAPS_SERVICE_REVERSE_GEOCODE:
111 case MAPS_SERVICE_SEARCH_PLACE:
112 case MAPS_SERVICE_SEARCH_PLACE_BY_AREA:
113 case MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS:
114 case MAPS_SERVICE_SEARCH_ROUTE:
115 case MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS:
116 case MAPS_SERVICE_CANCEL_REQUEST:
117 case MAPS_SERVICE_MULTI_REVERSE_GEOCODE:
118 case MAPS_SERVICE_SEARCH_PLACE_LIST:
119 case MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS:
120 case MAPS_SERVICE_VIEW:
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:
150 case MAPS_VIEW_TRAFFIC:
151 case MAPS_VIEW_PUBLIC_TRANSIT:
152 case MAPS_VIEW_SCALEBAR:
155 case MAPS_VIEW_BUILDING:
160 return MAPS_ERROR_NONE;
163 EXPORT_API int maps_plugin_geocode(const char* address, const maps_preference_h preference,
164 maps_service_geocode_cb callback, void *user_data, int* request_id)
166 int ret = HerePluginGeocode(address, preference, callback, user_data, request_id);
168 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
170 return ConvertToMapsError(ret);
173 EXPORT_API int maps_plugin_geocode_inside_area(const char* address, const maps_area_h bounds,
174 const maps_preference_h preference, maps_service_geocode_cb callback,
175 void* user_data, int* request_id)
177 int ret = HerePluginGeocodeInsideArea(address, bounds, preference, callback, user_data, request_id);
179 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
181 return ConvertToMapsError(ret);
184 EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h address,
185 const maps_preference_h preference, maps_service_geocode_cb callback,
186 void *user_data, int* request_id)
188 int ret = HerePluginGeocodeByStructuredAddress(address, preference, callback, user_data, request_id);
190 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
192 return ConvertToMapsError(ret);
195 EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
196 const maps_preference_h preference, maps_service_reverse_geocode_cb callback,
197 void *user_data, int* request_id)
199 int ret = HerePluginReverseGeocode(latitude, longitude, preference, callback, user_data, request_id);
201 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
203 return ConvertToMapsError(ret);
206 EXPORT_API int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h geocode_list,
207 const maps_preference_h preference, maps_service_multi_reverse_geocode_cb callback,
208 void *user_data, int *request_id)
210 int ret = HerePluginMultiReverseGeocode(geocode_list, preference, callback, user_data, request_id);
212 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
214 return ConvertToMapsError(ret);
217 EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position, int distance,
218 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
219 void* user_data, int* request_id)
221 int ret = HerePluginSearchPlace(position, distance, preference, filter, callback, user_data, request_id);
223 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
225 return ConvertToMapsError(ret);
228 EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary,
229 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
230 void* user_data, int* request_id)
232 int ret = HerePluginSearchPlaceByArea(boundary, preference, filter, callback, user_data, request_id);
234 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
236 return ConvertToMapsError(ret);
239 EXPORT_API int maps_plugin_search_place_by_address(const char* address, const maps_area_h boundary,
240 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
241 void* user_data, int* request_id)
243 int ret = HerePluginSearchPlaceByAddress(address, boundary, preference, filter, callback, user_data, request_id);
245 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
247 return ConvertToMapsError(ret);
250 EXPORT_API int maps_plugin_search_place_list(const maps_area_h boundary, const maps_place_filter_h filter,
251 maps_preference_h preference, maps_service_search_place_list_cb callback, void* user_data, int* request_id)
253 int ret = HerePluginSearchPlaceList(boundary, preference, filter, callback, user_data, request_id);
255 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
257 return ConvertToMapsError(ret);
260 EXPORT_API int maps_plugin_get_place_details(const char* url,
261 maps_service_get_place_details_cb callback, void* user_data, int* request_id)
263 int ret = HerePluginSearchPlaceDetails(url, callback, user_data, request_id);
265 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
267 return ConvertToMapsError(ret);
270 EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin, const maps_coordinates_h destination,
271 maps_preference_h preference, maps_service_search_route_cb callback, void* user_data, int* request_id)
273 int ret = HerePluginSearchRoute(origin, destination, preference, callback, user_data, request_id);
275 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
277 return ConvertToMapsError(ret);
280 EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h* waypoint_list, int waypoint_num,
281 maps_preference_h preference, maps_service_search_route_cb callback,
282 void* user_data, int* request_id)
284 int ret = HerePluginSearchRouteWaypoints(waypoint_list, waypoint_num, preference, callback, user_data, request_id);
286 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
288 return ConvertToMapsError(ret);
291 EXPORT_API int maps_plugin_cancel_request(int request_id)
293 int ret = HerePluginCancelRequest(request_id);
295 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
297 return ConvertToMapsError(ret);
301 EXPORT_API int maps_plugin_create_map_view(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc)
303 int ret = HerePluginCreateMapView(hView, pCbFunc);
305 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
307 return ConvertToMapsError(ret);
310 EXPORT_API int maps_plugin_destroy_map_view(maps_view_h hView)
312 int ret = HerePluginDestroyMapView(hView);
314 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
316 return ConvertToMapsError(ret);
319 EXPORT_API int maps_plugin_render_map(maps_view_h hView,
320 const maps_coordinates_h coordinates, double zoom_factor, double rotation_angle)
322 int ret = HerePluginRenderMap(hView, coordinates, zoom_factor, rotation_angle);
324 if (ret != HERE_ERROR_NONE)
325 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
327 return ConvertToMapsError(ret);
330 EXPORT_API int maps_plugin_move_center(maps_view_h hView, int delta_x, int delta_y)
332 int ret = HerePluginMoveCenter(hView, delta_x, delta_y);
334 if (ret != HERE_ERROR_NONE)
335 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
337 return ConvertToMapsError(ret);
340 EXPORT_API int maps_plugin_set_scalebar(maps_view_h hView, bool enable)
342 int ret = HerePluginSetScalebar(hView, enable);
344 if (ret != HERE_ERROR_NONE)
345 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
347 return ConvertToMapsError(ret);
350 EXPORT_API int maps_plugin_get_scalebar(maps_view_h hView, bool *enabled)
352 int ret = HerePluginGetScalebar(hView, enabled);
353 return ConvertToMapsError(ret);
356 EXPORT_API int maps_plugin_on_object(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation)
358 int ret = HerePluginOnViewObject(hView, object, operation);
360 if (ret != HERE_ERROR_NONE)
361 MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
363 return ConvertToMapsError(ret);
366 EXPORT_API int maps_plugin_screen_to_geography(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord)
368 int ret = HerePluginScreenToGeography(hView, x, y, mapsCoord);
369 return ConvertToMapsError(ret);
372 EXPORT_API int maps_plugin_geography_to_screen(maps_view_h hView, const maps_coordinates_h mapsCoord, int* x, int* y)
374 int ret = HerePluginGeographyToScreen(hView, mapsCoord, x, y);
375 return ConvertToMapsError(ret);
378 EXPORT_API int maps_plugin_get_min_zoom_level(maps_view_h hView, int *min_zoom_level)
380 int ret = HerePluginGetMinZoomLevel(hView, min_zoom_level);
381 return ConvertToMapsError(ret);
384 EXPORT_API int maps_plugin_get_max_zoom_level(maps_view_h hView, int *max_zoom_level)
386 int ret = HerePluginGetMaxZoomLevel(hView, max_zoom_level);
387 return ConvertToMapsError(ret);
390 EXPORT_API int maps_plugin_get_center(maps_view_h hView, maps_coordinates_h *center)
392 int ret = HerePluginGetCenter(hView, center);
393 return ConvertToMapsError(ret);
396 } // end of extern "C"