+[Version] capi-maps-service_0.5.0
+[Date] 21 October 2015
+[Title] Added coordinates address list API.
+[Developer] Young-Ae Kang <youngae.kang@samsung.com>
+
[Version] capi-maps-service_0.4.6
[Date] 16 September 2015
[Title] Added -fvisibility=hidden to make EXPORT_API useful.
#endif
/**
- * @brief The Address handle.
- * @details The Address handle can be obtained via call of
- * maps_address_create().
- * @remarks To release the handle use maps_address_destroy().
- * \n To clone the handle use maps_address_clone().
+ * @brief The address handle.
+ * @details The address handle can be obtained via calling of maps_address_create()
* @since_tizen 2.4
- *
- * @see maps_address_create()
- * @see maps_address_destroy()
- * @see maps_address_clone()
*/
typedef void *maps_address_h;
+/**
+ * @brief The address list handle
+ * @details The address list handle can be obtained via calling of maps_address_list_create().
+ * @since_tizen 3.0
+ */
+typedef void *maps_address_list_h;
+
/*----------------------------------------------------------------------------*/
/**
*/
int maps_address_set_freetext(maps_address_h address, const char *freetext);
+/**
+ * @brief Creates a address list having a set of addresses.
+ * @since_tizen 3.0
+ *
+ * @param[out] address_list The address list handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_create(maps_address_list_h *address_list);
+
+/**
+ * @brief Appends an address to an address list.
+ * @since_tizen 3.0
+ *
+ * @param[in] address_list The address list handle
+ * @param[in] address The address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_append(maps_address_list_h address_list, maps_address_h address);
+
+/**
+ * @brief Removes an address from an address list.
+ * @since_tizen 3.0
+ *
+ * @param[in] address_list The address list handle
+ * @param[in] address The address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_remove(maps_address_list_h address_list, maps_address_h address);
+
+/**
+ * @brief Gets the number of elements in an address list.
+ * @since_tizen 3.0
+ *
+ * @param[in] address_list The address list handle
+ * @param[out] length The number of elements in the address list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ */
+int maps_address_list_get_length(maps_address_list_h address_list, int *length);
+
+/**
+ * @brief Called iteratively to get address information.
+ * @since_tizen 3.0
+ *
+ * @param[in] index The index of iteration
+ * @param[in] address The address handle
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n
+ * @c false to break out of the loop
+ * @see maps_address_list_foreach_address()
+ */
+typedef bool (*maps_address_cb)(int index, maps_address_h address, void *user_data);
+
+/**
+ * @brief Retrieves all addresses by invoking a specific callback for each address of address list.
+ * @since_tizen 3.0
+ *
+ * @param[in] address_list The address list handle
+ * @param[in] callback The iteration callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ * @see maps_address_list_destroy()
+ * @see maps_address_list_get_length()
+ */
+int maps_address_list_foreach(maps_address_list_h address_list, maps_address_cb callback, void *user_data);
+
+/**
+ * @brief Frees all of the memory used by a address list.
+ * @since_tizen 3.0
+ *
+ * @param[in] address_list The address list handle
+ * @param[in] maps_address_h The address handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_address_list_create()
+ */
+int maps_address_list_destroy(maps_address_list_h address_list);
+
+
#ifdef __cplusplus
}
#endif
* @brief Enumeration of supported types of the Geographical Area.
* @details This enumeration represents allowed geographical type of
* Geographical Area: rectangular and circular.
- * \n This enumeration is used in #maps_area_s.
* @since_tizen 2.4
- *
- * @see maps_area_s
*/
typedef enum {
MAPS_AREA_NONE = 0, /**< Undefined geographical area type. */
* @brief Structure of the rectangular Geographical Area.
* @details This structure represents a rectangular Geographical Area,
* specified with left top and right bottom coordinates.
- * \n This structure is used in #maps_area_s.
+ * @warning Do not use #maps_area_rectangle_s directly
+ * if you are an application developer.
* @since_tizen 2.4
- *
- * @see maps_area_s
*/
typedef struct _maps_area_rectangle_s {
maps_coordinates_s top_left; /**< The top left position
* @brief Structure of the circular Geographical Area, specified with a
* center coordinates and a radius.
* @details This structure represents a circular Geographical Area.
- * \n This structure is used in #maps_area_s.
+ * @warning Do not use #maps_area_circle_s directly
+ * if you are an application developer.
* @since_tizen 2.4
- *
- * @see maps_area_s
*/
typedef struct _maps_area_circle_s {
-
maps_coordinates_s center; /**< The center position of a circle. */
double radius; /**< The radius of a circle. */
} maps_area_circle_s;
* @brief Structure of the Geographical Area.
* @details This structure represents a Geographical Area, specified with a
* type, circular or rectangular, and appropriate coordinates and radius.
+ * @warning Do not use #maps_area_s directly
+ * if you are an application developer.
+ * Using #maps_area_h is recommanded.
* @since_tizen 2.4
- *
- * @see maps_area_type_e
- * @see maps_area_rectangle_s
- * @see maps_area_circle_s
*/
typedef struct _maps_area_s {
maps_area_type_e type; /**< The area type of this information. */
/**
* @brief Creates a rectangular type of new Geographical Area with a
* specified information.
- * @details This function creates a rectangular type of new #maps_area_s with a
+ * @details This function creates a rectangular type of new #maps_area_h with a
* specified left top and right bottom coordinates.
* @since_tizen 2.4
* @remarks @a area must be released using maps_area_destroy().
* @see maps_area_clone()
* @see maps_area_destroy()
* @see maps_area_create_circle()
- * @see maps_area_s
* @see maps_coordinates_create()
* @see maps_coordinates_destroy()
*/
/**
* @brief Creates a circular type of new Geographical Area with a
* specified information.
- * @details This function creates a circular type of new #maps_area_s
+ * @details This function creates a circular type of new #maps_area_h
* Geographical Area with a specified center coordinates and a radius.
* @since_tizen 2.4
* @remarks @a area must be released using maps_area_destroy().
- * \n @a top_left and @a bottom_right must be released using
- * maps_coordinates_destroy().
+ * \n @a center must be released using maps_coordinates_destroy().
+ * \n The @a radius is specified in units, listed in #maps_distance_unit_e.
+ * \n To get and set distance units use maps_preference_get_distance_unit() and
+ * maps_preference_set_distance_unit() respectively.
*
* @param[in] center The central position of the area
* @param[in] radius The radius of the area
* @see maps_area_clone()
* @see maps_area_destroy()
* @see maps_area_create_rectangle()
- * @see maps_area_s
* @see maps_coordinates_create()
* @see maps_coordinates_destroy()
+ * @see maps_preference_get_distance_unit()
+ * @see maps_preference_set_distance_unit()
*/
int maps_area_create_circle(const maps_coordinates_h center,
const double radius, maps_area_h *area);
/**
* @brief Destroys the Geographical Area and releases all its resources.
- * @details This function destroys the Geographical Area #maps_area_s and
+ * @details This function destroys the Geographical Area #maps_area_h and
* releases all its resources.
* @since_tizen 2.4
*
- * @param[in] area The area #maps_area_s
+ * @param[in] area The area #maps_area_h
* @return 0 on success, otherwise a negative error value
* @retval #MAPS_ERROR_NONE Successful
* @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
/**
* @brief Clones the Geographical Area.
* @details This function makes a clone of the @a origin Geographical Area of
- * type #maps_area_s.
+ * type #maps_area_h.
* @since_tizen 2.4
* @remarks @a cloned must be released using maps_area_destroy().
*
- * @param[in] origin The area #maps_area_s to be copied
- * @param[out] cloned The cloned area #maps_area_s handle
+ * @param[in] origin The area #maps_area_h to be copied
+ * @param[out] cloned The cloned area #maps_area_h handle
* @return 0 on success, otherwise a negative error value
* @retval #MAPS_ERROR_NONE Successful
* @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
* @see maps_area_create_rectangle()
* @see maps_area_create_circle()
* @see maps_area_destroy()
- * @see maps_area_s
*/
int maps_area_clone(const maps_area_h origin, maps_area_h *cloned);
* @since_tizen 2.4
* @remarks To release the handle use maps_coordinates_destroy().
* \n To clone the handle use maps_coordinates_clone().
- *
- * @see maps_coordinates_create()
- * @see maps_coordinates_destroy()
- * @see maps_coordinates_clone()
*/
typedef void *maps_coordinates_h;
* \n The @a latitude must be in range of [-90.0, 90.0].
* \n The @a longitude must be in range of [-180.0, 180.0].
* @since_tizen 2.4
- * @remarks #maps_coordinates_h is a void pointer to the #maps_coordinates_s.
+ * @remarks #maps_coordinates_h is a void pointer to the #maps_coordinates_h.
+ * @warning Do not use #maps_coordinates_s directly if you are an application developer.
+ * Using #maps_coordinates_h is recommanded.
*
* @see maps_coordinates_h
- * @see maps_coordinates_create
- * @see maps_coordinates_clone
- * @see maps_coordinates_destroy
*/
typedef struct _maps_coordinates_s {
double latitude; /**< The latitude [-90.0 ~ 90.0] (degrees) */
double longitude; /**< The longitude [-180.0 ~ 180.0] (degrees) */
} maps_coordinates_s;
+/**
+ * @brief The coorinates list handle.
+ * @details The coorindates list handle can be obtained via calling of maps_coordinates_list_create().
+ * @since_tizen 3.0
+ */
+typedef void *maps_coordinates_list_h;
+
/*----------------------------------------------------------------------------*/
/**
* @brief Creates a new instance of Geographical Coordinates and initiates
* a handle with it.
* @details This function creates @a coordinates, a new instance of Geographical
- * Coordinates of type #maps_coordinates_s
+ * Coordinates of type #maps_coordinates_h
* with a specified @a latitude and @a longitude.
* \n New handle is assigned with this instance.
* @since_tizen 2.4
* @remarks @a coordinates must be released using maps_coordinates_destroy().
* \n @a coordinates may be cloned using maps_coordinates_clone().
*
- * @param[in] latitude Latitude
- * @param[in] longitude Longitude
- * @param[out] coordinates The coordinate handle
+ * @param[in] latitude The latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in] longitude The longitude [-180.0 ~ 180.0] (degrees)
+ * @param[out] coordinates The coordinates handle
* @return 0 on success, otherwise a negative error value
* @retval #MAPS_ERROR_NONE Successful
* @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
*
* @see maps_coordinates_clone()
* @see maps_coordinates_destroy()
- * @see maps_coordinates_s
*/
int maps_coordinates_create(const double latitude, const double longitude,
maps_coordinates_h *coordinates);
* @brief Destroys the Geographical Coordinates and releases all its
* resources.
* @details This function destroys the Geographical Coordinates
- * #maps_coordinates_s and releases all its resources.
+ * #maps_coordinates_h and releases all its resources.
* @since_tizen 2.4
*
* @param[in] coordinates The coordinate handle to destroy
/**
* @brief Clones the Geographical Coordinates.
* @details This function makes a clone of the @a origin Geographical
- * Coordinates of type #maps_coordinates_s.
+ * Coordinates of type #maps_coordinates_h.
* @since_tizen 2.4
* @remarks @a cloned must be released using maps_coordinates_destroy().
*
*
* @see maps_coordinates_create()
* @see maps_coordinates_destroy()
- * @see maps_coordinates_s
*/
int maps_coordinates_clone(const maps_coordinates_h origin,
maps_coordinates_h *cloned);
int maps_coordinates_get_longitude(const maps_coordinates_h coordinates,
double *longitude);
+/**
+ * @brief Gets the latitude and longitude of the coordinates.
+ * @details This function gets the @a longitude and @a longitude value of the
+ * coordinates handle.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates The coordinate handle
+ * @param[out] latitude The latitude of the coordinate handle
+ * @param[out] longitude The longitude of the coordinate handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_set_latitude_longitude()
+ */
+int maps_coordinates_get_latitude_longitude(const maps_coordinates_h coordinates,
+ double *latitude,
+ double *longitude);
/*----------------------------------------------------------------------------*/
/**
int maps_coordinates_set_longitude(maps_coordinates_h coordinates,
const double longitude);
+/**
+ * @brief Sets the latitude and longitude of the coordinates.
+ * @details This function sets the @a latitude and @a latitude value of the
+ * coordinates handle.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates The coordinates handle
+ * @param[in] latitude The latitude [-90.0 ~ 90.0] (degrees)
+ * @param[in] longitude The longitude [-180.0 ~ 180.0] (degrees)
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a coordinates are created using maps_coordinates_create().
+ *
+ * @see maps_coordinates_create()
+ * @see maps_coordinates_get_latitude_longitude()
+ */
+int maps_coordinates_set_latitude_longitude(maps_coordinates_h coordinates,
+ const double latitude,
+ const double longitude);
+
+/**
+ * @brief Creates a coordinates list having a set of coordinates.
+ * @since_tizen 3.0
+ *
+ * @param[out] coordinates_list The coordinates list handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_create(maps_coordinates_list_h *coordinates_list);
+
+/**
+ * @brief Frees all of the memory used by a coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates_list coordinates list handle
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ */
+int maps_coordinates_list_destroy(maps_coordinates_list_h coordinates_list);
+
+/**
+ * @brief Appends a coordinates to a coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates_list The coordinates list handle
+ * @param[in] coordinates The coordinates handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_append(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates);
+
+/**
+ * @brief Removes a coordinates from a coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates_list The coordinates list handle
+ * @param[in] coordinates The coordinates handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_remove(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates);
+
+/**
+ * @brief Gets the number of elements in an coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates_list The coordinates list handle
+ * @param[out] length The number of elements in the coordinates list
+ * @return 0 on success, otherwise a negative error value
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ */
+int maps_coordinates_list_get_length(maps_coordinates_list_h coordinates_list, int *length);
+
+/**
+ * @brief Called iteratively to get a coordinates information.
+ * @since_tizen 3.0
+ *
+ * @param[in] index The index of iteration
+ * @param[in] coordinates The handle of coordinates
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n
+ * @c false to break out of the loop
+ *
+ * @see batch_coordinates_foreach_coordinates()
+ */
+typedef bool (*maps_coordinates_cb) (int index, maps_coordinates_h coordinates, void *user_data);
+
+/**
+ * @brief Retrieves all coordinates by invoking a specific callback for each coordinates of coordinates list.
+ * @since_tizen 3.0
+ *
+ * @param[in] coordinates_list The coordinates list handle
+ * @param[in] callback The iteration callback
+ * @param[in] user_data The user data to be passed to the callback function
+ * @retval #MAPS_ERROR_NONE Successful
+ * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see maps_coordinates_list_create()
+ * @see maps_coordinates_list_destroy()
+ * @see maps_coordinates_list_get_length()
+ */
+int maps_coordinates_list_foreach(maps_coordinates_list_h coordinates_list, maps_coordinates_cb callback, void *user_data);
+
+
#ifdef __cplusplus
}
#endif
#include <maps_service.h>
#include <maps_plugin_info.h>
#include <maps_extra_types.h>
+#include <maps_plugin_types.h>
/**
*
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_PLUGIN_TYPES_H__
+#define __MAPS_PLUGIN_TYPES_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <glib.h>
+
+/**
+ * @brief Structure of the coordinates list.
+ * @since_tizen 2.4
+ * @remarks #maps_coordinates_list_h is a void pointer to the #maps_coordinates_list_s.
+ */
+typedef GList maps_coordinates_list_s;
+
+/**
+ * @brief Structure of the address list.
+ * @since_tizen 2.4
+ * @remarks #maps_address_list_h is a void pointer to the #maps_address_list_s.
+ */
+typedef GList maps_address_list_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MAPS_PLUGIN_TYPES_H__ */
+
+
* @brief Enumeration of allowed distance units.
* @details This enumeration represents allowed distance units used in Maps
* Services.
- * \n This enumeration is used in #maps_area_s.
* @since_tizen 2.4
*
* @see #maps_preference_h
* @brief Enumeration of allowed route optimization option.
* @details This enumeration represents allowed route optimization option used
* in Route Service.
- * \n This enumeration is used in #maps_area_s.
* @since_tizen 2.4
*
* @see #_maps_route_transport_mode_e
* @brief Enumeration of preferable route types.
* @details This enumeration represents allowed route types used in Route
* Service.
- * \n This enumeration is used in #maps_area_s.
* @since_tizen 2.4
*
* @see #_maps_distance_unit_e
* @brief Enumeration of route feature weights.
* @details This enumeration represents allowed route feature weights used in
* Route Service.
- * \n This enumeration is used in #maps_area_s.
* @since_tizen 2.4
*
* @see #_maps_distance_unit_e
* @brief Enumeration of route features.
* @details This enumeration represents allowed route features used in Route
* Service.
- * \n This enumeration is used in #maps_area_s.
* @since_tizen 2.4
*
* @see #_maps_distance_unit_e
Name: capi-maps-service
Summary: Tizen Maps Service API
-Version: 0.4.6
+Version: 0.5.0
Release: 1
Group: Location/API
License: Apache-2.0
#include <glib.h>
#include "maps_error.h"
+#include "maps_plugin_types.h"
#include "maps_address.h"
#include "maps_util.h"
return maps_set_string(freetext, _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH,
&((maps_address_s *) address)->freetext);
}
+
+/*
+ * Tizen 3.0
+ */
+
+EXPORT_API int maps_address_list_create(maps_address_list_h *address_list)
+{
+ if (!address_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = g_list_alloc();
+ MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+ *address_list = (void *) list;
+ MAPS_LOGD("address_list: %p", list);
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_append(maps_address_list_h address_list, maps_address_h address)
+{
+ if (!address_list || !address)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = g_list_append((GList *)address_list, (gpointer) address);
+ MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+ address_list = list;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_remove(maps_address_list_h address_list, maps_address_h address)
+{
+ if (!address_list || !address)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = g_list_remove((GList *) address_list, (gpointer) address);
+ MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+ address_list = list;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_get_length(maps_address_list_h address_list, int *length)
+{
+ if (!address_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ *length = g_list_length((GList *)address_list) - 1;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_address_list_foreach(maps_address_list_h address_list, maps_address_cb callback, void *user_data)
+{
+ if (!address_list || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ bool ret = true;
+ int index = 0;
+
+ GList *l = (GList *)address_list;
+ l = g_list_first(l);
+ while (l != NULL)
+ {
+ GList *next = l->next;
+ maps_address_s *address = (maps_address_s *)l->data;
+ if (address) {
+ /*
+ int ret = callback(index++, address->country_code, address->country, addres->county, address->state,
+ address->city, address->district, addrss->street, address->building_number, address->freetext, user_data);
+ */
+ ret = callback(index++, address, user_data);
+ }
+ if (ret)
+ l = next;
+ else
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+}
+
+static void _free_address(gpointer data, gpointer user_data)
+{
+ maps_address_h address = (maps_address_h) data;
+ maps_address_h address_list = (maps_address_list_h) user_data;
+ int ret;
+
+ if (address) {
+ MAPS_LOGD("%p", address);
+ ret = maps_address_destroy(address);
+ if (ret) {
+ MAPS_LOGI("Failed to maps_address_destroy!!!");
+ }
+ }
+
+ if (address_list) {
+ ret = maps_address_list_remove(address_list, address);
+ if (ret) {
+ MAPS_LOGI("Failed to maps_address_list_remove!!!");
+ }
+ }
+ address = NULL;
+}
+
+EXPORT_API int maps_address_list_destroy(maps_address_list_h address_list)
+{
+ if (!address_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = (GList *) address_list;
+ MAPS_LOGD("address_list:%p, length = %d", list, g_list_length(list));
+
+ list = g_list_first(list);
+ g_list_foreach(list, _free_address, list);
+ g_list_free(list);
+ address_list = NULL;
+
+ return MAPS_ERROR_NONE;
+}
+
#include <glib.h>
#include "maps_error.h"
+#include "maps_plugin_types.h"
#include "maps_coordinates.h"
#include "maps_util.h"
return MAPS_ERROR_NONE;
}
+EXPORT_API int maps_coordinates_get_latitude_longitude(const maps_coordinates_h coords,
+ double *latitude,
+ double *longitude)
+{
+ if (!coords || !latitude || !longitude)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ *latitude = ((maps_coordinates_s *) coords)->latitude;
+ *longitude = ((maps_coordinates_s *) coords)->longitude;
+ return MAPS_ERROR_NONE;
+}
+
/*----------------------------------------------------------------------------*/
EXPORT_API int maps_coordinates_set_latitude(maps_coordinates_h coords,
((maps_coordinates_s *) coords)->longitude = longitude;
return MAPS_ERROR_NONE;
}
+
+EXPORT_API int maps_coordinates_set_latitude_longitude(maps_coordinates_h coords,
+ const double latitude,
+ const double longitude)
+{
+ if (!coords)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ MAPS_CHECK_CONDITION(latitude >= -90
+ && latitude <= 90, MAPS_ERROR_INVALID_PARAMETER,
+ "MAPS_ERROR_INVALID_PARAMETER");
+ MAPS_CHECK_CONDITION(longitude >= -180
+ && longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
+ "MAPS_ERROR_INVALID_PARAMETER");
+ ((maps_coordinates_s *) coords)->latitude = latitude;
+ ((maps_coordinates_s *) coords)->longitude = longitude;
+ return MAPS_ERROR_NONE;
+}
+
+/*
+ * Tizen 3.0
+ */
+
+EXPORT_API int maps_coordinates_list_create(maps_coordinates_list_h *coordinates_list)
+{
+ if (!coordinates_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = g_list_alloc();
+ MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+ *coordinates_list = (void *) list;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_append(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
+{
+ if (!coordinates_list || !coordinates)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = g_list_append((GList *) coordinates_list, (gpointer) coordinates);
+ /*
+ Although this logic is faster, it doesn't guarantee the order of item.
+ GList *list = g_list_prepend((GList *) coordinates_list, (gpointer) coordinates);
+ list = g_list_reverse(list);
+ */
+
+ MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+ coordinates_list = (void *) list;
+
+ return MAPS_ERROR_NONE;
+}
+
+static void _free_coordinates(gpointer data, gpointer user_data)
+{
+ maps_coordinates_h coordinates = (maps_coordinates_h) data;
+ maps_coordinates_list_h coordinates_list = (maps_coordinates_list_h) user_data;
+ int ret = 0;
+
+ if (coordinates) {
+ ret = maps_coordinates_destroy(coordinates);
+ if (ret) {
+ MAPS_LOGI("Failed to maps_coordinates_destroy!!!");
+ }
+ }
+
+ if (coordinates_list) {
+ ret = maps_coordinates_list_remove(coordinates_list, coordinates);
+ if (ret) {
+ MAPS_LOGI("Failed to maps_coordinates_list_remove!!!");
+ }
+ }
+ coordinates = NULL;
+}
+
+EXPORT_API int maps_coordinates_list_destroy(maps_coordinates_list_h coordinates_list)
+{
+ if (!coordinates_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = (GList *) coordinates_list;
+ MAPS_LOGD("length = %d", g_list_length(list));
+
+ list = g_list_first(list);
+ g_list_foreach(list, _free_coordinates, list);
+ g_list_free(list);
+ coordinates_list = NULL;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_remove(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
+{
+ if (!coordinates_list || !coordinates)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ GList *list = g_list_remove((GList *)coordinates_list, (gpointer) coordinates);
+ MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+ coordinates_list = (void *) list;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_get_length(maps_coordinates_list_h coordinates_list, int *length)
+{
+ if (!coordinates_list)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ *length = g_list_length((GList *)coordinates_list) - 1;
+
+ return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_coordinates_list_foreach(maps_coordinates_list_h coordinates_list, maps_coordinates_cb callback, void *user_data)
+{
+ if (!coordinates_list || !callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
+
+ bool ret = true;
+ int index = 0;
+
+ GList *list = (GList *)coordinates_list;
+ list = g_list_first(list);
+ while (list != NULL)
+ {
+ GList *next = list->next;
+ maps_coordinates_s *coordinates = (maps_coordinates_s *)list->data;
+ if (coordinates) {
+ /*
+ int ret = callback(index++, coordinates->latitude, coordinates->longitude, user_data);
+ */
+ MAPS_LOGD("index = %d", index);
+ ret = callback(index++, coordinates, user_data);
+ }
+ if (ret)
+ list = next;
+ else
+ break;
+ }
+
+ return MAPS_ERROR_NONE;
+}
* limitations under the License.
*/
+#include <glib.h>
#include "maps_error.h"
#include "maps_route_maneuver_plugin.h"
#include "maps_extra_types.h"
-#include <glib.h>
#include "maps_util.h"
typedef struct _maps_route_maneuver_s
* limitations under the License.
*/
+#include <glib.h>
#include "maps_error.h"
#include "maps_route_segment_plugin.h"
#include "maps_route_maneuver_plugin.h"
#include "maps_extra_types.h"
-#include <glib.h>
#include "maps_util.h"
#include "maps_route_segment_private.h"
#ifndef __MAPS_SERVICE_PLUGIN_DISCOVERY_H__
#define __MAPS_SERVICE_PLUGIN_DISCOVERY_H__
-#include "maps_service.h"
#include "maps_util.h"
namespace plugin
* limitations under the License.
*/
+#include <glib/gstdio.h>
#include "module.h"
#include "maps_util.h"
-#include <glib/gstdio.h>
#include "thread.h"
#include "command.h"
#include "command_queue.h"
extern const char *MAPS_PLUGINS_PATH_PREFIX;
- plugin::scope_mutex::scope_mutex(GMutex *m) : mutex(m)
+plugin::scope_mutex::scope_mutex(GMutex *m) : mutex(m)
{
g_mutex_lock(mutex);
}