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.
18 #include "maps_service.h"
19 #include "maps_error.h"
20 #include "maps_service.h"
21 #include "maps_util.h"
22 #include "maps_condition.h"
24 #include "command_queue.h"
26 #include "discovery.h"
29 /*----------------------------------------------------------------------------*/
30 /* Structure of maps_service */
31 /* maps_service_s* is used as maps_service_h */
32 typedef struct _maps_service_s
37 const gsize _MAPS_PROVIDER_KEY_MAX_LENGTH = 1024;
39 /* This function is used in command class */
40 plugin::plugin_s *__extract_plugin(maps_service_h maps)
44 maps_service_s *maps_service = (maps_service_s *) maps;
45 return (plugin::plugin_s *) maps_service->plugin;
48 static bool __maps_provider_supported(maps_service_h maps, maps_service_e service)
52 bool supported = false;
53 if (maps_service_provider_is_service_supported(maps, service, &supported)
60 /*----------------------------------------------------------------------------*/
62 /* Maps Service & Preference */
64 EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb callback,
67 if (!maps_condition_check_maps_feature())
68 return MAPS_ERROR_NOT_SUPPORTED;
70 return MAPS_ERROR_INVALID_PARAMETER;
72 /* The list of map provider info, obtained by enumerating available plugins */
74 vector <plugin::provider_info> v = pd.get_available_list();
76 /* Send obtained provider info to the user */
77 const int total = int(v.size());
78 for (int i = 0; i < total; i++) {
79 /* Get a plugin info handle from the array */
80 /* and send a callback with provider info to the user */
81 char *provider = g_strdup(v[i].provider.c_str());
82 if (!callback(provider, user_data))
86 return MAPS_ERROR_NONE;
89 EXPORT_API int maps_service_request_user_consent(const char *maps_provider,
90 maps_service_request_user_consent_cb callback, void *user_data)
92 if (!maps_condition_check_maps_feature())
93 return MAPS_ERROR_NOT_SUPPORTED;
94 /* Check if parameters are valid */
95 if (!maps_provider || !callback)
96 return MAPS_ERROR_INVALID_PARAMETER;
98 /* Check if privileges enough */
99 if (!maps_condition_check_privilege())
100 return MAPS_ERROR_PERMISSION_DENIED;
102 int error = plugin::request_user_consent(maps_provider, (void*)callback, user_data);
106 EXPORT_API int maps_service_create(const char *maps_provider, maps_service_h *maps)
108 if (!maps_condition_check_maps_feature())
109 return MAPS_ERROR_NOT_SUPPORTED;
110 if (!maps || !maps_provider)
111 return MAPS_ERROR_INVALID_PARAMETER;
112 if (!maps_condition_check_privilege()) {
113 MAPS_LOGD("ERROR: privilege is not included");
114 return MAPS_ERROR_PERMISSION_DENIED;
117 int error = MAPS_ERROR_NOT_SUPPORTED;
118 char *provider = NULL, *module = NULL;
121 /* 0. Find the plugin, requested by the user */
122 plugin::split_provider_name(maps_provider, &provider, &module);
123 const plugin::provider_info info = plugin::find_by_names(provider);
125 /* 1. Check whether provider info is valid */
127 MAPS_LOGE("ERROR! Provider info not found for name: %s", maps_provider);
128 error = MAPS_ERROR_NOT_SUPPORTED;
132 /* 2. Setup maps service handling structure */
133 maps_service_s *maps_service = g_slice_new0(maps_service_s);
135 if (maps_service == NULL) {
136 MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
137 error = MAPS_ERROR_OUT_OF_MEMORY;
141 /* 3. Initialize the requested plugin */
142 int init_error = MAPS_ERROR_NONE; /* Storage for init error code */
143 maps_plugin_h plugin_h = plugin::binary_extractor().init(info, module, &init_error);
146 MAPS_LOGE("ERROR! Plugin init failed");
150 maps_service->plugin = plugin_h;
152 /* 4. Initialize an output pointer to maps service */
153 *maps = maps_service;
155 /* 5. Set status of completely correct plugin initialization */
156 error = MAPS_ERROR_NONE;
159 if (error != MAPS_ERROR_NONE)
160 maps_service_destroy(*maps);
167 EXPORT_API int maps_service_destroy(maps_service_h maps)
169 if (!maps_condition_check_maps_feature())
170 return MAPS_ERROR_NOT_SUPPORTED;
172 return MAPS_ERROR_INVALID_PARAMETER;
173 if (!maps_condition_check_privilege())
174 return MAPS_ERROR_PERMISSION_DENIED;
176 maps_service_s *maps_service = (maps_service_s *) maps;
178 if (maps_service->plugin)
179 plugin::binary_extractor().shutdown(maps_service->plugin);
181 g_slice_free(maps_service_s, maps);
183 return MAPS_ERROR_NONE;
186 EXPORT_API int maps_service_set_provider_key(maps_service_h maps,
187 const char *provider_key)
189 if (!maps_condition_check_maps_feature())
190 return MAPS_ERROR_NOT_SUPPORTED;
191 if (!maps || !provider_key)
192 return MAPS_ERROR_INVALID_PARAMETER;
194 const plugin::plugin_s *p = __extract_plugin(maps);
196 return MAPS_ERROR_INVALID_PARAMETER;
197 return p->interface.maps_plugin_set_provider_key(provider_key);
200 EXPORT_API int maps_service_get_provider_key(const maps_service_h maps,
203 if (!maps_condition_check_maps_feature())
204 return MAPS_ERROR_NOT_SUPPORTED;
205 if (!maps || !provider_key)
206 return MAPS_ERROR_INVALID_PARAMETER;
208 const plugin::plugin_s *p = __extract_plugin(maps);
210 return MAPS_ERROR_INVALID_PARAMETER;
211 return p->interface.maps_plugin_get_provider_key(provider_key);
214 EXPORT_API int maps_service_set_preference(maps_service_h maps,
215 maps_string_hashtable_h preference)
217 if (!maps_condition_check_maps_feature())
218 return MAPS_ERROR_NOT_SUPPORTED;
219 if (!maps || !preference)
220 return MAPS_ERROR_INVALID_PARAMETER;
222 const plugin::plugin_s *p = __extract_plugin(maps);
224 return MAPS_ERROR_INVALID_PARAMETER;
225 return p->interface.maps_plugin_set_preference(preference);
228 EXPORT_API int maps_service_get_preference(maps_service_h maps,
229 maps_string_hashtable_h *preference)
231 if (!maps_condition_check_maps_feature())
232 return MAPS_ERROR_NOT_SUPPORTED;
233 if (!maps || !preference)
234 return MAPS_ERROR_INVALID_PARAMETER;
236 const plugin::plugin_s *p = __extract_plugin(maps);
238 return MAPS_ERROR_INVALID_PARAMETER;
239 return p->interface.maps_plugin_get_preference(preference);
242 EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h maps,
243 maps_service_e service,
246 if (!maps_condition_check_maps_feature())
247 return MAPS_ERROR_NOT_SUPPORTED;
248 if (!maps || !supported)
249 return MAPS_ERROR_INVALID_PARAMETER;
250 if (!(service >= MAPS_SERVICE_GEOCODE && service <= MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS) &&
251 !(service >= MAPS_SERVICE_VIEW && service <= MAPS_SERVICE_VIEW_SNAPSHOT))
252 return MAPS_ERROR_INVALID_PARAMETER;
254 const plugin::plugin_s *p = __extract_plugin(maps);
256 return MAPS_ERROR_NOT_SUPPORTED;
257 return p->interface.maps_plugin_is_service_supported(service, supported);
260 EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h maps,
261 maps_service_data_e data,
264 if (!maps_condition_check_maps_feature())
265 return MAPS_ERROR_NOT_SUPPORTED;
266 if (!maps || !supported)
267 return MAPS_ERROR_INVALID_PARAMETER;
268 if (!(data >= MAPS_PLACE_ADDRESS && data <= MAPS_ROUTE_SEGMENTS_MANEUVERS) &&
269 !(data >= MAPS_VIEW_TRAFFIC && data <= MAPS_VIEW_SCALEBAR))
270 return MAPS_ERROR_INVALID_PARAMETER;
272 const plugin::plugin_s *p = __extract_plugin(maps);
274 return MAPS_ERROR_NOT_SUPPORTED;
275 return p->interface.maps_plugin_is_data_supported(data, supported);
278 /*----------------------------------------------------------------------------*/
280 /* Geocoder Service */
282 EXPORT_API int maps_service_geocode(const maps_service_h maps,
284 const maps_preference_h preference,
285 maps_service_geocode_cb callback,
289 /* Check if internet feature is supported */
290 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
291 return MAPS_ERROR_NOT_SUPPORTED;
293 /* Check if the handle of the Maps Service is valid */
295 return MAPS_ERROR_INVALID_PARAMETER;
297 /* Check if this API feature available */
298 if (!__maps_provider_supported(maps, MAPS_SERVICE_GEOCODE))
299 return MAPS_ERROR_NOT_SUPPORTED;
301 /* Check if parameters are valid */
302 if (!address || !callback || !request_id)
303 return MAPS_ERROR_INVALID_PARAMETER;
305 /* Check if privileges enough */
306 if (!maps_condition_check_privilege())
307 return MAPS_ERROR_PERMISSION_DENIED;
309 session::command *cmd = new session::command_geocode(maps, address, preference,
310 callback, user_data, request_id);
312 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
313 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
317 EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
319 const maps_area_h bounds,
320 const maps_preference_h preference,
321 maps_service_geocode_cb callback,
322 void *user_data, int *request_id)
324 /* Check if internet feature is supported */
325 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
326 return MAPS_ERROR_NOT_SUPPORTED;
328 /* Check if the handle of the Maps Service is valid */
330 return MAPS_ERROR_INVALID_PARAMETER;
332 /* Check if this API feature available */
333 if (!__maps_provider_supported(maps,
334 MAPS_SERVICE_GEOCODE_INSIDE_AREA))
335 return MAPS_ERROR_NOT_SUPPORTED;
337 /* Check if parameters are valid */
338 if (!address || !bounds || !callback || !request_id)
339 return MAPS_ERROR_INVALID_PARAMETER;
341 /* Check if privileges enough */
342 if (!maps_condition_check_privilege())
343 return MAPS_ERROR_PERMISSION_DENIED;
345 session::command *cmd = new session::command_geocode_inside_bounds(maps,
346 address, bounds, preference, callback, user_data, request_id);
348 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
349 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
353 EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h maps,
354 const maps_address_h address,
355 const maps_preference_h preference,
356 maps_service_geocode_cb callback,
357 void *user_data, int *request_id)
359 /* Check if internet feature is supported */
360 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
361 return MAPS_ERROR_NOT_SUPPORTED;
363 /* Check if the handle of the Maps Service is valid */
365 return MAPS_ERROR_INVALID_PARAMETER;
367 /* Check if this API feature available */
368 if (!__maps_provider_supported(maps,
369 MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS))
370 return MAPS_ERROR_NOT_SUPPORTED;
372 /* Check if parameters are valid */
373 if (!address || !callback || !request_id)
374 return MAPS_ERROR_INVALID_PARAMETER;
376 /* Check if privileges enough */
377 if (!maps_condition_check_privilege())
378 return MAPS_ERROR_PERMISSION_DENIED;
380 session::command *cmd = new session::command_geocode_by_structured_address(maps,
381 address, preference, callback, user_data, request_id);
383 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
384 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
388 EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
389 double latitude, double longitude,
390 const maps_preference_h preference,
391 maps_service_reverse_geocode_cb
392 callback, void * user_data,
395 /* Check if internet feature is supported */
396 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
397 return MAPS_ERROR_NOT_SUPPORTED;
399 /* Check if the handle of the Maps Service is valid */
401 return MAPS_ERROR_INVALID_PARAMETER;
403 /* Check if this API feature available */
404 if (!__maps_provider_supported(maps, MAPS_SERVICE_REVERSE_GEOCODE))
405 return MAPS_ERROR_NOT_SUPPORTED;
407 /* Check if parameters are valid */
408 if (!callback || !request_id)
409 return MAPS_ERROR_INVALID_PARAMETER;
410 if (latitude <= -90 || latitude >= 90)
411 return MAPS_ERROR_INVALID_PARAMETER;
412 if (longitude <= -180 || longitude >= 180)
413 return MAPS_ERROR_INVALID_PARAMETER;
415 /* Check if privileges enough */
416 if (!maps_condition_check_privilege())
417 return MAPS_ERROR_PERMISSION_DENIED;
419 session::command *cmd = new session::command_reverse_geocode(maps, latitude,
420 longitude, preference, callback, user_data, request_id);
422 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
423 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
427 /*----------------------------------------------------------------------------*/
431 EXPORT_API int maps_service_search_place(const maps_service_h maps,
432 const maps_coordinates_h position,
434 const maps_place_filter_h filter,
435 maps_preference_h preference,
436 maps_service_search_place_cb callback,
437 void *user_data, int *request_id)
439 /* Check if internet feature is supported */
440 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
441 return MAPS_ERROR_NOT_SUPPORTED;
443 /* Check if the handle of the Maps Service is valid */
445 return MAPS_ERROR_INVALID_PARAMETER;
447 /* Check if this API feature available */
448 if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_PLACE))
449 return MAPS_ERROR_NOT_SUPPORTED;
451 /* Check if parameters are valid */
452 if (!position || (distance < 0) || !filter || !callback || !request_id)
453 return MAPS_ERROR_INVALID_PARAMETER;
455 /* Check if privileges enough */
456 if (!maps_condition_check_privilege())
457 return MAPS_ERROR_PERMISSION_DENIED;
459 session::command *cmd = new session::command_search_place(maps, position,
460 distance, preference, filter, callback, user_data, request_id);
462 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
463 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
467 EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
468 const maps_area_h boundary,
469 const maps_place_filter_h filter,
470 maps_preference_h preference,
471 maps_service_search_place_cb callback,
475 /* Check if internet feature is supported */
476 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
477 return MAPS_ERROR_NOT_SUPPORTED;
479 /* Check if the handle of the Maps Service is valid */
481 return MAPS_ERROR_INVALID_PARAMETER;
483 /* Check if this API feature available */
484 if (!__maps_provider_supported(maps,
485 MAPS_SERVICE_SEARCH_PLACE_BY_AREA))
486 return MAPS_ERROR_NOT_SUPPORTED;
488 /* Check if parameters are valid */
489 if (!boundary || !filter || !callback || !request_id)
490 return MAPS_ERROR_INVALID_PARAMETER;
492 /* Check if privileges enough */
493 if (!maps_condition_check_privilege())
494 return MAPS_ERROR_PERMISSION_DENIED;
496 session::command *cmd = new session::command_search_by_area_place(maps,
497 boundary, preference, filter, callback, user_data, request_id);
499 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
500 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
504 EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
506 const maps_area_h boundary,
507 const maps_place_filter_h filter,
508 maps_preference_h preference,
509 maps_service_search_place_cb callback,
513 /* Check if internet feature is supported */
514 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
515 return MAPS_ERROR_NOT_SUPPORTED;
517 /* Check if the handle of the Maps Service is valid */
519 return MAPS_ERROR_INVALID_PARAMETER;
521 /* Check if this API feature available */
522 if (!__maps_provider_supported(maps,
523 MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS))
524 return MAPS_ERROR_NOT_SUPPORTED;
526 /* Check if parameters are valid */
527 if (!address || !boundary || !filter || !callback || !request_id)
528 return MAPS_ERROR_INVALID_PARAMETER;
530 /* Check if privileges enough */
531 if (!maps_condition_check_privilege())
532 return MAPS_ERROR_PERMISSION_DENIED;
534 session::command *cmd = new session::command_search_by_address_place(maps,
535 address, boundary, preference, filter, callback, user_data, request_id);
537 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
538 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
542 EXPORT_API int maps_service_search_place_list(const maps_service_h maps,
543 const maps_area_h boundary,
544 const maps_place_filter_h filter,
545 maps_preference_h preference,
546 maps_service_search_place_list_cb callback,
547 void *user_data, int *request_id)
549 /* Check if internet feature is supported */
550 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
551 return MAPS_ERROR_NOT_SUPPORTED;
554 return MAPS_ERROR_INVALID_PARAMETER;
556 if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_PLACE_LIST))
557 return MAPS_ERROR_NOT_SUPPORTED;
559 if (!boundary || !filter || !callback || !request_id)
560 return MAPS_ERROR_INVALID_PARAMETER;
562 if (!maps_condition_check_privilege())
563 return MAPS_ERROR_PERMISSION_DENIED;
565 session::command *cmd = new session::command_search_place_list(maps,
566 boundary, preference, filter, callback, user_data, request_id);
568 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
569 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
573 EXPORT_API int maps_service_get_place_details(const maps_service_h maps,
574 const char *url, maps_service_get_place_details_cb callback,
575 void *user_data, int *request_id)
577 /* Check if internet feature is supported */
578 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
579 return MAPS_ERROR_NOT_SUPPORTED;
582 return MAPS_ERROR_INVALID_PARAMETER;
584 if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS))
585 return MAPS_ERROR_NOT_SUPPORTED;
587 if (!url || !callback || !request_id)
588 return MAPS_ERROR_INVALID_PARAMETER;
590 if (!maps_condition_check_privilege())
591 return MAPS_ERROR_PERMISSION_DENIED;
593 session::command *cmd = new session::command_get_place_details(maps,
594 url, callback, user_data, request_id);
596 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
597 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
601 /*----------------------------------------------------------------------------*/
605 EXPORT_API int maps_service_search_route(const maps_service_h maps,
606 const maps_coordinates_h origin,
607 const maps_coordinates_h destination,
608 maps_preference_h preference,
609 maps_service_search_route_cb callback,
610 void *user_data, int *request_id)
612 /* Check if internet feature is supported */
613 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
614 return MAPS_ERROR_NOT_SUPPORTED;
616 /* Check if the handle of the Maps Service is valid */
618 return MAPS_ERROR_INVALID_PARAMETER;
620 /* Check if this API feature available */
621 if (!__maps_provider_supported(maps, MAPS_SERVICE_SEARCH_ROUTE))
622 return MAPS_ERROR_NOT_SUPPORTED;
624 /* Check if parameters are valid */
625 if (!origin || !destination || !callback || !request_id)
626 return MAPS_ERROR_INVALID_PARAMETER;
628 /* Check if privileges enough */
629 if (!maps_condition_check_privilege())
630 return MAPS_ERROR_PERMISSION_DENIED;
632 session::command *cmd = new session::command_search_route(maps, preference,
633 origin, destination, callback, user_data, request_id);
635 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
636 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
640 EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
641 const maps_coordinates_h *waypoint_list,
643 maps_preference_h preference,
644 maps_service_search_route_cb callback,
648 /* Check if internet feature is supported */
649 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
650 return MAPS_ERROR_NOT_SUPPORTED;
652 /* Check if the handle of the Maps Service is valid */
654 return MAPS_ERROR_INVALID_PARAMETER;
656 /* Check if this API feature available */
657 if (!__maps_provider_supported(maps,
658 MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS))
659 return MAPS_ERROR_NOT_SUPPORTED;
661 /* Check if parameters are valid */
662 if (!waypoint_list || (waypoint_num < 2) || !callback || !request_id)
663 return MAPS_ERROR_INVALID_PARAMETER;
665 /* Check if privileges enough */
666 if (!maps_condition_check_privilege())
667 return MAPS_ERROR_PERMISSION_DENIED;
669 session::command *cmd = new session::command_search_route_waypoints(maps,
670 preference, waypoint_list, waypoint_num, callback, user_data, request_id);
672 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
673 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
677 /*----------------------------------------------------------------------------*/
679 /* Cancel Service Request */
681 EXPORT_API int maps_service_cancel_request(const maps_service_h maps, int request_id)
683 if (!maps_condition_check_maps_feature())
684 return MAPS_ERROR_NOT_SUPPORTED;
686 /* Check if the handle of the Maps Service is valid */
688 return MAPS_ERROR_INVALID_PARAMETER;
690 /* Check if this API feature available */
691 if (!__maps_provider_supported(maps, MAPS_SERVICE_CANCEL_REQUEST))
692 return MAPS_ERROR_NOT_SUPPORTED;
694 /* Check if parameters are valid */
696 return MAPS_ERROR_INVALID_PARAMETER;
698 /* Check if privileges enough */
699 if (!maps_condition_check_privilege())
700 return MAPS_ERROR_PERMISSION_DENIED;
702 session::command *cmd = new session::command_cancel_request(maps, request_id);
704 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
705 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
709 /*----------------------------------------------------------------------------*/
713 EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
714 const maps_coordinates_list_h coordinates_list, const maps_preference_h preference,
715 maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
717 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
718 return MAPS_ERROR_NOT_SUPPORTED;
721 return MAPS_ERROR_INVALID_PARAMETER;
723 if (!__maps_provider_supported(maps, MAPS_SERVICE_MULTI_REVERSE_GEOCODE))
724 return MAPS_ERROR_NOT_SUPPORTED;
726 if (!coordinates_list || !callback || !request_id)
727 return MAPS_ERROR_INVALID_PARAMETER;
729 if (!maps_condition_check_privilege())
730 return MAPS_ERROR_PERMISSION_DENIED;
732 session::command *cmd = new session::command_multi_reverse_geocode(maps,
733 coordinates_list, preference, callback, user_data, request_id);
735 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
736 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);