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 /*----------------------------------------------------------------------------*/
50 /* Maps Service & Preference */
52 EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb callback,
55 if (!maps_condition_check_maps_feature())
56 return MAPS_ERROR_NOT_SUPPORTED;
58 return MAPS_ERROR_INVALID_PARAMETER;
60 /* The list of map provider info, obtained by enumerating available plugins */
62 vector <plugin::provider_info> v = pd.get_available_list();
64 /* Send obtained provider info to the user */
65 const int total = int(v.size());
66 for (int i = 0; i < total; i++) {
67 /* Get a plugin info handle from the array */
68 /* and send a callback with provider info to the user */
69 char *provider = g_strdup(v[i].provider.c_str());
70 if (!callback(provider, user_data))
74 return MAPS_ERROR_NONE;
77 EXPORT_API int maps_service_request_user_consent(const char *maps_provider,
78 maps_service_request_user_consent_cb callback, void *user_data)
80 if (!maps_condition_check_maps_feature())
81 return MAPS_ERROR_NOT_SUPPORTED;
82 /* Check if parameters are valid */
83 if (!maps_provider || !callback)
84 return MAPS_ERROR_INVALID_PARAMETER;
86 /* Check if privileges enough */
87 if (!maps_condition_check_privilege())
88 return MAPS_ERROR_PERMISSION_DENIED;
90 int error = plugin::request_user_consent(maps_provider, (void*)callback, user_data);
94 EXPORT_API int maps_service_create(const char *maps_provider, maps_service_h *maps)
96 if (!maps_condition_check_maps_feature())
97 return MAPS_ERROR_NOT_SUPPORTED;
98 if (!maps || !maps_provider)
99 return MAPS_ERROR_INVALID_PARAMETER;
100 if (!maps_condition_check_privilege()) {
102 MAPS_LOGD("ERROR: privilege is not included");
103 return MAPS_ERROR_PERMISSION_DENIED;
107 int error = MAPS_ERROR_NOT_SUPPORTED;
108 char *provider = NULL, *module = NULL;
111 /* 0. Find the plugin, requested by the user */
112 plugin::split_provider_name(maps_provider, &provider, &module);
113 const plugin::provider_info info = plugin::find_by_names(provider);
115 /* 1. Check whether provider info is valid */
117 MAPS_LOGE("ERROR! Provider info not found for name: %s", maps_provider);
118 error = MAPS_ERROR_NOT_SUPPORTED;
122 /* 2. Setup maps service handling structure */
123 maps_service_s *maps_service = g_slice_new0(maps_service_s);
125 if (maps_service == NULL) {
127 MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
128 error = MAPS_ERROR_OUT_OF_MEMORY;
133 /* 3. Initialize the requested plugin */
134 int init_error = MAPS_ERROR_NONE; /* Storage for init error code */
135 maps_plugin_h plugin_h = plugin::binary_extractor().init(info, module, &init_error);
139 MAPS_LOGE("ERROR! Plugin init failed");
144 maps_service->plugin = plugin_h;
146 /* 4. Initialize an output pointer to maps service */
147 *maps = maps_service;
149 /* 5. Set status of completely correct plugin initialization */
150 error = MAPS_ERROR_NONE;
153 if (error != MAPS_ERROR_NONE)
154 maps_service_destroy(*maps);
161 EXPORT_API int maps_service_destroy(maps_service_h maps)
163 if (!maps_condition_check_maps_feature())
164 return MAPS_ERROR_NOT_SUPPORTED;
166 return MAPS_ERROR_INVALID_PARAMETER;
167 if (!maps_condition_check_privilege())
168 return MAPS_ERROR_PERMISSION_DENIED;
170 maps_service_s *maps_service = (maps_service_s *) maps;
172 if (maps_service->plugin)
173 plugin::binary_extractor().shutdown(maps_service->plugin);
175 g_slice_free(maps_service_s, maps);
177 return MAPS_ERROR_NONE;
180 EXPORT_API int maps_service_set_provider_key(maps_service_h maps,
181 const char *provider_key)
183 if (!maps_condition_check_maps_feature())
184 return MAPS_ERROR_NOT_SUPPORTED;
185 if (!maps || !provider_key)
186 return MAPS_ERROR_INVALID_PARAMETER;
188 const plugin::plugin_s *p = __extract_plugin(maps);
190 return MAPS_ERROR_INVALID_PARAMETER;
191 return p->interface.maps_plugin_set_provider_key(provider_key);
194 EXPORT_API int maps_service_get_provider_key(const maps_service_h maps,
197 if (!maps_condition_check_maps_feature())
198 return MAPS_ERROR_NOT_SUPPORTED;
199 if (!maps || !provider_key)
200 return MAPS_ERROR_INVALID_PARAMETER;
202 const plugin::plugin_s *p = __extract_plugin(maps);
204 return MAPS_ERROR_INVALID_PARAMETER;
205 return p->interface.maps_plugin_get_provider_key(provider_key);
208 EXPORT_API int maps_service_set_preference(maps_service_h maps,
209 maps_string_hashtable_h preference)
211 if (!maps_condition_check_maps_feature())
212 return MAPS_ERROR_NOT_SUPPORTED;
213 if (!maps || !preference)
214 return MAPS_ERROR_INVALID_PARAMETER;
216 const plugin::plugin_s *p = __extract_plugin(maps);
218 return MAPS_ERROR_INVALID_PARAMETER;
219 return p->interface.maps_plugin_set_preference(preference);
222 EXPORT_API int maps_service_get_preference(maps_service_h maps,
223 maps_string_hashtable_h *preference)
225 if (!maps_condition_check_maps_feature())
226 return MAPS_ERROR_NOT_SUPPORTED;
227 if (!maps || !preference)
228 return MAPS_ERROR_INVALID_PARAMETER;
230 const plugin::plugin_s *p = __extract_plugin(maps);
232 return MAPS_ERROR_INVALID_PARAMETER;
233 return p->interface.maps_plugin_get_preference(preference);
236 EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h maps,
237 maps_service_e service,
240 if (!maps_condition_check_maps_feature())
241 return MAPS_ERROR_NOT_SUPPORTED;
242 if (!maps || !supported)
243 return MAPS_ERROR_INVALID_PARAMETER;
244 if (!(service >= MAPS_SERVICE_GEOCODE && service <= MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS) &&
245 !(service >= MAPS_SERVICE_VIEW && service <= MAPS_SERVICE_VIEW_SNAPSHOT))
246 return MAPS_ERROR_INVALID_PARAMETER;
248 const plugin::plugin_s *p = __extract_plugin(maps);
250 return MAPS_ERROR_NOT_SUPPORTED;
251 return p->interface.maps_plugin_is_service_supported(service, supported);
254 EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h maps,
255 maps_service_data_e data,
258 if (!maps_condition_check_maps_feature())
259 return MAPS_ERROR_NOT_SUPPORTED;
260 if (!maps || !supported)
261 return MAPS_ERROR_INVALID_PARAMETER;
262 if (!(data >= MAPS_PLACE_ADDRESS && data <= MAPS_ROUTE_SEGMENTS_MANEUVERS) &&
263 !(data >= MAPS_VIEW_TRAFFIC && data <= MAPS_VIEW_SCALEBAR))
264 return MAPS_ERROR_INVALID_PARAMETER;
266 const plugin::plugin_s *p = __extract_plugin(maps);
268 return MAPS_ERROR_NOT_SUPPORTED;
269 return p->interface.maps_plugin_is_data_supported(data, supported);
272 /*----------------------------------------------------------------------------*/
274 /* Geocoder Service */
276 EXPORT_API int maps_service_geocode(const maps_service_h maps,
278 const maps_preference_h preference,
279 maps_service_geocode_cb callback,
283 /* Check if internet feature is supported */
284 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
285 return MAPS_ERROR_NOT_SUPPORTED;
287 /* Check if the handle of the Maps Service is valid */
289 return MAPS_ERROR_INVALID_PARAMETER;
291 /* Check if this API feature available */
292 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_GEOCODE))
293 return MAPS_ERROR_NOT_SUPPORTED;
295 /* Check if parameters are valid */
296 if (!address || !callback || !request_id)
297 return MAPS_ERROR_INVALID_PARAMETER;
299 /* Check if privileges enough */
300 if (!maps_condition_check_privilege())
301 return MAPS_ERROR_PERMISSION_DENIED;
303 session::command *cmd = new session::command_geocode(maps, address, preference,
304 callback, user_data, request_id);
306 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
307 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
311 EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
313 const maps_area_h bounds,
314 const maps_preference_h preference,
315 maps_service_geocode_cb callback,
316 void *user_data, int *request_id)
318 /* Check if internet feature is supported */
319 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
320 return MAPS_ERROR_NOT_SUPPORTED;
322 /* Check if the handle of the Maps Service is valid */
324 return MAPS_ERROR_INVALID_PARAMETER;
326 /* Check if this API feature available */
327 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_GEOCODE_INSIDE_AREA))
328 return MAPS_ERROR_NOT_SUPPORTED;
330 /* Check if parameters are valid */
331 if (!address || !bounds || !callback || !request_id)
332 return MAPS_ERROR_INVALID_PARAMETER;
334 /* Check if privileges enough */
335 if (!maps_condition_check_privilege())
336 return MAPS_ERROR_PERMISSION_DENIED;
338 session::command *cmd = new session::command_geocode_inside_bounds(maps,
339 address, bounds, preference, callback, user_data, request_id);
341 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
342 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
346 EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h maps,
347 const maps_address_h address,
348 const maps_preference_h preference,
349 maps_service_geocode_cb callback,
350 void *user_data, int *request_id)
352 /* Check if internet feature is supported */
353 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
354 return MAPS_ERROR_NOT_SUPPORTED;
356 /* Check if the handle of the Maps Service is valid */
358 return MAPS_ERROR_INVALID_PARAMETER;
360 /* Check if this API feature available */
361 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS))
362 return MAPS_ERROR_NOT_SUPPORTED;
364 /* Check if parameters are valid */
365 if (!address || !callback || !request_id)
366 return MAPS_ERROR_INVALID_PARAMETER;
368 /* Check if privileges enough */
369 if (!maps_condition_check_privilege())
370 return MAPS_ERROR_PERMISSION_DENIED;
372 session::command *cmd = new session::command_geocode_by_structured_address(maps,
373 address, preference, callback, user_data, request_id);
375 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
376 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
380 EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
381 double latitude, double longitude,
382 const maps_preference_h preference,
383 maps_service_reverse_geocode_cb
384 callback, void * user_data,
387 /* Check if internet feature is supported */
388 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
389 return MAPS_ERROR_NOT_SUPPORTED;
391 /* Check if the handle of the Maps Service is valid */
393 return MAPS_ERROR_INVALID_PARAMETER;
395 /* Check if this API feature available */
396 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_REVERSE_GEOCODE))
397 return MAPS_ERROR_NOT_SUPPORTED;
399 /* Check if parameters are valid */
400 if (!callback || !request_id)
401 return MAPS_ERROR_INVALID_PARAMETER;
402 if (latitude <= -90 || latitude >= 90)
403 return MAPS_ERROR_INVALID_PARAMETER;
404 if (longitude <= -180 || longitude >= 180)
405 return MAPS_ERROR_INVALID_PARAMETER;
407 /* Check if privileges enough */
408 if (!maps_condition_check_privilege())
409 return MAPS_ERROR_PERMISSION_DENIED;
411 session::command *cmd = new session::command_reverse_geocode(maps, latitude,
412 longitude, preference, callback, user_data, request_id);
414 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
415 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
419 /*----------------------------------------------------------------------------*/
423 EXPORT_API int maps_service_search_place(const maps_service_h maps,
424 const maps_coordinates_h position,
426 const maps_place_filter_h filter,
427 maps_preference_h preference,
428 maps_service_search_place_cb callback,
429 void *user_data, int *request_id)
431 /* Check if internet feature is supported */
432 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
433 return MAPS_ERROR_NOT_SUPPORTED;
435 /* Check if the handle of the Maps Service is valid */
437 return MAPS_ERROR_INVALID_PARAMETER;
439 /* Check if this API feature available */
440 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_SEARCH_PLACE))
441 return MAPS_ERROR_NOT_SUPPORTED;
443 /* Check if parameters are valid */
444 if (!position || (distance < 0) || !filter || !callback || !request_id)
445 return MAPS_ERROR_INVALID_PARAMETER;
447 /* Check if privileges enough */
448 if (!maps_condition_check_privilege())
449 return MAPS_ERROR_PERMISSION_DENIED;
451 session::command *cmd = new session::command_search_place(maps, position,
452 distance, preference, filter, callback, user_data, request_id);
454 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
455 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
459 EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
460 const maps_area_h boundary,
461 const maps_place_filter_h filter,
462 maps_preference_h preference,
463 maps_service_search_place_cb callback,
467 /* Check if internet feature is supported */
468 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
469 return MAPS_ERROR_NOT_SUPPORTED;
471 /* Check if the handle of the Maps Service is valid */
473 return MAPS_ERROR_INVALID_PARAMETER;
475 /* Check if this API feature available */
476 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_SEARCH_PLACE_BY_AREA))
477 return MAPS_ERROR_NOT_SUPPORTED;
479 /* Check if parameters are valid */
480 if (!boundary || !filter || !callback || !request_id)
481 return MAPS_ERROR_INVALID_PARAMETER;
483 /* Check if privileges enough */
484 if (!maps_condition_check_privilege())
485 return MAPS_ERROR_PERMISSION_DENIED;
487 session::command *cmd = new session::command_search_by_area_place(maps,
488 boundary, preference, filter, callback, user_data, request_id);
490 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
491 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
495 EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
497 const maps_area_h boundary,
498 const maps_place_filter_h filter,
499 maps_preference_h preference,
500 maps_service_search_place_cb callback,
504 /* Check if internet feature is supported */
505 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
506 return MAPS_ERROR_NOT_SUPPORTED;
508 /* Check if the handle of the Maps Service is valid */
510 return MAPS_ERROR_INVALID_PARAMETER;
512 /* Check if this API feature available */
513 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS))
514 return MAPS_ERROR_NOT_SUPPORTED;
516 /* Check if parameters are valid */
517 if (!address || !boundary || !filter || !callback || !request_id)
518 return MAPS_ERROR_INVALID_PARAMETER;
520 /* Check if privileges enough */
521 if (!maps_condition_check_privilege())
522 return MAPS_ERROR_PERMISSION_DENIED;
524 session::command *cmd = new session::command_search_by_address_place(maps,
525 address, boundary, preference, filter, callback, user_data, request_id);
527 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
528 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
532 EXPORT_API int maps_service_search_place_list(const maps_service_h maps,
533 const maps_area_h boundary,
534 const maps_place_filter_h filter,
535 maps_preference_h preference,
536 maps_service_search_place_list_cb callback,
537 void *user_data, int *request_id)
539 /* Check if internet feature is supported */
540 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
541 return MAPS_ERROR_NOT_SUPPORTED;
544 return MAPS_ERROR_INVALID_PARAMETER;
546 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_SEARCH_PLACE_LIST))
547 return MAPS_ERROR_NOT_SUPPORTED;
549 if (!boundary || !filter || !callback || !request_id)
550 return MAPS_ERROR_INVALID_PARAMETER;
552 if (!maps_condition_check_privilege())
553 return MAPS_ERROR_PERMISSION_DENIED;
555 session::command *cmd = new session::command_search_place_list(maps,
556 boundary, preference, filter, callback, user_data, request_id);
558 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
559 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
563 EXPORT_API int maps_service_get_place_details(const maps_service_h maps,
564 const char *url, maps_service_get_place_details_cb callback,
565 void *user_data, int *request_id)
567 /* Check if internet feature is supported */
568 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
569 return MAPS_ERROR_NOT_SUPPORTED;
572 return MAPS_ERROR_INVALID_PARAMETER;
574 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS))
575 return MAPS_ERROR_NOT_SUPPORTED;
577 if (!url || !callback || !request_id)
578 return MAPS_ERROR_INVALID_PARAMETER;
580 if (!maps_condition_check_privilege())
581 return MAPS_ERROR_PERMISSION_DENIED;
583 session::command *cmd = new session::command_get_place_details(maps,
584 url, callback, user_data, request_id);
586 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
587 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
591 /*----------------------------------------------------------------------------*/
595 EXPORT_API int maps_service_search_route(const maps_service_h maps,
596 const maps_coordinates_h origin,
597 const maps_coordinates_h destination,
598 maps_preference_h preference,
599 maps_service_search_route_cb callback,
600 void *user_data, int *request_id)
602 /* Check if internet feature is supported */
603 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
604 return MAPS_ERROR_NOT_SUPPORTED;
606 /* Check if the handle of the Maps Service is valid */
608 return MAPS_ERROR_INVALID_PARAMETER;
610 /* Check if this API feature available */
611 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_SEARCH_ROUTE))
612 return MAPS_ERROR_NOT_SUPPORTED;
614 /* Check if parameters are valid */
615 if (!origin || !destination || !callback || !request_id)
616 return MAPS_ERROR_INVALID_PARAMETER;
618 /* Check if privileges enough */
619 if (!maps_condition_check_privilege())
620 return MAPS_ERROR_PERMISSION_DENIED;
622 session::command *cmd = new session::command_search_route(maps, preference,
623 origin, destination, callback, user_data, request_id);
625 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
626 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
630 EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
631 const maps_coordinates_h *waypoint_list,
633 maps_preference_h preference,
634 maps_service_search_route_cb callback,
638 /* Check if internet feature is supported */
639 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
640 return MAPS_ERROR_NOT_SUPPORTED;
642 /* Check if the handle of the Maps Service is valid */
644 return MAPS_ERROR_INVALID_PARAMETER;
646 /* Check if this API feature available */
647 if (!maps_condition_check_service_supported(maps,
648 MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS))
649 return MAPS_ERROR_NOT_SUPPORTED;
651 /* Check if parameters are valid */
652 if (!waypoint_list || (waypoint_num < 2) || !callback || !request_id)
653 return MAPS_ERROR_INVALID_PARAMETER;
655 /* Check if privileges enough */
656 if (!maps_condition_check_privilege())
657 return MAPS_ERROR_PERMISSION_DENIED;
659 session::command *cmd = new session::command_search_route_waypoints(maps,
660 preference, waypoint_list, waypoint_num, callback, user_data, request_id);
662 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
663 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
667 /*----------------------------------------------------------------------------*/
669 /* Cancel Service Request */
671 EXPORT_API int maps_service_cancel_request(const maps_service_h maps, int request_id)
673 if (!maps_condition_check_maps_feature())
674 return MAPS_ERROR_NOT_SUPPORTED;
676 /* Check if the handle of the Maps Service is valid */
678 return MAPS_ERROR_INVALID_PARAMETER;
680 /* Check if this API feature available */
681 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_CANCEL_REQUEST))
682 return MAPS_ERROR_NOT_SUPPORTED;
684 /* Check if parameters are valid */
686 return MAPS_ERROR_INVALID_PARAMETER;
688 /* Check if privileges enough */
689 if (!maps_condition_check_privilege())
690 return MAPS_ERROR_PERMISSION_DENIED;
692 session::command *cmd = new session::command_cancel_request(maps, request_id);
694 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
695 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
699 /*----------------------------------------------------------------------------*/
703 EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
704 const maps_coordinates_list_h coordinates_list, const maps_preference_h preference,
705 maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
707 if (!maps_condition_check_maps_feature() || !maps_condition_check_internet_feature())
708 return MAPS_ERROR_NOT_SUPPORTED;
711 return MAPS_ERROR_INVALID_PARAMETER;
713 if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_MULTI_REVERSE_GEOCODE))
714 return MAPS_ERROR_NOT_SUPPORTED;
716 if (!coordinates_list || !callback || !request_id)
717 return MAPS_ERROR_INVALID_PARAMETER;
719 if (!maps_condition_check_privilege())
720 return MAPS_ERROR_PERMISSION_DENIED;
722 session::command *cmd = new session::command_multi_reverse_geocode(maps,
723 coordinates_list, preference, callback, user_data, request_id);
725 int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
726 if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);