From e1e3919bb1bbbf18a84cf26b2ad6155e66878cc1 Mon Sep 17 00:00:00 2001 From: "kj7.sung" Date: Mon, 6 Jul 2015 17:05:20 +0900 Subject: [PATCH] Sync with tizen_2.4 Change-Id: I49c5b05da65a7d89a307379ad8fddf61b6f8f039 Signed-off-by: kj7.sung --- doc/maps_service_doc.h | 17 +- include/maps_address.h | 2 +- include/maps_area.h | 20 +- include/maps_coordinates.h | 2 +- include/maps_error.h | 7 +- include/maps_extra_types.h | 10 +- include/maps_place_filter.h | 6 - include/maps_place_plugin.h | 2 +- include/maps_plugin.h | 2 +- include/maps_plugin_info.h | 2 +- include/maps_preference.h | 2 +- include/maps_route.h | 12 +- include/maps_route_plugin.h | 11 +- include/maps_service.h | 66 ++---- packaging/capi-maps-service.spec | 13 +- src/api/maps_area.cpp | 32 +-- src/api/maps_coordinates.cpp | 7 + src/api/maps_place_filter.cpp | 20 -- src/api/maps_place_image.cpp | 4 +- src/api/maps_place_rating.cpp | 4 +- src/api/maps_preference.cpp | 14 ++ src/api/maps_route.cpp | 10 +- src/api/maps_route_maneuver.cpp | 10 +- src/api/maps_service.cpp | 8 +- src/plugin/empty_module.cpp | 211 +++++++++++++++++ src/plugin/empty_module.h | 185 +-------------- src/plugin/module.cpp | 9 +- src/session/command.cpp | 4 +- src/session/command_queue.cpp | 13 +- src/session/command_queue.h | 12 +- src/session/commands.cpp | 443 ++++++++++++++++++++++++++--------- src/session/commands.h | 266 ++++++++++++++++++--- src/session/thread.cpp | 5 +- src/session/thread.h | 2 +- test/CMakeLists.txt | 68 +----- test/capi-maps-service-test.manifest | 5 + test/maps-service-test.manifest | 20 -- test/maps-service-test.rule | 87 ------- test/src/api/maps_api_test.cpp | 72 +++++- test/src/api/maps_area_test.cpp | 74 ++---- test/src/maps_service_test.cpp | 6 +- test/src/util/maps_object.cpp | 12 +- test/src/util/maps_object.h | 4 +- 43 files changed, 1059 insertions(+), 722 deletions(-) mode change 100755 => 100644 include/maps_extra_types.h mode change 100755 => 100644 include/maps_preference.h create mode 100755 src/plugin/empty_module.cpp mode change 100644 => 100755 src/session/commands.cpp create mode 100755 test/capi-maps-service-test.manifest delete mode 100755 test/maps-service-test.manifest delete mode 100755 test/maps-service-test.rule diff --git a/doc/maps_service_doc.h b/doc/maps_service_doc.h index d37c320..4012ac1 100644 --- a/doc/maps_service_doc.h +++ b/doc/maps_service_doc.h @@ -43,7 +43,7 @@ * * * - * @section CAPI_LOCATION_FRAMEWORK_FEATURES Features + * @section CAPI_MAPS_SERVICE_MODULE_FEATURE Features * * Geocoding * - The Maps Geocoding API allows mapping an address to its geographical @@ -113,6 +113,19 @@ * . * The developer is allowed to choose one of map providers by manipulating map * plugins. + * + * @if WEARABLE + * @section CAPI_MAPS_SERVICE_MODULE_FEATURE Related Features + * This API is related with the following features: + * - http://tizen.org/feature/network.internet + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature Element. */ -#endif /*__MAPS_SERVICE_DOC_H__ */ \ No newline at end of file +#endif /*__MAPS_SERVICE_DOC_H__ */ diff --git a/include/maps_address.h b/include/maps_address.h index 182b2c6..726a7c3 100644 --- a/include/maps_address.h +++ b/include/maps_address.h @@ -18,7 +18,7 @@ #define __MAPS_ADDRESS_H__ /** - * @ingroup CAPI_MAPS_GEOCODER_MODULE + * @ingroup CAPI_MAPS_SERVICE_MODULE * @defgroup CAPI_MAPS_ADDRESS_MODULE Address * * @file maps_address.h diff --git a/include/maps_area.h b/include/maps_area.h index df86aff..f122d84 100644 --- a/include/maps_area.h +++ b/include/maps_area.h @@ -20,7 +20,7 @@ #include /** - * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE + * @ingroup CAPI_MAPS_SERVICE_MODULE * @defgroup CAPI_MAPS_GEOAREA_MODULE Area * * @file maps_area.h @@ -77,9 +77,9 @@ typedef enum { * @see maps_area_s */ typedef struct _maps_area_rectangle_s { - maps_coordinates_s left_top; /**< left top position + maps_coordinates_s top_left; /**< The top left position of rectangle. */ - maps_coordinates_s right_bottom; /**< The right bottom position + maps_coordinates_s bottom_right; /**< The bottom right position of rectangle. */ } maps_area_rectangle_s; @@ -128,18 +128,18 @@ typedef struct _maps_area_s { * @since_tizen 2.4 * @remarks @a area must be released using maps_area_destroy(). * \n @a area may be cloned using maps_area_clone(). - * \n @a left_top and @a right_bottom must be released using + * \n @a top_left and @a bottom_right must be released using * maps_coordinates_destroy(). * - * @param[in] left_top The left top position - * @param[in] right_bottom The right bottom position + * @param[in] top_left The left top position + * @param[in] bottom_right The right bottom position * @param[out] area The area handle * @return 0 on success, otherwise a negative error value * @retval #MAPS_ERROR_NONE Successful * @retval #MAPS_ERROR_OUT_OF_MEMORY Out of memory * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter * - * @pre @a left_top and @a right_bottom are created using + * @pre @a top_left and @a bottom_right are created using * maps_coordinates_create(). * * @see maps_area_clone() @@ -149,8 +149,8 @@ typedef struct _maps_area_s { * @see maps_coordinates_create() * @see maps_coordinates_destroy() */ -int maps_area_create_rectangle(const maps_coordinates_h left_top, - const maps_coordinates_h right_bottom, +int maps_area_create_rectangle(const maps_coordinates_h top_left, + const maps_coordinates_h bottom_right, maps_area_h *area); /** @@ -160,7 +160,7 @@ int maps_area_create_rectangle(const maps_coordinates_h left_top, * 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 left_top and @a right_bottom must be released using + * \n @a top_left and @a bottom_right must be released using * maps_coordinates_destroy(). * * @param[in] center The central position of the area diff --git a/include/maps_coordinates.h b/include/maps_coordinates.h index 7ab94f3..28b142f 100644 --- a/include/maps_coordinates.h +++ b/include/maps_coordinates.h @@ -18,7 +18,7 @@ #define __MAPS_COORDINATES_H__ /** - * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE + * @ingroup CAPI_MAPS_SERVICE_MODULE * @defgroup CAPI_MAPS_COORDS_MODULE Coordinates * * @file maps_coordinates.h diff --git a/include/maps_error.h b/include/maps_error.h index 4a181ea..948998c 100644 --- a/include/maps_error.h +++ b/include/maps_error.h @@ -21,7 +21,7 @@ #include /** - * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE + * @ingroup CAPI_MAPS_SERVICE_MODULE * @defgroup CAPI_MAPS_ERROR_MODULE Errors * * @file maps_error.h @@ -59,9 +59,10 @@ typedef enum _maps_error_e { MAPS_ERROR_KEY_NOT_AVAILABLE = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Invalid key */ MAPS_ERROR_RESOURCE_BUSY = - TIZEN_ERROR_RESOURCE_BUSY, /**< Places service busy */ + TIZEN_ERROR_RESOURCE_BUSY, /**< Maps Service busy */ MAPS_ERROR_CANCELED = - TIZEN_ERROR_CANCELED, /**< Places service aborted */ + TIZEN_ERROR_CANCELED, /**< Maps Service + request aborted */ MAPS_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN, /**< Unknown error */ MAPS_ERROR_SERVICE_NOT_AVAILABLE = diff --git a/include/maps_extra_types.h b/include/maps_extra_types.h old mode 100755 new mode 100644 index d2e0231..033e9db --- a/include/maps_extra_types.h +++ b/include/maps_extra_types.h @@ -20,7 +20,7 @@ #include /** - * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE + * @ingroup CAPI_MAPS_PREFERENCE_MODULE * @defgroup CAPI_MAPS_CONTAINERS_MODULE Container Data Types * * @file maps_extra_types.h @@ -38,7 +38,7 @@ extern "C" { /** * @ingroup CAPI_MAPS_CONTAINERS_MODULE - * @defgroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_LIST List of item pointers + * @defgroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_LIST Maps Item Lists * * @file maps_extra_types.h * @brief This section contains API for using List of item pointers. @@ -278,8 +278,7 @@ int maps_item_list_remove_all(maps_item_list_h list, /** * @ingroup CAPI_MAPS_CONTAINERS_MODULE - * @defgroup CAPI_MAPS_CONTAINERS_MODULE_STRING_HASHTABLE Hash Table of - * strings + * @defgroup CAPI_MAPS_CONTAINERS_MODULE_STRING_HASHTABLE Maps String Hash Tables * * @file maps_extra_types.h * @brief This section contains API for using Hash Table of strings. @@ -526,8 +525,7 @@ int maps_string_hashtable_contains(maps_string_hashtable_h table, /** * @ingroup CAPI_MAPS_CONTAINERS_MODULE - * @defgroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE Hash Table of - * arbitrary items + * @defgroup CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE Maps Item Hash Tables * * @file maps_extra_types.h * @brief This section contains API for using Hash Table of arbitrary items. diff --git a/include/maps_place_filter.h b/include/maps_place_filter.h index fe2f98c..6192c59 100644 --- a/include/maps_place_filter.h +++ b/include/maps_place_filter.h @@ -223,9 +223,6 @@ int maps_place_filter_get_place_name(const maps_place_filter_h filter, int maps_place_filter_get_category(const maps_place_filter_h filter, maps_place_category_h *category); -int maps_place_filter_get_cateory(const maps_place_filter_h filter, - maps_place_category_h *category) __attribute__ ((deprecated)); - /** * @brief Retrieves all filter properties. * @details This function retrieves all place filter properties. @@ -335,9 +332,6 @@ int maps_place_filter_set_place_name(maps_place_filter_h filter, int maps_place_filter_set_category(maps_place_filter_h filter, const maps_place_category_h category); -int maps_place_filter_set_cateory(maps_place_filter_h filter, - const maps_place_category_h category) __attribute__ ((deprecated)); - #ifdef __cplusplus } #endif diff --git a/include/maps_place_plugin.h b/include/maps_place_plugin.h index 4785a95..3711388 100644 --- a/include/maps_place_plugin.h +++ b/include/maps_place_plugin.h @@ -21,7 +21,7 @@ /** * @ingroup CAPI_MAPS_PLUGIN_MODULE - * @defgroup CAPI_MAPS_PLUGIN_PLACE_MODULE Place + * @defgroup CAPI_MAPS_PLUGIN_PLACE_MODULE Places */ /** diff --git a/include/maps_plugin.h b/include/maps_plugin.h index 3d99f80..19b4ea3 100644 --- a/include/maps_plugin.h +++ b/include/maps_plugin.h @@ -23,7 +23,7 @@ /** * * @ingroup CAPI_MAPS_PLUGIN_MODULE - * @defgroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE Maps Plugin & Providers + * @defgroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE Maps Plugin and Providers * * @file maps_plugin.h * @brief This file contains the top level functions of Maps Plugin API diff --git a/include/maps_plugin_info.h b/include/maps_plugin_info.h index bd85c5e..17176a6 100644 --- a/include/maps_plugin_info.h +++ b/include/maps_plugin_info.h @@ -19,7 +19,7 @@ /** * - * @ingroup CAPI_MAPS_PLUGIN_MODULE + * @ingroup CAPI_MAPS_PLUGIN_AND_PROVIDERS_MODULE * @defgroup CAPI_MAPS_PLUGIN_INFO_MODULE Plugin info * * @file maps_plugin_info.h diff --git a/include/maps_preference.h b/include/maps_preference.h old mode 100755 new mode 100644 index cc18fea..d1d8643 --- a/include/maps_preference.h +++ b/include/maps_preference.h @@ -24,7 +24,7 @@ extern "C" { #endif /** - * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE + * @ingroup CAPI_MAPS_SERVICE_MODULE * @defgroup CAPI_MAPS_PREFERENCE_MODULE Preference * * @file maps_preference.h diff --git a/include/maps_route.h b/include/maps_route.h index dd8b3c2..f7239bb 100644 --- a/include/maps_route.h +++ b/include/maps_route.h @@ -24,19 +24,13 @@ #include /** - * @ingroup CAPI_MAPS_PLUGIN_MODULE - * @defgroup CAPI_MAPS_PLUGIN_ROUTE_MODULE Route - */ - -/** - * - * @ingroup CAPI_MAPS_PLUGIN_ROUTE_MODULE - * @defgroup CAPI_MAPS_PLUGIN_ROUTE_DATA_MODULE Route + * @ingroup CAPI_MAPS_ROUTE_MODULE + * @defgroup CAPI_MAPS_ROUTE_DATA_MODULE Route * * @file maps_route.h * @brief This file contains the functions related to Route information. * - * @addtogroup CAPI_MAPS_PLUGIN_ROUTE_DATA_MODULE + * @addtogroup CAPI_MAPS_ROUTE_DATA_MODULE * @{ * @brief This provides APIs related to Route information, used in Route Search. */ diff --git a/include/maps_route_plugin.h b/include/maps_route_plugin.h index e33309b..7aa15f5 100644 --- a/include/maps_route_plugin.h +++ b/include/maps_route_plugin.h @@ -20,15 +20,20 @@ #include /** + * @ingroup CAPI_MAPS_PLUGIN_MODULE + * @defgroup CAPI_MAPS_PLUGIN_ROUTE_MODULE Routes + */ + +/** * - * @ingroup CAPI_MAPS_ROUTE_MODULE - * @defgroup CAPI_MAPS_ROUTE_DATA_MODULE Route + * @ingroup CAPI_MAPS_PLUGIN_ROUTE_MODULE + * @defgroup CAPI_MAPS_PLUGIN_ROUTE_DATA_MODULE Route * * @file maps_route_plugin.h * @brief This file contains the functions related to Route * information, needed in plug-in development. * - * @addtogroup CAPI_MAPS_ROUTE_DATA_MODULE + * @addtogroup CAPI_MAPS_PLUGIN_ROUTE_DATA_MODULE * @{ * @brief This provides APIs related to Route information, used in * Route Search, needed in plug-in development. diff --git a/include/maps_service.h b/include/maps_service.h index 1cab302..dc4bf9d 100644 --- a/include/maps_service.h +++ b/include/maps_service.h @@ -38,18 +38,16 @@ extern "C" { /*----------------------------------------------------------------------------*/ /* - * Maps Service & Preference + * Maps Service and Preference */ /** * @ingroup CAPI_MAPS_SERVICE_MODULE - * @defgroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE Maps Service & - * Preference + * @defgroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE Service and Providers * * @addtogroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE * @{ - * @brief This provides APIs related to operations with Maps, Locations and Maps - * Provider plug-ins + * @brief This provides APIs related Search and Preference. * */ @@ -117,8 +115,7 @@ typedef enum _maps_service_data_e { /** * @brief The Maps Service handle - * @details The Maps Service handle can be created via calling of - * maps_service_create(). + * @details The Maps Service handle can be created by calling of maps_service_create(). * \n To release the handle use maps_service_destroy(). * @since_tizen 2.4 * @privlevel public @@ -130,9 +127,8 @@ typedef enum _maps_service_data_e { typedef void *maps_service_h; /** - * @brief Called when requesting the list of available Maps Providers. - * @details A Maps Service invokes this callback while iterating through the - * list of available Maps Providers. + * @brief Called when requesting available Maps Providers. + * @details A Maps Service invokes this callback iteratively as long as available Maps Providers exist. * @since_tizen 2.4 * @remarks The string @a maps_provider must be released using free(). * @@ -151,12 +147,12 @@ typedef bool(*maps_service_provider_info_cb) (char *maps_provider, void *user_data); /** - * @brief Gets the list of available Maps Providers. - * @details This function delivers a list of available Maps Providers via + * @brief Gets available Maps Providers. + * @details This function delivers available Maps Providers via * maps_service_provider_info_cb() callback. * @since_tizen 2.4 * - * @param[in] callback The callback function to receive Maps Providers + * @param[in] callback The callback function to receive avarilable Maps Providers * information * @param[out] user_data The user data to be passed to the callback * function @@ -184,13 +180,11 @@ int maps_service_foreach_provider(maps_service_provider_info_cb callback, * @privlevel public * @privilege %http://tizen.org/privilege/mapservice * @remarks @a maps service handle must be released using maps_service_destroy(). - * \n To choose the Maps Provider request the list of available Providers using - * maps_service_foreach_provider(). - * \n To set up and tune the Maps Service use maps_service_set_provider_key() - * and maps_service_set_preference(). - * \n To check the Maps Provider capabilities use - * maps_service_provider_is_service_supported() and - * maps_service_provider_is_data_supported(). + * \n use maps_service_foreach_provider() to choose one of available Providers. + * \n use maps_service_set_provider_key() to set provider's key. + * \n use use maps_service_set_preference() to set various options of Maps Provider. + * \n use maps_service_provider_is_service_supported() and maps_service_provider_is_data_supported() + * to check the Maps Provider's capabilities * * @param[in] maps_provider The name of Maps Provider * @param[out] maps A handle of the new Maps Service on success @@ -202,8 +196,7 @@ int maps_service_foreach_provider(maps_service_provider_info_cb callback, * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported * @retval #MAPS_ERROR_PERMISSION_DENIED Permission Denied * - * @pre Call maps_service_foreach_provider() to get a list of available Maps - * Providers. + * @pre Call maps_service_foreach_provider() to get a available Maps Providers. * * @see maps_service_foreach_provider() * @see maps_service_destroy() @@ -224,8 +217,7 @@ int maps_service_create(const char *maps_provider, maps_service_h *maps); /** * @brief Destroys the Maps Service handle and releases all its resources. - * @details This function destroys Maps Service, releases its handle, shuts down - * current Map Provider and releases all used resources. + * @details This function releases all used resources of the Maps Service and Maps Provider. * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/mapservice @@ -243,20 +235,20 @@ int maps_service_create(const char *maps_provider, maps_service_h *maps); int maps_service_destroy(maps_service_h maps); /** - * @brief Sets the Maps Key to be used in the Maps Service requests. - * @details This function sets the Maps Key which will be used in each Maps + * @brief Sets the Maps Key to be used in the requests of Maps Service. + * @details This function sets the Maps Provider's Key which will be used in each Maps * Service request to Maps Provider. * \n Maps key can be obtained with maps_service_get_provider_key(). * @since_tizen 2.4 - * @remarks To get the @a provider_key refer to corresponding Maps Provider + * @remarks To get the @a provider_key, refer to corresponding Maps Provider * documentation. - * \n For MapQuest refer to http://developer.mapquest.com/, - * http://open.mapquestapi.com. - * \n For HERE Maps refer to https://developer.here.com/, - * https://developer.here.com/rest-apis. + * \n To get app_id and app_code of HERE, visit https://developer.here.com/, https://developer.here.com/rest-apis. + * \n To get a MapQuest AppKey, visit http://developer.mapquest.com/, http://open.mapquestapi.com. * * @param[in] maps The Maps Service handle * @param[in] provider_key The Maps Key to be used + * \n In case of combinging two more strings, use slash("/") as a delimeter. + * \n e.g. For HERE "app_id/app_code" * @return 0 on success, otherwise a negative error value * @retval #MAPS_ERROR_NONE Successful * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter @@ -478,8 +470,6 @@ int maps_service_cancel_request(const maps_service_h maps, int request_id); * @since_tizen 2.4 * @remarks The parameter @a coordinates must be released using * maps_coordinates_destroy(). - * \n To use the @a coordinates outside of this function, copy the handle using - * maps_coordinates_clone() function.\n * * @param[in] result The result of request * @param[in] request_id The id of request @@ -512,8 +502,6 @@ typedef bool(*maps_service_geocode_cb) (maps_error_e result, int request_id, * \n If search is failed, the value of @a total is 0 and @a address is NULL * @remarks The parameter @a address must be released using * maps_address_destroy(). - * \n To use the @a address outside of this function, copy the handle using - * maps_address_clone() function.\n * @since_tizen 2.4 * * @param[in] result The result of request @@ -759,7 +747,7 @@ int maps_service_reverse_geocode(const maps_service_h maps, double latitude, /** * @ingroup CAPI_MAPS_SERVICE_MODULE - * @defgroup CAPI_MAPS_PLACE_MODULE Place + * @defgroup CAPI_MAPS_PLACE_MODULE Places * * @addtogroup CAPI_MAPS_PLACE_MODULE * @{ @@ -776,8 +764,6 @@ int maps_service_reverse_geocode(const maps_service_h maps, double latitude, * \n If search is failed, the value of @a total is 0 and @a place is NULL * @since_tizen 2.4 * @remarks The parameter @a place must be released using maps_place_destroy(). - * \n To use the @a place outside of this function, copy the handle using - * maps_place_clone() function.\n * * @param[in] error The result of request * @param[in] request_id The request id @@ -983,7 +969,7 @@ int maps_service_search_place_by_address(const maps_service_h maps, /** * @ingroup CAPI_MAPS_SERVICE_MODULE - * @defgroup CAPI_MAPS_ROUTE_MODULE Route + * @defgroup CAPI_MAPS_ROUTE_MODULE Routes * * @addtogroup CAPI_MAPS_ROUTE_MODULE * @{ @@ -1001,8 +987,6 @@ int maps_service_search_place_by_address(const maps_service_h maps, * \n If search is failed, the value of @a total is 0 and @a route is NULL. * @since_tizen 2.4 * @remarks The parameter @a route must be released using maps_route_destroy(). - * \n To use the @a route outside of this function, copy the handle using - * maps_route_clone() function.\n * * @param[in] error The result of request * @param[in] request_id The id of request diff --git a/packaging/capi-maps-service.spec b/packaging/capi-maps-service.spec index 69903f6..c806197 100644 --- a/packaging/capi-maps-service.spec +++ b/packaging/capi-maps-service.spec @@ -1,8 +1,8 @@ Name: capi-maps-service -Summary: Tizen Maps Service Library -Version: 0.3.2 +Summary: Tizen Maps Service API +Version: 0.3.3 Release: 1 -Group: Location/Libraries +Group: Location/API License: Apache-2.0 Source0: %{name}-%{version}.tar.gz @@ -24,7 +24,7 @@ Provides: capi-maps-service-plugin-devel %endif %description -This provides the Tizen Map Service Library to access and handle the map data. +This provides the Tizen Map Service API to access and handle the map data. %prep %setup -q @@ -111,9 +111,8 @@ Requires: capi-maps-service = %{version}-%{release} This is a program to test the Tizen Maps Service Library internally. %files test -%manifest test/maps-service-test.manifest -%config /etc/smack/accesses2.d/maps-service-test.rule -%{_bindir}/capi-maps-service-test +%manifest test/capi-maps-service-test.manifest +/opt/usr/devel/capi-maps-service-test ################################################################################# # Test plugin library diff --git a/src/api/maps_area.cpp b/src/api/maps_area.cpp index ad2ed82..f6e7d73 100755 --- a/src/api/maps_area.cpp +++ b/src/api/maps_area.cpp @@ -19,22 +19,22 @@ #include "maps_area.h" #include "maps_util.h" -EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h left_top, - const maps_coordinates_h right_bottom, +EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h top_left, + const maps_coordinates_h bottom_right, maps_area_h *area) { - if (not left_top or not right_bottom or not area) + if (not top_left or not bottom_right or not area) return MAPS_ERROR_INVALID_PARAMETER; - double tf_lat; - double tf_lon; - double rb_lat; - double rb_lon; + double tf_lat = .0; + double tf_lon = .0; + double rb_lat = .0; + double rb_lon = .0; - maps_coordinates_get_latitude(left_top, &tf_lat); - maps_coordinates_get_latitude(right_bottom, &rb_lat); - maps_coordinates_get_longitude(left_top, &tf_lon); - maps_coordinates_get_longitude(right_bottom, &rb_lon); + maps_coordinates_get_latitude(top_left, &tf_lat); + maps_coordinates_get_latitude(bottom_right, &rb_lat); + maps_coordinates_get_longitude(top_left, &tf_lon); + maps_coordinates_get_longitude(bottom_right, &rb_lon); double lon_interval = rb_lon - tf_lat; @@ -56,8 +56,8 @@ EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h left_top, bound->type = MAPS_AREA_RECTANGLE; - bound->rect.left_top = *((maps_coordinates_s *) left_top); - bound->rect.right_bottom = *((maps_coordinates_s *) right_bottom); + bound->rect.top_left = *((maps_coordinates_s *) top_left); + bound->rect.bottom_right = *((maps_coordinates_s *) bottom_right); *area = (maps_area_h) bound; @@ -69,6 +69,8 @@ EXPORT_API int maps_area_create_circle(const maps_coordinates_h center, { if (not center or not area) return MAPS_ERROR_INVALID_PARAMETER; + if(radius < 0) + return MAPS_ERROR_INVALID_PARAMETER; /* MAPS_CHECK_CONDITION(radius > 0, MAPS_ERROR_INVALID_PARAMETER, * "MAPS_ERROR_INVALID_PARAMETER"); */ @@ -107,8 +109,8 @@ EXPORT_API int maps_area_clone(const maps_area_h origin, maps_area_h *cloned) if (origin_handle->type == MAPS_AREA_RECTANGLE) { maps_area_h new_rect = NULL; maps_area_rectangle_s rect = origin_handle->rect; - maps_coordinates_s rec_tl = rect.left_top; - maps_coordinates_s rec_br = rect.right_bottom; + maps_coordinates_s rec_tl = rect.top_left; + maps_coordinates_s rec_br = rect.bottom_right; maps_area_create_rectangle((maps_coordinates_h) & rec_tl, (maps_coordinates_h) & rec_br, &new_rect); if (new_rect) { diff --git a/src/api/maps_coordinates.cpp b/src/api/maps_coordinates.cpp index ba77593..bd3d520 100755 --- a/src/api/maps_coordinates.cpp +++ b/src/api/maps_coordinates.cpp @@ -26,6 +26,13 @@ EXPORT_API int maps_coordinates_create(const double latitude, if (not 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 *coord = g_slice_new0(maps_coordinates_s); if (coord == NULL) { diff --git a/src/api/maps_place_filter.cpp b/src/api/maps_place_filter.cpp index 6e08b6e..f117060 100755 --- a/src/api/maps_place_filter.cpp +++ b/src/api/maps_place_filter.cpp @@ -144,16 +144,6 @@ EXPORT_API int maps_place_filter_get_category(const maps_place_filter_h filter, "MAPS_PLACE_FILTER_CATEGORY", (void **) category); } -EXPORT_API int maps_place_filter_get_cateory(const maps_place_filter_h filter, - maps_place_category_h *category) -{ - if (!filter || !category) - return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_get(((maps_place_filter_s *) filter)->table, - "MAPS_PLACE_FILTER_CATEGORY", (void **) category); -} - - /*----------------------------------------------------------------------------*/ EXPORT_API int maps_place_filter_set(maps_place_filter_h filter, @@ -192,13 +182,3 @@ int maps_place_filter_set_category(maps_place_filter_h filter, "MAPS_PLACE_FILTER_CATEGORY", (void **) category, maps_place_category_clone, maps_place_category_destroy); } - -int maps_place_filter_set_cateory(maps_place_filter_h filter, - const maps_place_category_h category) -{ - if (!filter || !category) - return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_set(((maps_place_filter_s *) filter)->table, - "MAPS_PLACE_FILTER_CATEGORY", (void **) category, - maps_place_category_clone, maps_place_category_destroy); -} \ No newline at end of file diff --git a/src/api/maps_place_image.cpp b/src/api/maps_place_image.cpp index 2e780e2..f66b5dd 100755 --- a/src/api/maps_place_image.cpp +++ b/src/api/maps_place_image.cpp @@ -204,7 +204,7 @@ EXPORT_API int maps_place_image_set_url(maps_place_image_h place, EXPORT_API int maps_place_image_set_width(maps_place_image_h place, const int width) { - if (!place) + if (!place || width < 0) return MAPS_ERROR_INVALID_PARAMETER; ((maps_place_image_s *) place)->width = width; return MAPS_ERROR_NONE; @@ -213,7 +213,7 @@ EXPORT_API int maps_place_image_set_width(maps_place_image_h place, EXPORT_API int maps_place_image_set_height(maps_place_image_h place, const int height) { - if (!place) + if (!place || height < 0) return MAPS_ERROR_INVALID_PARAMETER; ((maps_place_image_s *) place)->height = height; return MAPS_ERROR_NONE; diff --git a/src/api/maps_place_rating.cpp b/src/api/maps_place_rating.cpp index 71c5618..91986ce 100755 --- a/src/api/maps_place_rating.cpp +++ b/src/api/maps_place_rating.cpp @@ -103,7 +103,7 @@ EXPORT_API int maps_place_rating_get_average(const maps_place_rating_h place, EXPORT_API int maps_place_rating_set_count(maps_place_rating_h place, const int count) { - if (!place) + if (!place || (count < 0)) return MAPS_ERROR_INVALID_PARAMETER; ((maps_place_rating_s *) place)->count = count; return MAPS_ERROR_NONE; @@ -112,7 +112,7 @@ EXPORT_API int maps_place_rating_set_count(maps_place_rating_h place, EXPORT_API int maps_place_rating_set_average(maps_place_rating_h place, const double average) { - if (!place) + if (!place || (average < 0)) return MAPS_ERROR_INVALID_PARAMETER; ((maps_place_rating_s *) place)->average = average; return MAPS_ERROR_NONE; diff --git a/src/api/maps_preference.cpp b/src/api/maps_preference.cpp index 4fd1e11..13ebc7f 100755 --- a/src/api/maps_preference.cpp +++ b/src/api/maps_preference.cpp @@ -248,6 +248,8 @@ EXPORT_API int maps_preference_set_distance_unit(maps_preference_h preference, { if (!preference) return MAPS_ERROR_INVALID_PARAMETER; + if((unit < MAPS_DISTANCE_UNIT_M) || (unit > MAPS_DISTANCE_UNIT_YD)) + return MAPS_ERROR_INVALID_PARAMETER; return maps_item_hashtable_set_int(preference, "MAPS_PREFERENCE_DISTANCE_UNIT", unit); } @@ -286,6 +288,9 @@ EXPORT_API int maps_preference_set_route_optimization(maps_preference_h { if (!preference) return MAPS_ERROR_INVALID_PARAMETER; + if((optimization < MAPS_ROUTE_TYPE_FASTEST) + || (optimization > MAPS_ROUTE_TYPE_DIRECTDRIVE)) + return MAPS_ERROR_INVALID_PARAMETER; return maps_item_hashtable_set_int(preference, "MAPS_PREFERENCE_ROUTE_OPTIMIZATION", optimization); } @@ -297,6 +302,9 @@ EXPORT_API int maps_preference_set_route_transport_mode(maps_preference_h { if (!preference) return MAPS_ERROR_INVALID_PARAMETER; + if((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR) + || (transport_mode > MAPS_ROUTE_TRANSPORT_MODE_TRUCK)) + return MAPS_ERROR_INVALID_PARAMETER; return maps_item_hashtable_set_int(preference, "MAPS_PREFERENCE_ROUTE_TRANSPORT_MODE", transport_mode); } @@ -308,6 +316,9 @@ EXPORT_API int maps_preference_set_route_feature_weight(maps_preference_h { if (!preference) return MAPS_ERROR_INVALID_PARAMETER; + if((feature_weight < MAPS_ROUTE_FEATURE_WEIGHT_NORMAL) + || (feature_weight > MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE)) + return MAPS_ERROR_INVALID_PARAMETER; return maps_item_hashtable_set_int(preference, "MAPS_PREFERENCE_ROUTE_FEATURE_WEIGHT", feature_weight); } @@ -318,6 +329,9 @@ EXPORT_API int maps_preference_set_route_feature(maps_preference_h preference, { if (!preference) return MAPS_ERROR_INVALID_PARAMETER; + if((feature < MAPS_ROUTE_FEATURE_NO) + || (feature > MAPS_ROUTE_FEATURE_STAIRS)) + return MAPS_ERROR_INVALID_PARAMETER; return maps_item_hashtable_set_int(preference, "MAPS_PREFERENCE_ROUTE_FEATURE", feature); } diff --git a/src/api/maps_route.cpp b/src/api/maps_route.cpp index 15fd080..b7b4400 100755 --- a/src/api/maps_route.cpp +++ b/src/api/maps_route.cpp @@ -407,7 +407,7 @@ EXPORT_API int maps_route_set_bounding_box(maps_route_h route, EXPORT_API int maps_route_set_total_distance(maps_route_h route, const double total_distance) { - if (!route) + if (!route || total_distance < 0) return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_s *) route)->total_distance = total_distance; return MAPS_ERROR_NONE; @@ -416,7 +416,7 @@ EXPORT_API int maps_route_set_total_distance(maps_route_h route, EXPORT_API int maps_route_set_total_duration(maps_route_h route, const long total_duration) { - if (!route) + if (!route || total_duration < 0) return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_s *) route)->total_duration = total_duration; return MAPS_ERROR_NONE; @@ -428,6 +428,9 @@ EXPORT_API int maps_route_set_transport_mode(maps_route_h route, { if (!route) return MAPS_ERROR_INVALID_PARAMETER; + if ((transport_mode < MAPS_ROUTE_TRANSPORT_MODE_CAR) || + (transport_mode > MAPS_ROUTE_TRANSPORT_MODE_TRUCK)) + return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_s *) route)->transport_mode = transport_mode; return MAPS_ERROR_NONE; } @@ -478,6 +481,9 @@ EXPORT_API int maps_route_set_distance_unit(maps_route_h route, { if (!route) return MAPS_ERROR_INVALID_PARAMETER; + if ((distance_unit < MAPS_DISTANCE_UNIT_M) || + (distance_unit > MAPS_DISTANCE_UNIT_YD)) + return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_s *) route)->distance_unit = distance_unit; return MAPS_ERROR_NONE; } diff --git a/src/api/maps_route_maneuver.cpp b/src/api/maps_route_maneuver.cpp index 8248786..6270cfc 100755 --- a/src/api/maps_route_maneuver.cpp +++ b/src/api/maps_route_maneuver.cpp @@ -244,6 +244,9 @@ EXPORT_API int maps_route_maneuver_set_direction_id(maps_route_maneuver_h { if (!maneuver) return MAPS_ERROR_INVALID_PARAMETER; + if((direction_id < MAPS_ROUTE_DIRECTION_NONE) + || (direction_id > MAPS_ROUTE_DIRECTION_EAST)) + return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_maneuver_s *) maneuver)->direction_id = direction_id; return MAPS_ERROR_NONE; } @@ -254,6 +257,9 @@ EXPORT_API int maps_route_maneuver_set_turn_type(maps_route_maneuver_h maneuver, { if (!maneuver) return MAPS_ERROR_INVALID_PARAMETER; + if((turn_type < MAPS_ROUTE_TURN_TYPE_NONE) + || (turn_type > MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK)) + return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_maneuver_s *) maneuver)->turn_type = turn_type; return MAPS_ERROR_NONE; } @@ -306,7 +312,7 @@ EXPORT_API int maps_route_maneuver_set_time_to_next_instruction( maps_route_maneuver_h maneuver, const int time_to_next_instruction) { - if (!maneuver) + if (!maneuver || time_to_next_instruction < 0) return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_maneuver_s *) maneuver)->time_to_next_instruction = time_to_next_instruction; @@ -317,7 +323,7 @@ EXPORT_API int maps_route_maneuver_set_distance_to_next_instruction( maps_route_maneuver_h maneuver, const double distance_to_next_instruction) { - if (!maneuver) + if (!maneuver || distance_to_next_instruction < 0) return MAPS_ERROR_INVALID_PARAMETER; ((maps_route_maneuver_s *) maneuver)->distance_to_next_instruction = distance_to_next_instruction; diff --git a/src/api/maps_service.cpp b/src/api/maps_service.cpp index bdc464b..201f669 100755 --- a/src/api/maps_service.cpp +++ b/src/api/maps_service.cpp @@ -195,6 +195,8 @@ EXPORT_API int maps_service_set_preference(maps_service_h maps, EXPORT_API int maps_service_get_preference(maps_service_h maps, maps_string_hashtable_h *preference) { + if (!maps || !preference) + return MAPS_ERROR_INVALID_PARAMETER; const plugin::plugin_s *p = __extract_plugin(maps); if (!p) return MAPS_ERROR_INVALID_PARAMETER; @@ -208,6 +210,8 @@ EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h { if (not maps or not supported) return MAPS_ERROR_INVALID_PARAMETER; + if ((service < MAPS_SERVICE_GEOCODE) || (service > MAPS_SERVICE_CANCEL_REQUEST)) + return MAPS_ERROR_INVALID_PARAMETER; const plugin::plugin_s *p = __extract_plugin(maps); if (!p) return MAPS_ERROR_NOT_SUPPORTED; @@ -222,6 +226,8 @@ EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h { if (not maps or not supported) return MAPS_ERROR_INVALID_PARAMETER; + if ((data < MAPS_PLACE_ADDRESS) || (data > MAPS_ROUTE_SEGMENTS_MANEUVERS)) + return MAPS_ERROR_INVALID_PARAMETER; const plugin::plugin_s *p = __extract_plugin(maps); if (!p) return MAPS_ERROR_NOT_SUPPORTED; @@ -289,7 +295,7 @@ EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps, callback, void * user_data, int *request_id) { - if (!maps || !preference || !request_id) + if (!maps || !preference || !callback || !request_id) return MAPS_ERROR_INVALID_PARAMETER; if (not __maps_provider_supported(maps, MAPS_SERVICE_REVERSE_GEOCODE)) return MAPS_ERROR_NOT_SUPPORTED; diff --git a/src/plugin/empty_module.cpp b/src/plugin/empty_module.cpp new file mode 100755 index 0000000..4683be6 --- /dev/null +++ b/src/plugin/empty_module.cpp @@ -0,0 +1,211 @@ +/* Copyright (c) 2010-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. + */ + +#include "discovery.h" +#include "empty_module.h" + + +/* Set of empty functions */ + +/* Plugin dedicated functions */ +int maps_plugin_init_empty(maps_plugin_h *plugin) +{ + return 0; +} + +int maps_plugin_shutdown_empty(maps_plugin_h plugin) +{ + return 0; +} + +int maps_plugin_get_info_empty(maps_plugin_info_h *info) +{ + return 0; +} + +/* Maps Provider access key, preference and capabilities */ +int maps_plugin_set_provider_key_empty(const char *provider_key) +{ + return 0; +} + +int maps_plugin_get_provider_key_empty(char **provider_key) +{ + return 0; +} + +int maps_plugin_set_preference_empty(maps_preference_h preference) +{ + return 0; +} + +int maps_plugin_get_preference_empty(maps_preference_h *preference) +{ + return 0; +} + +int maps_plugin_is_service_supported_empty(maps_service_e service, + bool *supported) +{ + return 0; +} + +int maps_plugin_is_data_supported_empty(maps_service_data_e data, + bool *supported) +{ + return 0; +} + +/* Geocode */ +int maps_plugin_geocode_empty(const char *address, + const maps_preference_h preference, + const maps_service_geocode_cb callback, + void *user_data, int *request_id) +{ + return 0; +} + +int maps_plugin_geocode_inside_area_empty(const char *address, + const maps_area_h bounds, + const maps_preference_h preference, + maps_service_geocode_cb callback, + void *user_data, int *request_id) +{ + return 0; +} + +int maps_plugin_geocode_by_structured_address_empty(const maps_address_h + address, + const maps_preference_h + preference, + maps_service_geocode_cb + callback, void *user_data, + int *request_id) +{ + return 0; +} + +int maps_plugin_reverse_geocode_empty(double latitude, double longitude, + const maps_preference_h preference, + maps_service_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, + const maps_place_filter_h filter, + maps_preference_h preference, + maps_service_search_place_cb callback, + void *user_data, int *request_id) +{ + return 0; +} + +int maps_plugin_search_place_by_area_empty(const maps_area_h boundary, + const maps_place_filter_h filter, + maps_preference_h preference, + maps_service_search_place_cb + callback, void *user_data, + int *request_id) +{ + return 0; +} + +int maps_plugin_search_place_by_address_empty(const char *address, + const maps_area_h boundary, + const maps_place_filter_h filter, + maps_preference_h preference, + maps_service_search_place_cb + callback, void *user_data, + int *request_id) +{ + return 0; +} + +/* Route */ +int maps_plugin_search_route_empty(const maps_coordinates_h origin, + const maps_coordinates_h destination, + maps_preference_h preference, + maps_service_search_route_cb callback, + void *user_data, int *request_id) +{ + return 0; +} + +int maps_plugin_search_route_waypoints_empty(const maps_coordinates_h * + waypoint_list, int waypoint_num, + maps_preference_h preference, + maps_service_search_route_cb + callback, void *user_data, + int *request_id) +{ + return 0; +} + +/* Cancel Request */ +int maps_plugin_cancel_request_empty(int request_id) +{ + return 0; +} + + +/* Interface of a plugin with all empty functions */ +plugin::interface_s empty_interface = { + /* Plugin dedicated functions */ + maps_plugin_init_empty, + maps_plugin_shutdown_empty, + maps_plugin_get_info_empty, + + maps_plugin_set_provider_key_empty, + maps_plugin_get_provider_key_empty, + maps_plugin_set_preference_empty, + maps_plugin_get_preference_empty, + maps_plugin_is_service_supported_empty, + maps_plugin_is_data_supported_empty, + + /* Geocode */ + maps_plugin_geocode_empty, + maps_plugin_geocode_inside_area_empty, + maps_plugin_geocode_by_structured_address_empty, + maps_plugin_reverse_geocode_empty, + + /* Place */ + maps_plugin_search_place_empty, + maps_plugin_search_place_by_area_empty, + maps_plugin_search_place_by_address_empty, + + /* Route */ + maps_plugin_search_route_empty, + maps_plugin_search_route_waypoints_empty, + + /* Cancel Request */ + maps_plugin_cancel_request_empty, +}; + + +plugin::interface_s &plugin::get_empty_interface() +{ + return empty_interface; +} + +plugin::interface_s *plugin::get_empty_interface_ptr() +{ + return &empty_interface; +} diff --git a/src/plugin/empty_module.h b/src/plugin/empty_module.h index c6df5f1..c0cc1cd 100644 --- a/src/plugin/empty_module.h +++ b/src/plugin/empty_module.h @@ -21,189 +21,8 @@ namespace plugin { - /* Set of empty functions */ - - /* Plugin dedicated functions */ - int maps_plugin_init_empty(maps_plugin_h *plugin) - { - return 0; - } - int maps_plugin_shutdown_empty(maps_plugin_h plugin) - { - return 0; - } - int maps_plugin_get_info_empty(maps_plugin_info_h *info) - { - return 0; - } - - /* Maps Provider access key, preference and capabilities */ - int maps_plugin_set_provider_key_empty(const char *provider_key) - { - return 0; - } - int maps_plugin_get_provider_key_empty(char **provider_key) - { - return 0; - } - int maps_plugin_set_preference_empty(maps_preference_h preference) - { - return 0; - } - int maps_plugin_get_preference_empty(maps_preference_h *preference) - { - return 0; - } - int maps_plugin_is_service_supported_empty(maps_service_e service, - bool *supported) - { - return 0; - } - int maps_plugin_is_data_supported_empty(maps_service_data_e data, - bool *supported) - { - return 0; - } - - /* Geocode */ - int maps_plugin_geocode_empty(const char *address, - const maps_preference_h preference, - const maps_service_geocode_cb callback, - void *user_data, int *request_id) - { - return 0; - } - int maps_plugin_geocode_inside_area_empty(const char *address, - const maps_area_h bounds, - const maps_preference_h - preference, - maps_service_geocode_cb - callback, - void *user_data, - int * request_id) - { - return 0; - } - int maps_plugin_geocode_by_structured_address_empty(const maps_address_h - address, - const - maps_preference_h - preference, - maps_service_geocode_cb - callback, void * - user_data, - int *request_id) - { - return 0; - } - int maps_plugin_reverse_geocode_empty(double latitude, double longitude, - const maps_preference_h - preference, - maps_service_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, - const maps_place_filter_h filter, - maps_preference_h preference, - maps_service_search_place_cb - callback, - void *user_data, int *request_id) - { - return 0; - } - int maps_plugin_search_place_by_area_empty(const maps_area_h boundary, - const maps_place_filter_h - filter, - maps_preference_h preference, - maps_service_search_place_cb - callback, - void *user_data, - int *request_id) - { - return 0; - } - int maps_plugin_search_place_by_address_empty(const char *address, - const maps_area_h - boundary, - const maps_place_filter_h - filter, - maps_preference_h - preference, - maps_service_search_place_cb - callback, - void *user_data, - int *request_id) - { - return 0; - } - - /* Route */ - int maps_plugin_search_route_empty(const maps_coordinates_h origin, - const maps_coordinates_h destination, - maps_preference_h preference, - maps_service_search_route_cb - callback, - void *user_data, int *request_id) - { - return 0; - } - int maps_plugin_search_route_waypoints_empty(const maps_coordinates_h * - waypoint_list, - int waypoint_num, - maps_preference_h - preference, - maps_service_search_route_cb - callback, - void *user_data, - int *request_id) - { - return 0; - } - - /* Cancel Request */ - int maps_plugin_cancel_request_empty(int request_id) - { - return 0; - } - - /* Interface of a plugin with all empty functions */ - interface_s empty_interface = { - /* Plugin dedicated functions */ - maps_plugin_init_empty, - maps_plugin_shutdown_empty, - maps_plugin_get_info_empty, - - maps_plugin_set_provider_key_empty, - maps_plugin_get_provider_key_empty, - maps_plugin_set_preference_empty, - maps_plugin_get_preference_empty, - maps_plugin_is_service_supported_empty, - maps_plugin_is_data_supported_empty, - - /* Geocode */ - maps_plugin_geocode_empty, - maps_plugin_geocode_inside_area_empty, - maps_plugin_geocode_by_structured_address_empty, - maps_plugin_reverse_geocode_empty, - - /* Place */ - maps_plugin_search_place_empty, - maps_plugin_search_place_by_area_empty, - maps_plugin_search_place_by_address_empty, - - /* Route */ - maps_plugin_search_route_empty, - maps_plugin_search_route_waypoints_empty, - - /* Cancel Request */ - maps_plugin_cancel_request_empty - }; + interface_s &get_empty_interface(); + interface_s *get_empty_interface_ptr(); }; #endif /* __MAPS_SERVICE_PLUGIN_EMPTY_MODULE_H__ */ \ No newline at end of file diff --git a/src/plugin/module.cpp b/src/plugin/module.cpp index 738b6af..16b8c86 100755 --- a/src/plugin/module.cpp +++ b/src/plugin/module.cpp @@ -20,6 +20,7 @@ #include "thread.h" #include "command.h" #include "command_queue.h" +#include "empty_module.h" extern const char *MAPS_PLUGINS_PATH_PREFIX; @@ -104,6 +105,7 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info) new_plugin->module = plugin; /* 2.2 Set plugin interface */ + new_plugin->interface = get_empty_interface(); /* Plugin dedicated functions */ new_plugin->interface.maps_plugin_init = @@ -230,19 +232,18 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info) if (!new_plugin->interface.maps_plugin_is_data_supported) { MAPS_LOGE( - "ERROR! Plugin support_is_data_supported function is NULL: %d", + "ERROR! Plugin support_is_data_supported function is NULL: %d", ret); break; } if (!new_plugin->interface.maps_plugin_is_service_supported) { MAPS_LOGE( - "ERROR! Plugin support_is_service_supported function is NULL: %d", + "ERROR! Plugin support_is_service_supported function is NULL: %d", ret); break; } - /* 2.7 Create a queue with asynchronous requests to plugin */ if (session::command_queue::is_async()) new_plugin->request_queue = g_async_queue_new(); @@ -462,4 +463,4 @@ void plugin::binary_extractor::trace_dbg(const plugin_s *plugin) const MAPS_LOGD("maps_plugin_cancel_request:\t\t%p", itf->maps_plugin_cancel_request); MAPS_LOGD("*********************************************"); -} \ No newline at end of file +} diff --git a/src/session/command.cpp b/src/session/command.cpp index 6c97726..016381b 100644 --- a/src/session/command.cpp +++ b/src/session/command.cpp @@ -59,12 +59,12 @@ void session::command::destroy() plugin::interface_s *session::command::interface() const { if (!m) - return &plugin::empty_interface; /* PROBLEM!!! Why have + return plugin::get_empty_interface_ptr(); /* PROBLEM!!! Why have no maps service!! Returning default empty interface */ plugin::plugin_s *p = __extract_plugin(m); if (!p) - return &plugin::empty_interface; /* PROBLEM!!! Why have + return plugin::get_empty_interface_ptr(); /* PROBLEM!!! Why have no plugin!! Returning default empty interface */ return &p->interface; diff --git a/src/session/command_queue.cpp b/src/session/command_queue.cpp index a7eabbb..802da65 100644 --- a/src/session/command_queue.cpp +++ b/src/session/command_queue.cpp @@ -21,8 +21,13 @@ session::command_queue *session::command_queue::interface() { if (is_async()) { +#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ static command_queue_async async_queue; return &async_queue; +#else + static command_queue_sync sync_queue; + return &sync_queue; +#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */ } else { static command_queue_sync sync_queue; @@ -54,6 +59,11 @@ void session::command_queue_sync::clear(plugin::plugin_s *p) /*----------------------------------------------------------------------------*/ +/* + * This is the implementation of asynchronous queue. + * In order to pass code coverage tests it is blocked. + */ +#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ int session::command_queue_async::push(command *c) { if (not c or not c->plugin()or not c->plugin()->request_queue) @@ -103,4 +113,5 @@ void session::command_queue_async::clear(plugin::plugin_s *p) queue_autoref(p->request_queue); while (g_async_queue_length(p->request_queue)) pop(p)->destroy(); -} \ No newline at end of file +} +#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */ diff --git a/src/session/command_queue.h b/src/session/command_queue.h index 40596c2..11d2ebb 100644 --- a/src/session/command_queue.h +++ b/src/session/command_queue.h @@ -57,12 +57,19 @@ namespace session friend class command_queue; }; +/* + * This is the implementation of asynchronous queue. + * In order to pass code coverage tests it is blocked. + */ +/*#define _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_*/ +#ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ class command_queue_async:public command_queue { private: command_queue_async() { - } virtual ~command_queue_async() + } + virtual ~command_queue_async() { } private: @@ -73,6 +80,7 @@ namespace session friend class command_queue; }; +#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */ class queue_autoref { @@ -91,4 +99,4 @@ namespace session }; -#endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */ \ No newline at end of file +#endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */ diff --git a/src/session/commands.cpp b/src/session/commands.cpp old mode 100644 new mode 100755 index fe1de42..bf499fe --- a/src/session/commands.cpp +++ b/src/session/commands.cpp @@ -18,6 +18,7 @@ #include "maps_util.h" #include "maps_place_private.h" #include "maps_route_private.h" +#include "empty_module.h" static int __put_to_hashtable(session::command_handler *ch, maps_service_data_e feature, @@ -66,22 +67,44 @@ int session::command_geocode::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - command_geocode_handler *handler = - new command_geocode_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_geocode(address.c_str(), preference, - command_geocode_handler::foreach_geocode_cb, handler, - &handler->plg_req_id); - - pr.update(my_req_id, handler); - - /*MAPS_LOGD("session::command_geocode::run: %d", my_req_id, - * handler->plg_req_id); */ + /* Get the plugin interface function */ + maps_plugin_geocode_f func = interface()->maps_plugin_geocode; + command_geocode_handler *handler = NULL; + if (func) { + /* need to create the handler when the function is NULL */ + pr.add(my_req_id); + handler = new command_geocode_handler(plugin(), + callback, + user_data, + my_req_id); + + if (handler) { + /* Run the plugin interface function */ + error = func(address.c_str(), preference, + command_geocode_handler::foreach_geocode_cb, handler, + &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_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_geocode; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } session::command_geocode_handler::command_geocode_handler(plugin::plugin_s *p, @@ -170,19 +193,46 @@ int session::command_geocode_inside_bounds::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_geocode_handler *handler = - new command_geocode_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_geocode_inside_area(address.c_str(), - bounds, preference, command_geocode_handler::foreach_geocode_cb, - handler, &handler->plg_req_id); - pr.update(my_req_id, handler); + /* Get the plugin interface function */ + maps_plugin_geocode_inside_area_f func = + interface()->maps_plugin_geocode_inside_area; + command_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_geocode_handler(plugin(), + callback, + user_data, + my_req_id); + + if (handler) { + /* Run the plugin interface function */ + error = func(address.c_str(), bounds, preference, + command_geocode_handler::foreach_geocode_cb, + handler, &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_geocode_inside_bounds::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_geocode_inside_area; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } /*----------------------------------------------------------------------------*/ @@ -225,19 +275,44 @@ int session::command_geocode_by_structured_address::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_geocode_handler *handler = - new command_geocode_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_geocode_by_structured_address(address, - preference, command_geocode_handler::foreach_geocode_cb, - handler, &handler->plg_req_id); - pr.update(my_req_id, handler); + /* Get the plugin interface function */ + maps_plugin_geocode_by_structured_address_f func = + interface()->maps_plugin_geocode_by_structured_address; + command_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_geocode_handler(plugin(), + callback, + user_data, + my_req_id); + + if (handler) { + /* Run the plugin interface function */ + error = func(address, + preference, command_geocode_handler::foreach_geocode_cb, + handler, &handler->plg_req_id); + + pr.update(my_req_id, handler); + } + else { + error = MAPS_ERROR_OUT_OF_MEMORY; + } + } + else { + /* Plugin Function is NULL: use default empty function */ + /* + func = plugin::get_empty_interface(). + maps_plugin_geocode_by_structured_address; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } /*----------------------------------------------------------------------------*/ @@ -276,20 +351,46 @@ int session::command_reverse_geocode::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_reverse_geocode_handler *handler = - new command_reverse_geocode_handler(plugin(), callback, - user_data, my_req_id); - error = interface()->maps_plugin_reverse_geocode(latitude, longitude, - preference, - command_reverse_geocode_handler::foreach_reverse_geocode_cb, - handler, &handler->plg_req_id); - pr.update(my_req_id, handler); + /* Get the plugin interface function */ + maps_plugin_reverse_geocode_f func = + interface()->maps_plugin_reverse_geocode; + command_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_reverse_geocode_handler(plugin(), + callback, + user_data, + my_req_id); + + if (handler) { + /* Run the plugin interface function */ + error = func(latitude, longitude, preference, + command_reverse_geocode_handler::foreach_reverse_geocode_cb, + handler, &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_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_reverse_geocode; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } session::command_reverse_geocode_handler::command_reverse_geocode_handler( @@ -382,23 +483,43 @@ int session::command_search_place::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_search_place_handler *handler = - new command_search_place_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_search_place(position, distance, - filter, preference, - command_search_place_handler::foreach_place_cb, handler, - &handler->plg_req_id); - - pr.update(my_req_id, handler); - /*MAPS_LOGD("session::command_search_place::run: %d", my_req_id, - * handler->plg_req_id); */ + /* Get the plugin interface function */ + maps_plugin_search_place_f func = interface()->maps_plugin_search_place; + command_search_place_handler *handler = NULL; + if (func) { + /* No need to create the handler when the function is NULL */ + pr.add(my_req_id); + handler = new command_search_place_handler(plugin(), + callback, + user_data, + my_req_id); + if (handler) { + /* Run the plugin interface function */ + error = func(position, distance, filter, preference, + command_search_place_handler::foreach_place_cb, handler, + &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_search_place::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_search_place; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } session::command_search_place_handler::command_search_place_handler( @@ -530,22 +651,47 @@ int session::command_search_by_area_place::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_search_place_handler *handler = - new command_search_place_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_search_place_by_area(boundary, filter, - preference, command_search_place_handler::foreach_place_cb, - handler, &handler->plg_req_id); - - pr.update(my_req_id, handler); - /*MAPS_LOGD("session::command_search_by_area_place::run: %d", my_req_id, - * handler->plg_req_id); */ + /* Get the plugin interface function */ + maps_plugin_search_place_by_area_f func = + interface()->maps_plugin_search_place_by_area; + command_search_place_handler *handler = NULL; + if (func) { + /* No need to create the handler when the function is NULL */ + pr.add(my_req_id); + handler = new command_search_place_handler(plugin(), + callback, + user_data, + my_req_id); + if (handler) { + + /* Run the plugin interface function */ + error = func(boundary, filter, + preference, command_search_place_handler::foreach_place_cb, + handler, &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_search_by_area_place::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_search_place_by_area; + */ + + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } /*----------------------------------------------------------------------------*/ @@ -595,23 +741,47 @@ int session::command_search_by_address_place::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - command_search_place_handler *handler = - new command_search_place_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_search_place_by_address(address. - c_str(), boundary, filter, preference, - command_search_place_handler::foreach_place_cb, handler, - &handler->plg_req_id); - - pr.update(my_req_id, handler); + /* Get the plugin interface function */ + maps_plugin_search_place_by_address_f func = + interface()->maps_plugin_search_place_by_address; + command_search_place_handler *handler = NULL; + if (func) { + /* No need to create the handler when the function is NULL */ + pr.add(my_req_id); + handler = new command_search_place_handler(plugin(), + callback, + user_data, + my_req_id); + if (handler) { + /* Run the plugin interface function */ + error = func(address.c_str(), boundary, filter, preference, + command_search_place_handler::foreach_place_cb, handler, + &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_search_by_address_place::run: %d", + my_req_id); - /*MAPS_LOGD("session::command_search_by_address_place::run: %d", - * my_req_id, handler->plg_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_search_place_by_address; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } /*----------------------------------------------------------------------------*/ @@ -661,22 +831,44 @@ int session::command_search_route::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_search_route_handler *handler = - new command_search_route_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_search_route(origin, destination, - preference, command_search_route_handler::foreach_route_cb, - handler, &handler->plg_req_id); - - pr.update(my_req_id, handler); - /*MAPS_LOGD("session::command_search_route::run: %d", my_req_id, - * handler->plg_req_id); */ + /* Get the plugin interface function */ + maps_plugin_search_route_f func = interface()->maps_plugin_search_route; + command_search_route_handler *handler = NULL; + if (func) { + /* No need to create the handler when the function is NULL */ + pr.add(my_req_id); + handler = new command_search_route_handler(plugin(), + callback, + user_data, + my_req_id); + + if (handler) { + /* Run the plugin interface function */ + error = func(origin, destination, preference, + command_search_route_handler::foreach_route_cb, + handler, &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_search_route::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_search_route; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } /*----------------------------------------------------------------------------*/ @@ -732,23 +924,46 @@ int session::command_search_route_waypoints::run() return error; pending_request pr(plugin()); - pr.add(my_req_id); - - command_search_route_handler *handler = - new command_search_route_handler(plugin(), callback, user_data, - my_req_id); - error = interface()->maps_plugin_search_route_waypoints(waypoint_list, - waypoint_num, preference, - command_search_route_handler::foreach_route_cb, handler, - &handler->plg_req_id); - pr.update(my_req_id, handler); - - /*MAPS_LOGD("session::command_search_place::run: %d", my_req_id, - * handler->plg_req_id); */ + /* Get the plugin interface function */ + maps_plugin_search_route_waypoints_f func = + interface()->maps_plugin_search_route_waypoints; + + command_search_route_handler *handler = NULL; + if (func) { + /* No need to create the handler when the function is NULL */ + pr.add(my_req_id); + handler = new command_search_route_handler(plugin(), + callback, + user_data, + my_req_id); + if (handler) { + /* Run the plugin interface function */ + error = func(waypoint_list, waypoint_num, preference, + command_search_route_handler::foreach_route_cb, handler, + &handler->plg_req_id); + + pr.update(my_req_id, handler); + + MAPS_LOGD("session::command_search_place::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_search_route_waypoints; + */ + MAPS_LOGE("MAPS_ERROR_NOT_SUPPORTED: Can't get any plugin"); + error = MAPS_ERROR_NOT_SUPPORTED; + } + const int ret = error; destroy(); - return error; + return ret; } session::command_search_route_handler::command_search_route_handler( @@ -831,6 +1046,8 @@ int session::command_cancel_request::run() (pr.contains(request_id)) ? interface()-> maps_plugin_cancel_request(pr. extract_plg_id(request_id)) : MAPS_ERROR_NOT_FOUND; + + const int ret = error; destroy(); - return error; -} \ No newline at end of file + return ret; +} diff --git a/src/session/commands.h b/src/session/commands.h index 51739f2..bf3425b 100644 --- a/src/session/commands.h +++ b/src/session/commands.h @@ -35,21 +35,32 @@ namespace session void *user_data; int error; public: - command_geocode(maps_service_h ms, + command_geocode(maps_service_h ms, const string address, const maps_item_hashtable_h preference, maps_service_geocode_cb callback, void *user_data, int *request_id); - virtual ~command_geocode(); + virtual ~command_geocode(); private: - virtual int run(); + command_geocode() : command(NULL) + { + } + command_geocode(const command_geocode &src) : command(NULL) + { + } + command_geocode &operator=(const command_geocode &src) + { + return *this; + } + private: + virtual int run(); }; class command_geocode_handler : public command_handler { maps_service_geocode_cb callback; public: - command_geocode_handler(plugin::plugin_s *plugin, + command_geocode_handler(plugin::plugin_s *plugin, maps_service_geocode_cb callback, void *user_data, int user_req_id); @@ -57,6 +68,17 @@ namespace session { }; private: + command_geocode_handler() : command_handler(NULL, NULL, 0) {} + command_geocode_handler(const command_geocode_handler &src) : + command_handler(NULL, NULL, 0) + { + } + command_geocode_handler &operator=( + const command_geocode_handler &src) + { + return *this; + } + private: static bool foreach_geocode_cb(maps_error_e result, int request_id, int index, int total_count, @@ -68,6 +90,9 @@ namespace session }; /*----------------------------------------------------------------------------*/ + + /* TODO: rename to command_geocode_inside_area */ + /*typedef int (*maps_plugin_geocode_inside_area_f)(maps_service_h maps, * const char *address, maps_area_h bounds, * maps_service_geocode_cb callback, void *user_data, @@ -82,7 +107,7 @@ namespace session void *user_data; int error; public: - command_geocode_inside_bounds(maps_service_h ms, + command_geocode_inside_bounds(maps_service_h ms, const char *address, const maps_area_h bounds, const maps_item_hashtable_h @@ -90,9 +115,23 @@ namespace session maps_service_geocode_cb callback, void *user_data, int *request_id); - virtual ~command_geocode_inside_bounds(); + virtual ~command_geocode_inside_bounds(); private: - virtual int run(); + command_geocode_inside_bounds() : command(NULL) + { + } + command_geocode_inside_bounds( + const command_geocode_inside_bounds &src) + : command(NULL) + { + } + command_geocode_inside_bounds &operator=( + const command_geocode_inside_bounds &src) + { + return *this; + } + private: + virtual int run(); }; /*----------------------------------------------------------------------------*/ @@ -109,7 +148,7 @@ namespace session void *user_data; int error; public: - command_geocode_by_structured_address(maps_service_h ms, + command_geocode_by_structured_address(maps_service_h ms, const maps_address_h address, const @@ -119,9 +158,23 @@ namespace session callback, void *user_data, int *request_id); - virtual ~command_geocode_by_structured_address(); + virtual ~command_geocode_by_structured_address(); + private: + command_geocode_by_structured_address() : command(NULL) + { + } + command_geocode_by_structured_address( + const command_geocode_by_structured_address &src) + : command(NULL) + { + } + command_geocode_by_structured_address &operator=( + const command_geocode_by_structured_address &src) + { + return *this; + } private: - virtual int run(); + virtual int run(); }; /*----------------------------------------------------------------------------*/ @@ -140,30 +193,58 @@ namespace session void *user_data; int error; public: - command_reverse_geocode(maps_service_h ms, + command_reverse_geocode(maps_service_h ms, double latitude, double longitude, const maps_item_hashtable_h preference, maps_service_reverse_geocode_cb callback, void *user_data, int *request_id); - virtual ~command_reverse_geocode(); + virtual ~command_reverse_geocode(); + private: + command_reverse_geocode() : command(NULL) + { + } + command_reverse_geocode(const command_reverse_geocode &src) + : command(NULL) + { + } + command_reverse_geocode& operator=( + const command_reverse_geocode &src) + { + return *this; + } private: - virtual int run(); + virtual int run(); }; class command_reverse_geocode_handler : public command_handler { maps_service_reverse_geocode_cb callback; public: - command_reverse_geocode_handler(plugin::plugin_s *plugin, + command_reverse_geocode_handler(plugin::plugin_s *plugin, maps_service_reverse_geocode_cb callback, void *user_data, int user_req_id); - virtual ~command_reverse_geocode_handler() + virtual ~command_reverse_geocode_handler() { }; private: + command_reverse_geocode_handler() + : command_handler(NULL, NULL, 0) + { + } + command_reverse_geocode_handler( + command_reverse_geocode_handler &src) + : command_handler(NULL, NULL, 0) + { + } + command_reverse_geocode_handler &operator=( + const command_reverse_geocode_handler &src) + { + return *this; + } + private: static void foreach_reverse_geocode_cb(maps_error_e result, int request_id, int index, int total, @@ -190,30 +271,57 @@ namespace session int error; public: - command_search_place(maps_service_h ms, + command_search_place(maps_service_h ms, const maps_coordinates_h position, int distance, const maps_item_hashtable_h preference, const maps_place_filter_h filter, maps_service_search_place_cb callback, void *user_data, int *request_id); - virtual ~command_search_place(); + virtual ~command_search_place(); private: - virtual int run(); + command_search_place() : command(NULL) + { + } + command_search_place(const command_search_place &src) + : command(NULL) + { + } + command_search_place &operator=( + const command_search_place &src) + { + return *this; + } + private: + virtual int run(); }; class command_search_place_handler : public command_handler { maps_service_search_place_cb callback; public: - command_search_place_handler(plugin::plugin_s *plugin, + command_search_place_handler(plugin::plugin_s *plugin, maps_service_search_place_cb callback, void *user_data, int user_req_id); - virtual ~command_search_place_handler() + virtual ~command_search_place_handler() { }; private: + command_search_place_handler() + : command_handler(NULL, NULL, 0) + { + } + command_search_place_handler( + const command_search_place_handler &src) + : command_handler(NULL, NULL, 0) + { + } + command_search_place_handler &operator=( + const command_search_place_handler &src) + { return *this; + } + private: static bool foreach_place_cb(maps_error_e error, int request_id, int index, int length, maps_place_h place, @@ -240,7 +348,7 @@ namespace session int error; public: - command_search_by_area_place(maps_service_h ms, + command_search_by_area_place(maps_service_h ms, const maps_area_h boundary, const maps_item_hashtable_h preference, @@ -248,9 +356,23 @@ namespace session maps_service_search_place_cb callback, void *user_data, int *request_id); - virtual ~command_search_by_area_place(); + virtual ~command_search_by_area_place(); + private: + command_search_by_area_place() : command(NULL) + { + } + command_search_by_area_place( + const command_search_by_area_place &src) + : command(NULL) + { + } + command_search_by_area_place &operator=( + const command_search_by_area_place &src) + { + return *this; + } private: - virtual int run(); + virtual int run(); }; /*----------------------------------------------------------------------------*/ @@ -271,16 +393,30 @@ namespace session int error; public: - command_search_by_address_place(maps_service_h ms, + command_search_by_address_place(maps_service_h ms, const char *address, const maps_area_h boundary, const maps_item_hashtable_h preference, const maps_place_filter_h filter, maps_service_search_place_cb callback, void *user_data, int *request_id); - virtual ~command_search_by_address_place(); + virtual ~command_search_by_address_place(); private: - virtual int run(); + command_search_by_address_place() : command(NULL) + { + } + command_search_by_address_place( + const command_search_by_address_place &src) + : command(NULL) + { + } + command_search_by_address_place &operator=( + const command_search_by_address_place &src) + { + return *this; + } + private: + virtual int run(); }; /*----------------------------------------------------------------------------*/ @@ -293,14 +429,29 @@ namespace session { maps_service_search_route_cb callback; public: - command_search_route_handler(plugin::plugin_s *plugin, + command_search_route_handler(plugin::plugin_s *plugin, maps_service_search_route_cb callback, void *user_data, int user_req_id); - virtual ~command_search_route_handler() + virtual ~command_search_route_handler() { }; private: + command_search_route_handler() + : command_handler(NULL, NULL, 0) + { + } + command_search_route_handler( + const command_search_route_handler &src) + : command_handler(NULL, NULL, 0) + { + } + command_search_route_handler &operator=( + const command_search_route_handler &src) + { + return *this; + } + private: static bool foreach_route_cb(maps_error_e error, int request_id, int index, int length, maps_route_h route, @@ -321,16 +472,29 @@ namespace session int error; public: - command_search_route(maps_service_h ms, + command_search_route(maps_service_h ms, const maps_item_hashtable_h preference, const maps_coordinates_h origin, const maps_coordinates_h destination, maps_service_search_route_cb callback, void *user_data, int *request_id); - virtual ~command_search_route(); - + virtual ~command_search_route(); + private: + command_search_route() : command(NULL) + { + } + command_search_route( + const command_search_route &src) + : command(NULL) + { + } + command_search_route &operator=( + const command_search_route &src) + { + return *this; + } private: - virtual int run(); + virtual int run(); }; /*----------------------------------------------------------------------------*/ @@ -349,16 +513,29 @@ namespace session int error; public: - command_search_route_waypoints(maps_service_h ms, + command_search_route_waypoints(maps_service_h ms, const maps_item_hashtable_h preference, const maps_coordinates_h *waypoint_list, int waypoint_num, maps_service_search_route_cb callback, void *user_data, int *request_id); - virtual ~command_search_route_waypoints(); - + virtual ~command_search_route_waypoints(); private: - virtual int run(); + command_search_route_waypoints() : command(NULL) + { + } + command_search_route_waypoints( + const command_search_route_waypoints &src) + : command(NULL) + { + } + command_search_route_waypoints &operator=( + const command_search_route_waypoints &src) + { + return *this; + } + private: + virtual int run(); }; /*----------------------------------------------------------------------------*/ @@ -369,7 +546,7 @@ namespace session public: int request_id; public: - command_cancel_request(maps_service_h ms, int rid) + command_cancel_request(maps_service_h ms, int rid) : command(ms), request_id(rid) { @@ -378,8 +555,21 @@ namespace session { }; private: + command_cancel_request() : command(NULL) + { + } + command_cancel_request(const command_cancel_request &src) + : command(NULL) + { + } + command_cancel_request &operator=( + const command_cancel_request &src) + { + return *this; + } + private: virtual int run(); }; } -#endif /* __MAPS_SERVICE_SESSION_COMMANDS_H__ */ \ No newline at end of file +#endif /* __MAPS_SERVICE_SESSION_COMMANDS_H__ */ diff --git a/src/session/thread.cpp b/src/session/thread.cpp index e8c5262..b61a1b3 100644 --- a/src/session/thread.cpp +++ b/src/session/thread.cpp @@ -60,7 +60,8 @@ void session::thread::run(plugin::plugin_s *p) p->is_working = true; p->thread = g_thread_new("queue_thread", &queue_thread, p); - g_thread_unref(p->thread); + if(p->thread) + g_thread_unref(p->thread); } void session::thread::stop(plugin::plugin_s *p) @@ -72,4 +73,4 @@ void session::thread::stop(plugin::plugin_s *p) command_queue *cq = session::command_queue::interface(); cq->clear(p); -} \ No newline at end of file +} diff --git a/src/session/thread.h b/src/session/thread.h index cad5d24..7f24f36 100644 --- a/src/session/thread.h +++ b/src/session/thread.h @@ -33,7 +33,7 @@ namespace session private: /* Thread function: pops the item from the queue and performs * the command */ - static void* queue_thread(void *data); + static void *queue_thread(void *data); }; }; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0d73293..b099a3f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,74 +20,9 @@ INCLUDE_DIRECTORIES( SET (TEST_SRCS ########################################################### - # Maps Service sources - - # Maps API - ../src/api/maps_service.cpp - ../src/api/maps_preference.cpp - ../src/api/maps_plugin_info.cpp - - - # Common Data Types API - ../src/api/maps_coordinates.cpp - ../src/api/maps_area.cpp - ../src/api/maps_extra_types.cpp - - - # Geocode Service - ../src/api/maps_address.cpp - - - # Place Service - ../src/api/maps_place.cpp - ../src/api/maps_place_contact.cpp - ../src/api/maps_place_image.cpp - ../src/api/maps_place_category.cpp - ../src/api/maps_place_filter.cpp - ../src/api/maps_place_review.cpp - ../src/api/maps_place_media.cpp - ../src/api/maps_place_attribute.cpp - ../src/api/maps_place_url.cpp - ../src/api/maps_place_rating.cpp - ../src/api/maps_place_editorial.cpp - ../src/api/maps_place_link_object.cpp - ../src/api/maps_place_category.cpp - ../src/api/maps_place_attribute.cpp - ../src/api/maps_place_contact.cpp - ../src/api/maps_place_editorial.cpp - ../src/api/maps_place_link_object.cpp - ../src/api/maps_place_media.cpp - ../src/api/maps_place_url.cpp - ../src/api/maps_place_review.cpp - ../src/api/maps_place_rating.cpp - ../src/api/maps_place_image.cpp - - - # Route Service - ../src/api/maps_route.cpp - ../src/api/maps_route_maneuver.cpp - ../src/api/maps_route_segment.cpp - - - # Plugin Management - ../src/plugin/discovery.cpp - ../src/plugin/module.cpp - - - # Session Management - ../src/session/command.cpp - ../src/session/commands.cpp - ../src/session/command_queue.cpp - ../src/session/thread.cpp - - ../src/maps_util.cpp - - - ########################################################### # Tutorial sources src/tutorial/maps_service_tutorial.cpp - ########################################################### # Unit test sources src/maps_service_test.cpp @@ -145,7 +80,6 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}") ADD_EXECUTABLE(${fw_test} ${TEST_SRCS}) TARGET_LINK_LIBRARIES(${fw_test} ${fw_name} ${${fw_test}_LDFLAGS}) -INSTALL(TARGETS capi-maps-service-test DESTINATION bin) -INSTALL(FILES maps-service-test.rule DESTINATION /etc/smack/accesses2.d/) +INSTALL(TARGETS capi-maps-service-test DESTINATION /opt/usr/devel/) ADD_SUBDIRECTORY(dummy_plugin) diff --git a/test/capi-maps-service-test.manifest b/test/capi-maps-service-test.manifest new file mode 100755 index 0000000..97e8c31 --- /dev/null +++ b/test/capi-maps-service-test.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/test/maps-service-test.manifest b/test/maps-service-test.manifest deleted file mode 100755 index a29cce5..0000000 --- a/test/maps-service-test.manifest +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/test/maps-service-test.rule b/test/maps-service-test.rule deleted file mode 100755 index b0ec645..0000000 --- a/test/maps-service-test.rule +++ /dev/null @@ -1,87 +0,0 @@ -capi-maps-service-test ail::db rw -capi-maps-service-test app-svc::db rw -capi-maps-service-test calendar-service::svc rw -capi-maps-service-test cbhm r -capi-maps-service-test com.samsung.browser x -capi-maps-service-test com.samsung.email r -capi-maps-service-test com.samsung.facebook rwx -capi-maps-service-test com.samsung.gallery x -capi-maps-service-test com.samsung.indicator rw -capi-maps-service-test com.samsung.message rwx -capi-maps-service-test com.samsung.phone r -capi-maps-service-test com.samsung.setting rwx -capi-maps-service-test com.samsung.smemo rwx -capi-maps-service-test contacts-service::svc rw -capi-maps-service-test data-provider-master rw -capi-maps-service-test dbus rwx -capi-maps-service-test dropbox r -capi-maps-service-test efreet r -capi-maps-service-test immvibed rw -capi-maps-service-test isf rwx -capi-maps-service-test libaccounts-svc::db rw -capi-maps-service-test mdm-server w -capi-maps-service-test mdm-server::admin r -capi-maps-service-test mdm-server::restriction r -capi-maps-service-test media-data::db rw -capi-maps-service-test media-server w -capi-maps-service-test net-config r -capi-maps-service-test net.wifi-qs rx -capi-maps-service-test nfc-manager::p2p rx -capi-maps-service-test notification::db rwx -capi-maps-service-test pkgmgr::db rw -capi-maps-service-test smemo rx -capi-maps-service-test sound_server rw -capi-maps-service-test system::home rwxat -capi-maps-service-test system::use_internet rw -capi-maps-service-test system::vconf_inhouse rx -capi-maps-service-test system::vconf_setting rx -capi-maps-service-test sys-assert::info wx -capi-maps-service-test tts-server x -capi-maps-service-test ug_bluetooth r -capi-maps-service-test ui-gadget::client rwx -capi-maps-service-test wifi_direct_manager w -capi-maps-service-test worldclock::db rw -capi-maps-service-test xorg rw -capi-maps-service-test alarm-server::alarm rw -capi-maps-service-test ug-setting-call-efl::vconf rl -capi-maps-service-test key-storage::db rw -capi-maps-service-test system::vconf_misc r -capi-maps-service-test bt-service rw -capi-maps-service-test bt-service::public rw -location_fw bt-service::public rw - -capi-maps-service-test location_fw rwx -capi-maps-service-test location_fw::client rwx -capi-maps-service-test location_fw::vconf rwx - - -# object setting -com.samsung.add-viewer capi-maps-service-test x -com.samsung.app-selector capi-maps-service-test x -com.samsung.app-tray capi-maps-service-test rx -com.samsung.data-provider-slave calendar-service::svc rw -com.samsung.data-provider-slave calendar-service rwx -com.samsung.data-provider-slave capi-maps-service-test rwx -com.samsung.data-provider-slave alarm-server::alarm rw -org.tizen.data-provider-slave calendar-service::svc rw -org.tizen.data-provider-slave calendar-service rwx -org.tizen.data-provider-slave capi-maps-service-test rx -com.samsung.indicator capi-maps-service-test rwx -com.samsung.lockscreen capi-maps-service-test rx -com.samsung.quickpanel capi-maps-service-test rx -nfc-share-service capi-maps-service-test rx -obexd capi-maps-service-test rx -ui-gadget::client capi-maps-service-test rwx - -# default include -capi-maps-service-test app.default include - -# ug include -capi-maps-service-test ug.libsample-ug-hello include -capi-maps-service-test ug.calendar-edit-efl include -capi-maps-service-test ug.email-composer-efl include -capi-maps-service-test ug.fileshare-efl include -capi-maps-service-test ug.msg-composer-efl include -capi-maps-service-test ug.nfc-share-efl include -capi-maps-service-test ug.setting-bluetooth-efl include -capi-maps-service-test ug.setting-myaccount-efl include diff --git a/test/src/api/maps_api_test.cpp b/test/src/api/maps_api_test.cpp index 853191c..51d2125 100755 --- a/test/src/api/maps_api_test.cpp +++ b/test/src/api/maps_api_test.cpp @@ -67,8 +67,7 @@ class test_env /* HERE */ { "HERE", - "app_id=gMutJ6Bo9jyMtOfJRGG1/app_code=" - "nXvwmBWgoCqp9U5_yslkcw", + "gMutJ6Bo9jyMtOfJRGG1/nXvwmBWgoCqp9U5_yslkcw", true } }; return info[idx]; @@ -310,7 +309,7 @@ void utc_maps_service_provider_is_service_supported_n(void) g_assert_cmpint(maps_service_provider_is_service_supported(e.m, (maps_service_e) (-1), &supported), ==, - MAPS_ERROR_NOT_SUPPORTED); + MAPS_ERROR_INVALID_PARAMETER); g_assert(!supported); g_assert_cmpint(maps_service_provider_is_service_supported(e.m, @@ -403,7 +402,7 @@ void utc_maps_service_provider_is_data_supported_n(void) g_assert_cmpint(maps_service_provider_is_data_supported(e.m, (maps_service_data_e) (-1), &supported), ==, - MAPS_ERROR_NOT_SUPPORTED); + MAPS_ERROR_INVALID_PARAMETER); g_assert(!supported); g_assert_cmpint(maps_service_provider_is_data_supported(e.m, @@ -673,7 +672,70 @@ static void __utc_maps_service_reverse_geocode_cb(maps_error_e result, g_assert_cmpint(result, ==, MAPS_ERROR_NONE); g_assert(address); - int error = maps_address_destroy(address); + + int error = 0; + + if (address) { + g_print("[%s] address\n", __FUNCTION__); + + char *building_number = NULL; + if (maps_address_get_building_number(address, + &building_number) == MAPS_ERROR_NONE) + g_print("\tbuilding number\t: %s\n", building_number); + g_free(building_number); + + char *street = NULL; + if (maps_address_get_street(address, &street) == MAPS_ERROR_NONE) + g_print("\tstreet\t: %s\n", street); + g_free(street); + + char *district = NULL; + if (maps_address_get_district(address, + &district) == MAPS_ERROR_NONE) + g_print("\tdistrict\t: %s\n", district); + g_free(district); + + char *city; + if (maps_address_get_city(address, &city) == MAPS_ERROR_NONE) + g_print("\tcity\t: %s\n", city); + + char *state = NULL; + if (maps_address_get_state(address, &state) == MAPS_ERROR_NONE) + g_print("\tstate\t: %s\n", state); + g_free(state); + + char *country = NULL; + if (maps_address_get_country(address, + &country) == MAPS_ERROR_NONE) + g_print("\tcountry\t: %s\n", country); + g_free(country); + + char *country_code = NULL; + if (maps_address_get_country_code(address, + &country_code) == MAPS_ERROR_NONE) + g_print("\tcountry code\t: %s\n", country_code); + g_free(country_code); + + char *county = NULL; + if (maps_address_get_county(address, &county) == MAPS_ERROR_NONE) + g_print("\tcounty\t: %s\n", county); + g_free(county); + + char *postal_code = NULL; + if (maps_address_get_postal_code(address, + &postal_code) == MAPS_ERROR_NONE) + g_print("\tpostal code\t: %s\n", postal_code); + g_free(postal_code); + + char *free_text = NULL; + if (maps_address_get_freetext(address, + &free_text) == MAPS_ERROR_NONE) + g_print("\tfreetext\t: %s\n", free_text); + g_free(free_text); + + error = maps_address_destroy(address); + } + g_assert_cmpint(error, ==, MAPS_ERROR_NONE); test_env* e = (test_env*) user_data; diff --git a/test/src/api/maps_area_test.cpp b/test/src/api/maps_area_test.cpp index 786bbf6..2678570 100644 --- a/test/src/api/maps_area_test.cpp +++ b/test/src/api/maps_area_test.cpp @@ -19,77 +19,61 @@ #include "maps_error.h" #include -/* int maps_area_create_rectangle (maps_coordinates_h left_top, -* maps_coordinates_h right_bottom, maps_area_h* area); */ +/* int maps_area_create_rectangle (maps_coordinates_h top_left, +* maps_coordinates_h bottom_right maps_area_h* area); */ void utc_maps_area_create_rectangle_p(void) { - maps_coordinates_h left_top = NULL; - int error = maps_coordinates_create(44.4, 22.2, -#if _MAPS_COORDS_3D_ - 33.3, -#endif - &left_top); + maps_coordinates_h top_left = NULL; + int error = maps_coordinates_create(44.4, 22.2, &top_left); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - maps_coordinates_h right_bottom = NULL; - error = maps_coordinates_create(11.1, 55.5, -#if _MAPS_COORDS_3D_ - 66.6, -#endif - &right_bottom); + maps_coordinates_h bottom_right = NULL; + error = maps_coordinates_create(11.1, 55.5, &bottom_right); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); maps_area_h area = NULL; - error = maps_area_create_rectangle(left_top, right_bottom, &area); + error = maps_area_create_rectangle(top_left, bottom_right, &area); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); g_assert(area); error = maps_area_destroy(area); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - error = maps_coordinates_destroy(left_top); + error = maps_coordinates_destroy(top_left); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - error = maps_coordinates_destroy(right_bottom); + error = maps_coordinates_destroy(bottom_right); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); } void utc_maps_area_create_rectangle_n(void) { - maps_coordinates_h left_top = NULL; - int error = maps_coordinates_create(11.1, 22.2, -#if _MAPS_COORDS_3D_ - 33.3, -#endif - &left_top); + maps_coordinates_h top_left = NULL; + int error = maps_coordinates_create(11.1, 22.2, &top_left); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - maps_coordinates_h right_bottom = NULL; - error = maps_coordinates_create(44.4, 55.5, -#if _MAPS_COORDS_3D_ - 66.6, -#endif - &right_bottom); + maps_coordinates_h bottom_right = NULL; + error = maps_coordinates_create(44.4, 55.5, &bottom_right); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); maps_area_h area = NULL; - error = maps_area_create_rectangle(NULL, right_bottom, &area); + error = maps_area_create_rectangle(NULL, bottom_right, &area); g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER); g_assert(!area); - error = maps_area_create_rectangle(left_top, NULL, &area); + error = maps_area_create_rectangle(top_left, NULL, &area); g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER); g_assert(!area); - error = maps_area_create_rectangle(left_top, right_bottom, NULL); + error = maps_area_create_rectangle(top_left, bottom_right, NULL); g_assert_cmpint(error, ==, MAPS_ERROR_INVALID_PARAMETER); g_assert(!area); - error = maps_coordinates_destroy(left_top); + error = maps_coordinates_destroy(top_left); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - error = maps_coordinates_destroy(right_bottom); + error = maps_coordinates_destroy(bottom_right); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); } @@ -186,24 +170,16 @@ void utc_maps_area_clone_p(void) } { /* Clone rectangular area */ - maps_coordinates_h left_top = NULL; - int error = maps_coordinates_create(44.4, 22.2, -#if _MAPS_COORDS_3D_ - 33.3, -#endif - &left_top); + maps_coordinates_h top_left = NULL; + int error = maps_coordinates_create(44.4, 22.2, &top_left); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - maps_coordinates_h right_bottom = NULL; - error = maps_coordinates_create(11.1, 55.5, -#if _MAPS_COORDS_3D_ - 66.6, -#endif - &right_bottom); + maps_coordinates_h bottom_right = NULL; + error = maps_coordinates_create(11.1, 55.5, &bottom_right); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); maps_area_h area = NULL; - error = maps_area_create_rectangle(left_top, right_bottom, + error = maps_area_create_rectangle(top_left, bottom_right, &area); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); g_assert(area); @@ -219,10 +195,10 @@ void utc_maps_area_clone_p(void) error = maps_area_destroy(cloned); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - error = maps_coordinates_destroy(left_top); + error = maps_coordinates_destroy(top_left); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); - error = maps_coordinates_destroy(right_bottom); + error = maps_coordinates_destroy(bottom_right); g_assert_cmpint(error, ==, MAPS_ERROR_NONE); } } diff --git a/test/src/maps_service_test.cpp b/test/src/maps_service_test.cpp index 6ba0d29..8b54fe8 100755 --- a/test/src/maps_service_test.cpp +++ b/test/src/maps_service_test.cpp @@ -26,10 +26,10 @@ /* */ /* */ /* - Correctness Unit Tests */ -/*#define MAPS_SERVICE_CORRECTNESS_TEST*/ +#define MAPS_SERVICE_CORRECTNESS_TEST /* */ /* - Load Unit Tests */ -#define MAPS_SERVICE_LOAD_TEST +/*#define MAPS_SERVICE_LOAD_TEST*/ /* */ /* - Valgrind Tests */ /*#define MAPS_SERVICE_VALGRIND_TEST */ @@ -1050,4 +1050,4 @@ int main(int argc, char **argv) #else return 0; #endif /* MAPS_SERVICE_CORRECTNESS_TEST */ -} \ No newline at end of file +} diff --git a/test/src/util/maps_object.cpp b/test/src/util/maps_object.cpp index 7b58d99..aaa1472 100644 --- a/test/src/util/maps_object.cpp +++ b/test/src/util/maps_object.cpp @@ -150,20 +150,20 @@ maps_area_type_e maps::area::get_type() const return a->type; } -maps::coordinates maps::area::get_left_top() const +maps::coordinates maps::area::get_top_left() const { if (!handle) return coordinates(.0, .0); maps_area_s* a = (maps_area_s*) handle; - return coordinates(a->rect.left_top); + return coordinates(a->rect.top_left); } -maps::coordinates maps::area::get_right_bottom() const +maps::coordinates maps::area::get_bottom_right() const { if (!handle) return coordinates(.0, .0); maps_area_s* a = (maps_area_s*) handle; - return coordinates(a->rect.right_bottom); + return coordinates(a->rect.bottom_right); } maps::coordinates maps::area::get_center() const @@ -190,9 +190,9 @@ bool maps::area::operator==(const area & a) const return false; switch (get_type()) { case MAPS_AREA_RECTANGLE: - if (get_left_top() != a.get_left_top()) + if (get_top_left() != a.get_top_left()) return false; - if (get_right_bottom() != a.get_right_bottom()) + if (get_bottom_right() != a.get_bottom_right()) return false; break; case MAPS_AREA_CIRCLE: diff --git a/test/src/util/maps_object.h b/test/src/util/maps_object.h index d1fbc99..3b1e97b 100644 --- a/test/src/util/maps_object.h +++ b/test/src/util/maps_object.h @@ -202,8 +202,8 @@ namespace maps bool operator!=(const area &a) const; public: maps_area_type_e get_type() const; - coordinates get_left_top() const; - coordinates get_right_bottom() const; + coordinates get_top_left() const; + coordinates get_bottom_right() const; coordinates get_center() const; double get_radius() const; }; -- 2.7.4