maps_service_reverse_geocode_cb callback,
void *user_data, int *request_id);
+/**
+ * @brief Gets the address list for a given position coordinates list.
+ * @details This function obtains structured address information for a given
+ * position coordinates.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice
+ * @remarks This function requires network access.
+ * \n To cancel the request use maps_plugin_cancel_request().
+ * \n To check if Maps Provider is capable of Reverse Geocoding and which
+ * Reverse Geocode preferences are supported see the lists of capacities and
+ * preferences above.
+ *
+ * @param[in] geocode_list The position coordinates list
+ * @param[in] preference The set of preferences for processing Reverse Geocode
+ * @param[in] callback The callback which will receive address informations
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @post This function invokes maps_service_multi_reverse_geocode_cb().
+ *
+ * @see maps_service_multi_reverse_geocode_cb()
+ * @see maps_plugin_cancel_request()
+ */
+int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h geocode_list,
+ const maps_preference_h preference, maps_service_multi_reverse_geocode_cb callback,
+ void *user_data, int *request_id);
+
+
/*----------------------------------------------------------------------------*/
/*
* Place
* @{
* @brief This provides enumerations of Maps API preferences
-* - - - - - - - - - - - - -
-*
-* Preference key names
-* --------------------
*
* The Preferences are organized as a key-value table where available Preference
* keys are following strings:
MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS, /**< Indicates that
maps_service_search_route_waypoints() service is allowed */
- MAPS_SERVICE_CANCEL_REQUEST /**< Indicates that
+ MAPS_SERVICE_CANCEL_REQUEST, /**< Indicates that
maps_service_cancel_request() service is allowed */
+ MAPS_SERVICE_MULTI_REVERSE_GEOCODE /**< Indicates that
+ maps_service_multi_reverse_geocode() service is allowed (Since 3.0)*/
} maps_service_e;
/**
maps_service_reverse_geocode_cb callback,
void *user_data, int *request_id);
+
+/**
+ * @brief Called when responsed the request of multi reverse geocoding.
+ * @details The Maps Service invokes this callback once when gets the response
+ * from map service provider.
+ * \n The value of @a total is same with requested coordinates list size.
+ * Even though one of address is not provided valid address handle is retrieved.
+ * @since_tizen 3.0
+ * @remarks You can get the respective address information of @a address_list
+ * using maps_address_list_foreach().
+ *
+ * @param[in] result The result of request
+ * @param[in] request_id The id of request
+ * @param[in] total The total number of results
+ * @param[in] address_list The converted address list from the
+ * requested coordinates list
+ * @param[in] user_data The user data pointer passed from
+ * maps_service_multi_reverse_geocode()
+ * @return @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_service_multi_reverse_geocode() will invoke this callback.
+ *
+ * @see maps_service_multi_reverse_geocode()
+ * @see maps_address_list_foreach()
+ * @see maps_service_cancel_request()
+ */
+typedef bool (*maps_service_multi_reverse_geocode_cb) (maps_error_e result,
+ int request_id,
+ int total,
+ maps_address_list_h address_list,
+ void *user_data);
+
+/**
+ * @brief Gets the address list for a given position coordinates list.
+ * \n The request is asynchronous.
+ * @details This function obtains structured address information.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ * %http://tizen.org/privilege/internet \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks %http://tizen.org/privilege/internet is needed to access internet.
+ * \n To cancel the request use maps_service_cancel_request().
+ * \n To check if Maps Provider is capable of Multi Reverse Geocoding use
+ * maps_service_provider_is_service_supported() with
+ * #MAPS_SERVICE_MULTI_REVERSE_GEOCODE passed as @a service parameter.
+ *
+ * @param[in] maps The Maps Service handle
+ * @param[in] coordinates_list The coordinates list [2 ~ 100] (a set of coordinates)
+ * @param[in] preference The set of preferences for processing Reverse
+ * Geocode
+ * @param[in] callback The callback which will retrieve address list
+ * @param[in] user_data The user data pointer to be passed to the
+ * callback
+ * @param[out] request_id The id of request
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_NETWORK_UNREACHABLE Network connection failed
+ * @retval #MAPS_ERROR_SERVICE_NOT_AVAILABLE Service not available
+ * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval #MAPS_ERROR_INVALID_OPERATION Operation is not valid
+ * @retval #MAPS_ERROR_NOT_FOUND Result not found
+ * @retval #MAPS_ERROR_KEY_NOT_AVAILABLE Invalid key
+ * @retval #MAPS_ERROR_UNKNOWN Unknown error
+ *
+ * @pre Call maps_service_create() to create Maps Service and obtain its handle.
+ * @post This function invokes maps_service_multi_reverse_geocode_cb().
+ *
+ * @see maps_service_multi_reverse_geocode_cb()
+ * @see maps_service_cancel_request()
+ * @see maps_service_reverse_geocode()
+ * @see maps_service_provider_is_service_supported()
+ */
+int maps_service_multi_reverse_geocode(const maps_service_h maps,
+ maps_coordinates_list_h coordinates_list,
+ const maps_preference_h preference,
+ maps_service_multi_reverse_geocode_cb callback,
+ void *user_data, int *request_id);
/**
* @}
*/
Name: capi-maps-service
Summary: Tizen Maps Service API
-Version: 0.5.0
+Version: 0.5.1
Release: 1
Group: Location/API
License: Apache-2.0
if (!maps || !supported)
return MAPS_ERROR_INVALID_PARAMETER;
if ((service < MAPS_SERVICE_GEOCODE)
- || (service > MAPS_SERVICE_CANCEL_REQUEST))
+ || (service > MAPS_SERVICE_MULTI_REVERSE_GEOCODE))
return MAPS_ERROR_INVALID_PARAMETER;
const plugin::plugin_s *p = __extract_plugin(maps);
if (!p)
return q()->push(new session::command_cancel_request(maps, request_id));
}
+
+/*----------------------------------------------------------------------------*/
+/* */
+/* Multi geocoder */
+
+EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
+ const maps_coordinates_list_h coordinates_list, const maps_preference_h preference,
+ maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
+{
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ if (!__maps_provider_supported(maps, MAPS_SERVICE_MULTI_REVERSE_GEOCODE))
+ return MAPS_ERROR_NOT_SUPPORTED;
+
+ if (!coordinates_list || !callback || !request_id)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ if (!__has_maps_service_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
+ return q()->push(new session::command_multi_reverse_geocode(maps,
+ coordinates_list, preference, callback, user_data, request_id));
+}
+
return 0;
}
+int maps_plugin_multi_reverse_geocode_empty(const maps_coordinates_list_h maps_list,
+ const maps_preference_h preference,
+ maps_service_multi_reverse_geocode_cb callback,
+ void *user_data, int *request_id)
+{
+ return 0;
+}
+
/* Place */
int maps_plugin_search_place_empty(const maps_coordinates_h position,
int distance,
maps_plugin_geocode_inside_area_empty,
maps_plugin_geocode_by_structured_address_empty,
maps_plugin_reverse_geocode_empty,
+ maps_plugin_multi_reverse_geocode_empty,
/* Place */
maps_plugin_search_place_empty,
new_plugin->interface.maps_plugin_reverse_geocode =
(maps_plugin_reverse_geocode_f) gmod_find_sym(plugin,
"maps_plugin_reverse_geocode");
+ new_plugin->interface.maps_plugin_multi_reverse_geocode =
+ (maps_plugin_multi_reverse_geocode_f)
+ gmod_find_sym(plugin, "maps_plugin_multi_reverse_geocode");
/* Place */
new_plugin->interface.maps_plugin_search_place =
itf->maps_plugin_geocode_by_structured_address);
MAPS_LOGD("maps_plugin_reverse_geocode:\t\t%p",
itf->maps_plugin_reverse_geocode);
+ MAPS_LOGD("maps_plugin_multi_reverse_geocode:\t%p",
+ itf->maps_plugin_multi_reverse_geocode);
MAPS_LOGD("maps_plugin_search_place:\t\t%p",
itf->maps_plugin_search_place);
maps_service_reverse_geocode_cb
callback,
void *user_data, int *request_id);
+typedef int (*maps_plugin_multi_reverse_geocode_f) (const maps_coordinates_list_h maps_list,
+ const maps_preference_h preference,
+ maps_service_multi_reverse_geocode_cb callback,
+ void *user_data, int *request_id);
/* Place */
typedef int (*maps_plugin_search_place_f) (const maps_coordinates_h position,
maps_plugin_geocode_by_structured_address_f
maps_plugin_geocode_by_structured_address;
maps_plugin_reverse_geocode_f maps_plugin_reverse_geocode;
+ maps_plugin_multi_reverse_geocode_f maps_plugin_multi_reverse_geocode;
/* Place */
maps_plugin_search_place_f maps_plugin_search_place;
}
/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_multi_reverse_geocode_f) (maps_service_h maps,
+* maps_coordinates_list_h maps_list, maps_preference_h preference,
+* maps_service_multi_reverse_geocode_cb callback, void * user_data, int *request_id) */
+session::command_multi_reverse_geocode::command_multi_reverse_geocode(
+ maps_service_h ms, const maps_coordinates_list_h list, const maps_item_hashtable_h pref,
+ maps_service_multi_reverse_geocode_cb cb, void *ud, int *request_id)
+ : command(ms)
+ , maps_list(NULL)
+ , preference(NULL)
+ , callback(cb)
+ , user_data(ud)
+ , error(0)
+{
+ *request_id = command::command_request_id++;
+ my_req_id = *request_id;
+
+ int list_size = 0;
+ maps_coordinates_list_get_length(list, &list_size);
+ if (list_size < 2 || list_size > 100)
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ if (pref && (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+ error = MAPS_ERROR_INVALID_PARAMETER;
+
+ maps_list = list;
+}
+
+session::command_multi_reverse_geocode::~command_multi_reverse_geocode()
+{
+ maps_item_hashtable_destroy(preference);
+}
+
+int session::command_multi_reverse_geocode::run()
+{
+ if (error != MAPS_ERROR_NONE)
+ return error;
+
+ pending_request pr(plugin());
+
+ /* Get the plugin interface function */
+ maps_plugin_multi_reverse_geocode_f func =
+ interface()->maps_plugin_multi_reverse_geocode;
+
+ command_multi_reverse_geocode_handler *handler = NULL;
+ if (func) {
+ /* No need to create the handler when the function is NULL */
+ pr.add(my_req_id);
+ handler = new command_multi_reverse_geocode_handler(plugin(), callback, user_data, my_req_id);
+
+ if (handler) {
+ /* Run the plugin interface function */
+ error = func(maps_list, preference,
+ command_multi_reverse_geocode_handler::foreach_multi_reverse_geocode_cb,
+ handler, &handler->plg_req_id);
+
+ pr.update(my_req_id, handler);
+
+ MAPS_LOGD("session::command_multi_reverse_geocode::run: %d", my_req_id);
+ }
+ else {
+ error = MAPS_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ else {
+ /* Plugin Function is NULL: use default empty function */
+ /*
+ func = plugin::get_empty_interface().
+ maps_plugin_multi_reverse_geocode;
+ */
+ MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin");
+ error = MAPS_ERROR_NOT_SUPPORTED;
+ }
+
+ const int ret = error;
+ destroy();
+ return ret;
+}
+
+session::command_multi_reverse_geocode_handler::command_multi_reverse_geocode_handler(
+ plugin::plugin_s *p, maps_service_multi_reverse_geocode_cb cb, void *ud, int urid)
+ : command_handler(p, ud, urid)
+ , callback(cb)
+{
+}
+
+bool session::command_multi_reverse_geocode_handler::foreach_multi_reverse_geocode_cb(
+ maps_error_e error, int request_id, int total, maps_coordinates_list_h address_list, void *user_data)
+{
+ command_multi_reverse_geocode_handler *handler =
+ (command_multi_reverse_geocode_handler *) user_data;
+
+ if (request_id != handler->plg_req_id) {
+ MAPS_LOGE("\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+ request_id, handler->plg_req_id);
+ }
+
+ /* Make a user's copy of result data */
+ maps_coordinates_list_h cloned_result = NULL;
+ cloned_result = address_list;
+
+ /* Send data to user */
+ const bool b = handler->callback(error, handler->user_req_id, total, cloned_result, handler->user_data);
+ /*if(index>=(total-1)) */
+
+ pending_request pr(handler->plugin());
+ pr.remove(handler->user_req_id);
+
+ return b;
+}
+
+/*----------------------------------------------------------------------------*/
/*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
* maps_coordinates_h position, int distance, maps_item_hashtable_h preference,
* maps_place_filter_h filter, maps_service_search_place_cb callback,
};
/*----------------------------------------------------------------------------*/
+ /*typedef int (*maps_plugin_multi_reverse_geocode_f)(maps_service_h maps,
+ * maps_maps_h maps_list, maps_preference_h preference,
+ * maps_service_multi_reverse_geocode_cb callback, void *user_data, * int *request_id); */
+ class command_multi_reverse_geocode : public command
+ {
+ public:
+ const string address;
+ maps_coordinates_list_h maps_list;
+ maps_item_hashtable_h preference;
+ maps_service_multi_reverse_geocode_cb callback;
+ void *user_data;
+ int error;
+ public:
+ command_multi_reverse_geocode(maps_service_h ms,
+ const maps_coordinates_list_h maps_list,
+ const maps_item_hashtable_h preference,
+ maps_service_multi_reverse_geocode_cb callback,
+ void *user_data, int *request_id);
+ virtual ~command_multi_reverse_geocode();
+ private:
+ command_multi_reverse_geocode() : command(NULL)
+ {
+ }
+ command_multi_reverse_geocode(const command_multi_reverse_geocode &src)
+ : command(NULL)
+ {
+ }
+ command_multi_reverse_geocode& operator=(
+ const command_multi_reverse_geocode &src)
+ {
+ return *this;
+ }
+ private:
+ virtual int run();
+ };
+
+ class command_multi_reverse_geocode_handler : public command_handler
+ {
+ maps_service_multi_reverse_geocode_cb callback;
+ public:
+ command_multi_reverse_geocode_handler(plugin::plugin_s *plugin,
+ maps_service_multi_reverse_geocode_cb callback,
+ void *user_data,
+ int user_req_id);
+ virtual ~command_multi_reverse_geocode_handler()
+ {
+ };
+ private:
+ command_multi_reverse_geocode_handler()
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_multi_reverse_geocode_handler(
+ command_multi_reverse_geocode_handler &src)
+ : command_handler(NULL, NULL, 0)
+ {
+ }
+ command_multi_reverse_geocode_handler &operator=(
+ const command_multi_reverse_geocode_handler &src)
+ {
+ return *this;
+ }
+ private:
+ static bool foreach_multi_reverse_geocode_cb(maps_error_e result,
+ int request_id,
+ int total,
+ maps_coordinates_list_h address_list,
+ void *user_data);
+ friend class command_multi_reverse_geocode;
+ };
+
+/*----------------------------------------------------------------------------*/
/*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
* maps_coordinates_h position, int distance,
* maps_item_hashtable_h preference, maps_place_filter_h filter,
case MAPS_SERVICE_SEARCH_ROUTE:
case MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS:
case MAPS_SERVICE_CANCEL_REQUEST:
+ case MAPS_SERVICE_MULTI_REVERSE_GEOCODE:
*supported = true;
return MAPS_ERROR_NONE;
default: