*
*
*
- * @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
* .
* 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 <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
*/
-#endif /*__MAPS_SERVICE_DOC_H__ */
\ No newline at end of file
+#endif /*__MAPS_SERVICE_DOC_H__ */
#define __MAPS_ADDRESS_H__
/**
- * @ingroup CAPI_MAPS_GEOCODER_MODULE
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
* @defgroup CAPI_MAPS_ADDRESS_MODULE Address
*
* @file maps_address.h
#include <maps_coordinates.h>
/**
- * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
* @defgroup CAPI_MAPS_GEOAREA_MODULE Area
*
* @file maps_area.h
* @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;
* @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()
* @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);
/**
* 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
#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
#include <tizen_error.h>
/**
- * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
* @defgroup CAPI_MAPS_ERROR_MODULE Errors
*
* @file maps_error.h
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 =
#include <tizen_type.h>
/**
- * @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
/**
* @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.
/**
* @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.
/**
* @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.
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.
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
/**
* @ingroup CAPI_MAPS_PLUGIN_MODULE
- * @defgroup CAPI_MAPS_PLUGIN_PLACE_MODULE Place
+ * @defgroup CAPI_MAPS_PLUGIN_PLACE_MODULE Places
*/
/**
/**
*
* @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
/**
*
- * @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
#endif
/**
- * @ingroup CAPI_MAPS_SERVICE_AND_PREFERENCE_MODULE
+ * @ingroup CAPI_MAPS_SERVICE_MODULE
* @defgroup CAPI_MAPS_PREFERENCE_MODULE Preference
*
* @file maps_preference.h
#include <maps_preference.h>
/**
- * @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.
*/
#include <maps_route.h>
+/**
+ * @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.
/*----------------------------------------------------------------------------*/
/*
- * 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.
*
*/
/**
* @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
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().
*
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
* @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
* @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()
/**
* @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
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
* @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
* \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
/**
* @ingroup CAPI_MAPS_SERVICE_MODULE
- * @defgroup CAPI_MAPS_PLACE_MODULE Place
+ * @defgroup CAPI_MAPS_PLACE_MODULE Places
*
* @addtogroup CAPI_MAPS_PLACE_MODULE
* @{
* \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
/**
* @ingroup CAPI_MAPS_SERVICE_MODULE
- * @defgroup CAPI_MAPS_ROUTE_MODULE Route
+ * @defgroup CAPI_MAPS_ROUTE_MODULE Routes
*
* @addtogroup CAPI_MAPS_ROUTE_MODULE
* @{
* \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
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
%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
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
#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;
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;
{
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"); */
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) {
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) {
"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,
"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
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;
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;
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;
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;
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
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;
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;
{
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;
}
{
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;
}
{
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;
}
{
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;
}
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;
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;
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;
{
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;
{
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;
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;
--- /dev/null
+/* 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;
+}
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
#include "thread.h"
#include "command.h"
#include "command_queue.h"
+#include "empty_module.h"
extern const char *MAPS_PLUGINS_PATH_PREFIX;
new_plugin->module = plugin;
/* 2.2 Set plugin interface */
+ new_plugin->interface = get_empty_interface();
/* Plugin dedicated functions */
new_plugin->interface.maps_plugin_init =
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();
MAPS_LOGD("maps_plugin_cancel_request:\t\t%p",
itf->maps_plugin_cancel_request);
MAPS_LOGD("*********************************************");
-}
\ No newline at end of file
+}
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;
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;
/*----------------------------------------------------------------------------*/
+/*
+ * 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)
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_ */
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:
friend class command_queue;
};
+#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
class queue_autoref
{
};
-#endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */
\ No newline at end of file
+#endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */
#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,
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,
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;
}
/*----------------------------------------------------------------------------*/
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;
}
/*----------------------------------------------------------------------------*/
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(
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(
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;
}
/*----------------------------------------------------------------------------*/
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;
}
/*----------------------------------------------------------------------------*/
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;
}
/*----------------------------------------------------------------------------*/
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(
(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;
+}
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);
virtual ~command_geocode_handler()
{
};
+ 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,
};
/*----------------------------------------------------------------------------*/
+
+ /* 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,
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
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();
};
/*----------------------------------------------------------------------------*/
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
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();
};
/*----------------------------------------------------------------------------*/
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 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,
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,
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();
};
/*----------------------------------------------------------------------------*/
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();
};
/*----------------------------------------------------------------------------*/
{
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,
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();
};
/*----------------------------------------------------------------------------*/
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();
};
/*----------------------------------------------------------------------------*/
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)
{
virtual ~command_cancel_request()
{
};
+ 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__ */
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)
command_queue *cq = session::command_queue::interface();
cq->clear(p);
-}
\ No newline at end of file
+}
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);
};
};
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
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)
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
+++ /dev/null
-<manifest>
- <define>
- <domain name="capi-maps-service-test"/>
- <request>
- <smack request="connman::get" type="rw" />
- <smack request="system::use_internet" type="rw"/>
- </request>
- <permit>
- <smack permit="connman::get" type="rw" />
- <smack permit="system::use_internet" type="rw" />
- </permit>
- </define>
- <request>
- <domain name="capi-maps-service-test"/>
- </request>
- <assign>
- <filesystem path="/usr/lib/maps/plugins/libmaps-plugin-here.so*" label="_" exec_label="none" />
- <filesystem path="/usr/lib/libheremap-engine.so*" label="_" exec_label="none" />
- </assign>
-</manifest>
+++ /dev/null
-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
/* HERE */
{ "HERE",
- "app_id=gMutJ6Bo9jyMtOfJRGG1/app_code="
- "nXvwmBWgoCqp9U5_yslkcw",
+ "gMutJ6Bo9jyMtOfJRGG1/nXvwmBWgoCqp9U5_yslkcw",
true }
};
return info[idx];
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,
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,
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;
#include "maps_error.h"
#include <glib.h>
-/* 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);
}
}
{ /* 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);
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);
}
}
/* */
/* */
/* - 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 */
#else
return 0;
#endif /* MAPS_SERVICE_CORRECTNESS_TEST */
-}
\ No newline at end of file
+}
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
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:
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;
};