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)
31 return MAPS_ERROR_INVALID_PARAMETER;
33 int ret = HerePluginInit(plugin);
35 MAPS_LOGD("here_error_e = %d", ret);
37 return ConvertToMapsError(ret);
40 EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
43 return MAPS_ERROR_INVALID_PARAMETER;
45 int ret = HerePluginShutdown(plugin);
47 MAPS_LOGD("here_error_e = %d", ret);
49 return ConvertToMapsError(ret);
52 EXPORT_API int maps_plugin_get_info(maps_plugin_info_h* info)
55 return MAPS_ERROR_INVALID_PARAMETER;
57 maps_plugin_info_create(info);
58 maps_plugin_info_set_provider_name(*info, "HERE");
60 return MAPS_ERROR_NONE;
63 EXPORT_API int maps_plugin_set_provider_key(const char* provider_key)
66 return MAPS_ERROR_INVALID_PARAMETER;
68 int ret = HerePluginSetProviderKey(provider_key);
70 MAPS_LOGD("here_error_e = %d", ret);
72 return ConvertToMapsError(ret);
75 EXPORT_API int maps_plugin_get_provider_key(char** provider_key)
78 return MAPS_ERROR_INVALID_PARAMETER;
80 int ret = HerePluginGetProviderKey(provider_key);
82 MAPS_LOGD("here_error_e = %d", ret);
84 return ConvertToMapsError(ret);
87 EXPORT_API int maps_plugin_set_preference(maps_preference_h preference)
90 return MAPS_ERROR_INVALID_PARAMETER;
92 int ret = HerePluginSetPreference(preference);
94 MAPS_LOGD("here_error_e = %d", ret);
96 return ConvertToMapsError(ret);
99 EXPORT_API int maps_plugin_get_preference(maps_preference_h* preference)
102 return MAPS_ERROR_INVALID_PARAMETER;
104 int ret = HerePluginGetPreference(preference);
106 MAPS_LOGD("here_error_e = %d", ret);
108 return ConvertToMapsError(ret);
111 EXPORT_API int maps_plugin_is_service_supported(maps_service_e service, bool *supported)
114 return MAPS_ERROR_INVALID_PARAMETER;
118 case MAPS_SERVICE_GEOCODE:
119 case MAPS_SERVICE_GEOCODE_INSIDE_AREA:
120 case MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS:
121 case MAPS_SERVICE_REVERSE_GEOCODE:
122 case MAPS_SERVICE_SEARCH_PLACE:
123 case MAPS_SERVICE_SEARCH_PLACE_BY_AREA:
124 case MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS:
125 case MAPS_SERVICE_SEARCH_ROUTE:
126 case MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS:
127 case MAPS_SERVICE_CANCEL_REQUEST:
129 return MAPS_ERROR_NONE;
132 return MAPS_ERROR_NOT_SUPPORTED;
136 EXPORT_API int maps_plugin_is_data_supported(maps_service_data_e service, bool *supported)
139 return MAPS_ERROR_INVALID_PARAMETER;
143 case MAPS_PLACE_ADDRESS:
144 case MAPS_PLACE_RATING:
145 case MAPS_PLACE_CATEGORIES:
146 case MAPS_PLACE_ATTRIBUTES:
147 case MAPS_PLACE_CONTACTS:
148 case MAPS_PLACE_EDITORIALS:
149 case MAPS_PLACE_REVIEWS:
150 case MAPS_PLACE_IMAGE:
151 case MAPS_PLACE_SUPPLIER:
152 case MAPS_PLACE_RELATED:
153 case MAPS_ROUTE_PATH:
154 case MAPS_ROUTE_SEGMENTS_PATH:
155 case MAPS_ROUTE_SEGMENTS_MANEUVERS:
157 return MAPS_ERROR_NONE;
160 return MAPS_ERROR_NOT_SUPPORTED;
164 EXPORT_API int maps_plugin_geocode(const char* address, const maps_preference_h preference,
165 maps_service_geocode_cb callback, void *user_data, int* request_id)
167 if (!address || !callback || !request_id)
168 return MAPS_ERROR_INVALID_PARAMETER;
170 int ret = HerePluginGeocode(address, preference, callback, user_data, request_id);
172 MAPS_LOGD("here_error_e = %d", ret);
174 return ConvertToMapsError(ret);
177 EXPORT_API int maps_plugin_geocode_inside_area(const char* address, const maps_area_h bounds,
178 const maps_preference_h preference, maps_service_geocode_cb callback,
179 void* user_data, int* request_id)
181 if (!bounds || !address || !callback || !request_id)
182 return MAPS_ERROR_INVALID_PARAMETER;
184 int ret = HerePluginGeocodeInsideArea(address, bounds, preference, callback, user_data, request_id);
186 MAPS_LOGD("here_error_e = %d", ret);
188 return ConvertToMapsError(ret);
191 EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h address,
192 const maps_preference_h preference, maps_service_geocode_cb callback,
193 void *user_data, int* request_id)
195 if (!address || !callback || !request_id)
196 return MAPS_ERROR_INVALID_PARAMETER;
198 int ret = HerePluginGeocodeByStructuredAddress(address, preference, callback, user_data, request_id);
200 MAPS_LOGD("here_error_e = %d", ret);
202 return ConvertToMapsError(ret);
205 EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
206 const maps_preference_h preference, maps_service_reverse_geocode_cb callback,
207 void *user_data, int* request_id)
209 if (!callback || !request_id)
210 return MAPS_ERROR_INVALID_PARAMETER;
212 int ret = HerePluginReverseGeocode(latitude, longitude, preference, callback, user_data, request_id);
214 MAPS_LOGD("here_error_e = %d", ret);
216 return ConvertToMapsError(ret);
219 EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position, int distance,
220 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
221 void* user_data, int* request_id)
223 if (!position || !filter || !callback || !request_id)
224 return MAPS_ERROR_INVALID_PARAMETER;
226 int ret = HerePluginSearchPlace(position, distance, preference, filter, callback, user_data, request_id);
228 MAPS_LOGD("here_error_e = %d", ret);
230 return ConvertToMapsError(ret);
233 EXPORT_API int maps_plugin_search_place_by_area(const maps_area_h boundary,
234 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
235 void* user_data, int* request_id)
237 if (!boundary || !filter || !callback || !request_id)
238 return MAPS_ERROR_INVALID_PARAMETER;
240 int ret = HerePluginSearchPlaceByArea(boundary, preference, filter, callback, user_data, request_id);
242 MAPS_LOGD("here_error_e = %d", ret);
244 return ConvertToMapsError(ret);
247 EXPORT_API int maps_plugin_search_place_by_address(const char* address, const maps_area_h boundary,
248 const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
249 void* user_data, int* request_id)
251 if (!address || !boundary || !filter || !callback || !request_id)
252 return MAPS_ERROR_INVALID_PARAMETER;
254 int ret = HerePluginSearchPlaceByAddress(address, boundary, preference, filter, callback, user_data, request_id);
256 MAPS_LOGD("here_error_e = %d", ret);
258 return ConvertToMapsError(ret);
261 EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin, const maps_coordinates_h destination,
262 maps_preference_h preference, maps_service_search_route_cb callback,
263 void* user_data, int* request_id)
265 if (!origin || !destination || !callback || !request_id)
266 return MAPS_ERROR_INVALID_PARAMETER;
268 int ret = HerePluginSearchRoute(origin, destination, preference, callback, user_data, request_id);
270 MAPS_LOGD("here_error_e = %d", ret);
272 return ConvertToMapsError(ret);
275 EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h* waypoint_list, int waypoint_num,
276 maps_preference_h preference, maps_service_search_route_cb callback,
277 void* user_data, int* request_id)
279 if (!waypoint_list || waypoint_num <= 0 || !callback || !request_id)
280 return MAPS_ERROR_INVALID_PARAMETER;
282 int ret = HerePluginSearchRouteWaypoints(waypoint_list, waypoint_num, preference, callback, user_data, request_id);
284 MAPS_LOGD("here_error_e = %d", ret);
286 return ConvertToMapsError(ret);
289 EXPORT_API int maps_plugin_cancel_request(int request_id)
292 return MAPS_ERROR_INVALID_PARAMETER;
294 int ret = HerePluginCancelRequest(request_id);
296 MAPS_LOGD("here_error_e = %d", ret);
298 return ConvertToMapsError(ret);
301 } // end of extern "C"