From: Young-Ae Kang Date: Wed, 21 Oct 2015 12:37:15 +0000 (+0900) Subject: [ACR-442] Added lists of maps_coordinates and maps_address. X-Git-Tag: submit/tizen/20151119.032512~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac9c18c1c66abbc06f27c95a118722dd46a3392f;p=platform%2Fcore%2Fapi%2Fmaps-service.git [ACR-442] Added lists of maps_coordinates and maps_address. Change-Id: I2199887caea64ba6cb7860dfb99f0361390f8913 --- diff --git a/capi-maps-service.changes b/capi-maps-service.changes index bafc0bb..5f3083b 100644 --- a/capi-maps-service.changes +++ b/capi-maps-service.changes @@ -1,3 +1,8 @@ +[Version] capi-maps-service_0.5.0 +[Date] 21 October 2015 +[Title] Added coordinates address list API. +[Developer] Young-Ae Kang + [Version] capi-maps-service_0.4.6 [Date] 16 September 2015 [Title] Added -fvisibility=hidden to make EXPORT_API useful. diff --git a/include/maps_address.h b/include/maps_address.h old mode 100644 new mode 100755 index 726a7c3..3279158 --- a/include/maps_address.h +++ b/include/maps_address.h @@ -35,19 +35,19 @@ extern "C" { #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; + /*----------------------------------------------------------------------------*/ /** @@ -489,6 +489,112 @@ int maps_address_set_postal_code(maps_address_h address, */ 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 diff --git a/include/maps_area.h b/include/maps_area.h old mode 100644 new mode 100755 index f122d84..840aabb --- a/include/maps_area.h +++ b/include/maps_area.h @@ -56,10 +56,7 @@ typedef void *maps_area_h; * @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. */ @@ -71,10 +68,9 @@ typedef enum { * @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 @@ -87,13 +83,11 @@ typedef struct _maps_area_rectangle_s { * @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; @@ -102,11 +96,10 @@ typedef struct _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. */ @@ -123,7 +116,7 @@ typedef struct _maps_area_s { /** * @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(). @@ -145,7 +138,6 @@ typedef struct _maps_area_s { * @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() */ @@ -156,12 +148,14 @@ int maps_area_create_rectangle(const maps_coordinates_h top_left, /** * @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 @@ -176,20 +170,21 @@ int maps_area_create_rectangle(const maps_coordinates_h top_left, * @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 @@ -206,12 +201,12 @@ int maps_area_destroy(maps_area_h area); /** * @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 @@ -223,7 +218,6 @@ int maps_area_destroy(maps_area_h area); * @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); diff --git a/include/maps_coordinates.h b/include/maps_coordinates.h old mode 100644 new mode 100755 index 28b142f..3ac1b10 --- a/include/maps_coordinates.h +++ b/include/maps_coordinates.h @@ -39,10 +39,6 @@ extern "C" { * @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; @@ -53,34 +49,40 @@ 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 @@ -88,7 +90,6 @@ typedef struct _maps_coordinates_s { * * @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); @@ -97,7 +98,7 @@ int maps_coordinates_create(const double latitude, const double longitude, * @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 @@ -115,7 +116,7 @@ int maps_coordinates_destroy(maps_coordinates_h coordinates); /** * @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(). * @@ -130,7 +131,6 @@ int maps_coordinates_destroy(maps_coordinates_h coordinates); * * @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); @@ -175,6 +175,27 @@ int maps_coordinates_get_latitude(const maps_coordinates_h coordinates, 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); /*----------------------------------------------------------------------------*/ /** @@ -215,6 +236,131 @@ int maps_coordinates_set_latitude(maps_coordinates_h coordinates, 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 diff --git a/include/maps_extra_types.h b/include/maps_extra_types.h old mode 100644 new mode 100755 diff --git a/include/maps_plugin.h b/include/maps_plugin.h old mode 100644 new mode 100755 index 93e8256..dfef0d5 --- a/include/maps_plugin.h +++ b/include/maps_plugin.h @@ -20,6 +20,7 @@ #include #include #include +#include /** * diff --git a/include/maps_plugin_types.h b/include/maps_plugin_types.h new file mode 100755 index 0000000..5b2ff1d --- /dev/null +++ b/include/maps_plugin_types.h @@ -0,0 +1,46 @@ +/* + * 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 + +/** + * @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__ */ + + diff --git a/include/maps_preference.h b/include/maps_preference.h index d9cbb95..5e71fec 100644 --- a/include/maps_preference.h +++ b/include/maps_preference.h @@ -165,7 +165,6 @@ typedef void *maps_preference_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 @@ -181,7 +180,6 @@ typedef enum _maps_distance_unit_e { * @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 @@ -210,7 +208,6 @@ typedef enum _maps_route_optimization_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 @@ -240,7 +237,6 @@ typedef enum _maps_route_transport_mode_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 @@ -268,7 +264,6 @@ typedef enum _maps_route_feature_weight_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 diff --git a/packaging/capi-maps-service.spec b/packaging/capi-maps-service.spec index 5acb390..5525619 100644 --- a/packaging/capi-maps-service.spec +++ b/packaging/capi-maps-service.spec @@ -1,6 +1,6 @@ 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 diff --git a/src/api/maps_address.cpp b/src/api/maps_address.cpp index 389fa2c..921eb66 100755 --- a/src/api/maps_address.cpp +++ b/src/api/maps_address.cpp @@ -16,6 +16,7 @@ #include #include "maps_error.h" +#include "maps_plugin_types.h" #include "maps_address.h" #include "maps_util.h" @@ -369,3 +370,124 @@ EXPORT_API int maps_address_set_freetext(maps_address_h address, 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; +} + diff --git a/src/api/maps_coordinates.cpp b/src/api/maps_coordinates.cpp index 2b576d9..39eb156 100755 --- a/src/api/maps_coordinates.cpp +++ b/src/api/maps_coordinates.cpp @@ -16,6 +16,7 @@ #include #include "maps_error.h" +#include "maps_plugin_types.h" #include "maps_coordinates.h" #include "maps_util.h" @@ -103,6 +104,17 @@ EXPORT_API int maps_coordinates_get_longitude(const maps_coordinates_h coords, 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, @@ -128,3 +140,144 @@ EXPORT_API int maps_coordinates_set_longitude(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; +} diff --git a/src/api/maps_route_maneuver.cpp b/src/api/maps_route_maneuver.cpp index 21b3196..0e0e7af 100755 --- a/src/api/maps_route_maneuver.cpp +++ b/src/api/maps_route_maneuver.cpp @@ -14,10 +14,10 @@ * limitations under the License. */ +#include #include "maps_error.h" #include "maps_route_maneuver_plugin.h" #include "maps_extra_types.h" -#include #include "maps_util.h" typedef struct _maps_route_maneuver_s diff --git a/src/api/maps_route_segment.cpp b/src/api/maps_route_segment.cpp index 5444c3c..0a3c8fd 100755 --- a/src/api/maps_route_segment.cpp +++ b/src/api/maps_route_segment.cpp @@ -14,11 +14,11 @@ * limitations under the License. */ +#include #include "maps_error.h" #include "maps_route_segment_plugin.h" #include "maps_route_maneuver_plugin.h" #include "maps_extra_types.h" -#include #include "maps_util.h" #include "maps_route_segment_private.h" diff --git a/src/plugin/discovery.h b/src/plugin/discovery.h index 32c3534..27d5aa6 100755 --- a/src/plugin/discovery.h +++ b/src/plugin/discovery.h @@ -17,7 +17,6 @@ #ifndef __MAPS_SERVICE_PLUGIN_DISCOVERY_H__ #define __MAPS_SERVICE_PLUGIN_DISCOVERY_H__ -#include "maps_service.h" #include "maps_util.h" namespace plugin diff --git a/src/plugin/module.cpp b/src/plugin/module.cpp index 9626cfb..01a4103 100755 --- a/src/plugin/module.cpp +++ b/src/plugin/module.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ +#include #include "module.h" #include "maps_util.h" -#include #include "thread.h" #include "command.h" #include "command_queue.h" @@ -24,7 +24,7 @@ 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); }