Enhancement of source codes 61/64861/2
authorchanywa <cbible.kim@samsung.com>
Wed, 6 Apr 2016 01:18:01 +0000 (10:18 +0900)
committerchanywa <cbible.kim@samsung.com>
Wed, 6 Apr 2016 05:47:52 +0000 (14:47 +0900)
- replaced several g_slice_new0() and g_slice_free() to g_new0 and g_free()
- added maps_int_hashtable_xxxx(0 functions
- rearranged indents
- fixed not to use the queue when commands are requested through session class

Change-Id: If5efb8a5f0105f75d1f52dbe7e5a8c5f63dcc1dc

22 files changed:
CMakeLists.txt
include/maps_address.h
include/maps_extra_types.h
include/maps_service.h
src/api/maps_address.cpp
src/api/maps_area.cpp
src/api/maps_coordinates.cpp
src/api/maps_extra_types.cpp
src/api/maps_place.cpp
src/api/maps_place_private.h
src/api/maps_route.cpp
src/api/maps_route_private.h
src/api/maps_route_segment.cpp
src/api/maps_route_segment_private.h
src/api/maps_service.cpp
src/maps_util.h
src/plugin/empty_module.cpp
src/plugin/module.cpp
src/plugin/module.h
src/session/commands.cpp
src/session/commands.h
test/src/api/maps_route_test.cpp

index cd25cbea5b66171185cc650ea97f1776d6f78073..c81304f16703a666e4e2de4eb9f243569c33805a 100644 (file)
@@ -15,9 +15,14 @@ SET(INTERNAL_INC_DIR
        )
 INCLUDE_DIRECTORIES(${INC_DIR} ${INTERNAL_INC_DIR})
 
-#SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common security-privilege-checker")
-SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common")
+SET(dependents
+       # Maps API dependencies
+       glib-2.0
+       gmodule-2.0
+       capi-base-common
+       dlog
 
+       )
 SET(pc_dependents "capi-base-common")
 
 INCLUDE(FindPkgConfig)
index 5e8c0fc8bd5182d23056e74bdf88b828ac6871a4..35eaca16a1439491458a958ac5504529b5ebace7 100755 (executable)
@@ -506,6 +506,7 @@ int maps_address_list_create(maps_address_list_h *address_list);
 /**
  * @brief      Appends an address to an address list.
  * @since_tizen 3.0
+ * @remarks    Don't release @a address before removed from the list using maps_address_list_remove().
  *
  * @param[in]  address_list    The address list handle
  * @param[in]  address The address handle
@@ -516,12 +517,15 @@ int maps_address_list_create(maps_address_list_h *address_list);
  *
  * @see maps_address_list_create()
  * @see maps_address_list_destroy()
+ * @see maps_address_create()
  */
 int maps_address_list_append(maps_address_list_h address_list, maps_address_h address);
 
 /**
  * @brief      Removes an address from an address list.
  * @since_tizen 3.0
+ * @remarks    @a address is just excepted from the list.\n
+ * It must be released using maps_address_destroy().
  *
  * @param[in]  address_list    The address list handle
  * @param[in]  address The address handle
@@ -531,6 +535,7 @@ int maps_address_list_append(maps_address_list_h address_list, maps_address_h ad
  *
  * @see maps_address_list_create()
  * @see maps_address_list_destroy()
+ * @see maps_address_destroy()
  */
 int maps_address_list_remove(maps_address_list_h address_list, maps_address_h address);
 
@@ -559,7 +564,9 @@ int maps_address_list_get_length(maps_address_list_h address_list, int *length);
  *
  * @return @c true to continue with the next iteration of the loop, \n
  *         @c false to break out of the loop
+ *
  * @see maps_address_list_foreach_address()
+ * @see maps_address_list_destroy()
  */
 typedef bool (*maps_address_cb)(int index, maps_address_h address, void *user_data);
 
index 533c9c79735a0a76e8b4185e282282ac6e88741a..4d5cf601b210d71d954cb7d60bc2d253e89559bc 100755 (executable)
@@ -155,6 +155,7 @@ int maps_item_list_clone(const maps_item_list_h origin,
  * @details This function appends an item @a data to the list of item pointers
  * @a list.
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
+ * @remarks If @a clone_func is null, @a data will not be cloned.
  *
  * @param[in]  list            The handle of list
  * @param[in]  data            The item pointer to be pointed to the list
@@ -201,8 +202,6 @@ typedef bool(*maps_item_list_foreach_cb) (int index, int total, void *data,
  * @details This function delivers items of a specified list via
  * maps_item_list_foreach_cb() callback.
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
- * @remarks This function clones the list values during maps_item_list_foreach() procedure.
- * \n maps_item_list_foreach_noclone() is useful to reduce the memory consumption.
  *
  * @param[in]  list            The handle of list
  * @param[in]  clone_func      The function for cloning the list values
@@ -221,7 +220,6 @@ typedef bool(*maps_item_list_foreach_cb) (int index, int total, void *data,
  *
  * @see maps_item_list_foreach_cb()
  * @see maps_item_list_append()
- * @see maps_item_list_foreach_noclone()
  * @see maps_service_create()
  */
 int maps_item_list_foreach(maps_item_list_h list,
@@ -250,7 +248,34 @@ int maps_item_list_foreach(maps_item_list_h list,
 typedef int (*maps_item_list_free_cb) (void *data);
 
 /**
- * @brief      Removes and destroys all list items
+ * @brief      Removes and destroys list item.
+ * @details This function removes the given items from the @a list and releases
+ * resources, assigned with it.
+ * @since_tizen 3.0
+ * @remarks The @a item is destroyed with #maps_item_list_free_cb. If this
+ * callback is NULL, item will not be destroyed.
+ *
+ * @param[in]  list            The handle of list
+ * @param[in]  item            The to remove
+ * @param[in]  free_func       The callback to be invoked for destroying each
+ * list item
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a list is created using maps_item_list_create().
+ * @post #maps_item_list_free_cb is used to destroy the item of the list.
+ *
+ * @see maps_item_list_free_cb()
+ * @see maps_item_list_create()
+ * @see maps_item_list_remove_all()
+ */
+int maps_item_list_remove(maps_item_list_h list,
+                         void *item,
+                         maps_item_list_free_cb free_func);
+
+/**
+ * @brief      Removes and destroys all list items.
  * @details This function removes all items of the @a list and releases
  * resources, assigned with them.
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
@@ -568,6 +593,248 @@ int maps_string_hashtable_contains(maps_string_hashtable_h table,
 
 /*----------------------------------------------------------------------------*/
 
+/*
+ * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
+ * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_INT_HASHTABLE Maps Integer Hash Tables
+ *
+ * @file maps_extra_types.h
+ * @brief This section contains API for using Hash Table of integers.
+ *
+ * @addtogroup CAPI_MAPS_CONTAINERS_MODULE_INT_HASHTABLE
+ * @{
+ * @brief This provides API for using Hash Table of integers.
+ */
+
+/*
+ * @brief      The handle of Hash Table of integers.
+ * @details The handle of Hash Table of integers can be obtained via call of
+ * maps_int_hashtable_create().
+ * @remarks To release the handle use maps_int_hashtable_destroy().
+ * \n To clone the handle use maps_int_hashtable_clone().
+ * \n To assign the value to a key use maps_int_hashtable_set().
+ * \n The value, assigned with a specified key may be obtained using maps_int_hashtable_get().
+ * \n All key-value pairs of the table may be iterated using maps_int_hashtable_foreach().
+ * \n The key-value pair may be removed form the table using maps_int_hashtable_remove().
+ * \n To check if key is added to the table use maps_int_hashtable_contains().
+ * @since_tizen 3.0
+ *
+ * @see maps_int_hashtable_create()
+ * @see maps_int_hashtable_destroy()
+ * @see maps_int_hashtable_clone()
+ */
+typedef void *maps_int_hashtable_h;
+
+/*
+ * @brief      Creates a new Hash Table of integers.
+ * @details This function creates a new instance of Hash Table of integers,
+ * associate a new handle with it and allocates all needed resources.
+ * @since_tizen 3.0
+ * @remarks @a table must be released using maps_int_hashtable_destroy().
+ * \n @a table may be cloned using maps_int_hashtable_clone().
+ *
+ * @param[out] table           The handle of newly created table
+ * @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
+ *
+ * @see maps_int_hashtable_clone()
+ * @see maps_int_hashtable_destroy()
+ */
+int maps_int_hashtable_create(maps_int_hashtable_h *table);
+
+/*
+ * @brief      Destroys the Hash Table of integers and releases all its
+ * resources.
+ * @details This function destroys the Hash Table handle and releases all its
+ * resources.
+ * @since_tizen 3.0
+ * @remarks All integers stored in the table will be released.
+ *
+ * @param[in]  table           The handle of table to be destroyed
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_create()
+ * @see maps_int_hashtable_clone()
+ */
+int maps_int_hashtable_destroy(maps_int_hashtable_h table);
+
+/*
+ * @brief      Clones the Hash Table of integerss.
+ * @details This function clones the Hash Table of integers @a origin and all
+ * its resources.
+ * \n The list handle @a origin may be created using
+ * maps_int_hashtable_create().
+ * @since_tizen 3.0
+ * @remarks @a cloned must be released using maps_int_hashtable_destroy().
+ *
+ * @param[in]  origin          The handle of the table to be cloned
+ * @param[out] cloned          The handle of the cloned table
+ * @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 table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_create()
+ * @see maps_int_hashtable_destroy()
+ */
+int maps_int_hashtable_clone(const maps_int_hashtable_h origin,
+                            maps_int_hashtable_h *cloned);
+
+/*
+ * @brief      Sets the association between integer key and value in the table.
+ * @details This function sets the association between int key and value in
+ * the Hash Table.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @param[in]  value           The integer value of "value"
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_remove()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_set(maps_int_hashtable_h table, const int key,
+                          const int value);
+
+/*
+ * @brief      Gets the integer value associated with an integer key in the
+ * table.
+ * @details This function gets the integer value associated with a integer key
+ * in the Hash Table.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @param[out] value           The integer value of "value"
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_remove()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_get(maps_int_hashtable_h table, const int key,
+                          int *value);
+
+/*
+ * @brief      Removes the key-value pair from the table.
+ * @details This function removes the key-value pair from the Hash Table.
+ * @since_tizen 3.0
+ * @remarks The resources, used by item will be released automatically.
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_remove(maps_int_hashtable_h table,
+                             const int key);
+
+/*
+ * @brief      Called once for each key-value pair while iterating through
+ * the given table.
+ * @details This function is called once for each key-value pair of the given
+ * table while the table is being iterated
+ * during the maps_int_hashtable_foreach() procedure.
+ * @since_tizen 3.0
+ *
+ * @param[in]  index           The current index of item
+ * @param[in]  total           The total amount of items
+ * @param[in]  key             The integer value of "key"
+ * @param[in]  value           The integer value of "value"
+ * @param[in]  user_data       The user data passed from
+ * maps_int_hashtable_foreach()
+ * @return     @c true to continue with the next iteration of the loop, \n @c
+ * false to break out of the loop
+ *
+ * @pre maps_int_hashtable_foreach() will invoke this callback.
+ *
+ * @see maps_int_hashtable_foreach()
+ */
+typedef bool(*maps_int_hashtable_foreach_cb) (int index, int total,
+                                             const int key, const int value,
+                                             void *user_data);
+
+/*
+ * @brief      Gets the key-value pairs of the specified table.
+ * @details This function delivers key-value pairs of a specified table via
+ * maps_int_hashtable_foreach_cb() callback.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of table
+ * @param[in]  callback        The callback to be invoked for delivering each
+ * key-value pair
+ * @param[in]  user_data       The user data to be passed to the callback
+ * function
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_NOT_FOUND Result not found
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ * @post This function invokes maps_int_hashtable_foreach_cb() to deliver
+ * key-value pairs.
+ *
+ * @see maps_int_hashtable_foreach_cb()
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_foreach(maps_int_hashtable_h table,
+                                 maps_int_hashtable_foreach_cb callback,
+                                 void *user_data);
+
+/*
+ * @brief      Checks if key is in hash_table.
+ * @details This function checks if the specified key is in the Hash Table of
+ * integers.
+ * @since_tizen 3.0
+ *
+ * @param[in]  table           The handle of the table
+ * @param[in]  key             The integer value of "key"
+ * @param[out] contains        The flag of key presence
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a table is created using maps_int_hashtable_create().
+ *
+ * @see maps_int_hashtable_set()
+ * @see maps_int_hashtable_get()
+ * @see maps_int_hashtable_create()
+ */
+int maps_int_hashtable_contains(maps_int_hashtable_h table,
+                               const int key, bool *contains);
+
+/*
+ * @}
+ */
+
+/*----------------------------------------------------------------------------*/
+
 /**
  * @ingroup    CAPI_MAPS_CONTAINERS_MODULE
  * @defgroup   CAPI_MAPS_CONTAINERS_MODULE_ITEM_HASHTABLE Maps Item Hash Tables
index 31279097fde066d207e8dcf90db9e069ca8b288e..e3026c579d55d4526bd5bb3506c0b0c8f20612e8 100644 (file)
@@ -57,40 +57,19 @@ extern "C" {
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  */
 typedef enum _maps_service_e {
-
-       MAPS_SERVICE_GEOCODE, /**< Indicates that maps_service_geocode()
-               service is allowed */
-
-       MAPS_SERVICE_GEOCODE_INSIDE_AREA, /**< Indicates that
-               maps_service_geocode_inside_area() service is allowed */
-
-       MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS, /**< Indicates that
-               maps_service_geocode_by_structured_address() service is
-               allowed */
-
-       MAPS_SERVICE_REVERSE_GEOCODE, /**< Indicates that
-               maps_service_reverse_geocode() service is allowed */
-
-       MAPS_SERVICE_SEARCH_PLACE, /**< Indicates that
-               maps_service_search_place() service is allowed */
-
-       MAPS_SERVICE_SEARCH_PLACE_BY_AREA, /**< Indicates that
-               maps_service_search_place_by_area() service is allowed */
-
-       MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS, /**< Indicates that
-               maps_service_search_place_by_address() service is allowed */
-
-       MAPS_SERVICE_SEARCH_ROUTE, /**< Indicates that
-               maps_service_search_route() service is allowed */
-
-       MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS, /**< Indicates that
-               maps_service_search_route_waypoints() service is allowed */
-       MAPS_SERVICE_CANCEL_REQUEST,                    /**< Indicates that
-                       maps_service_cancel_request() service is allowed */
-       MAPS_SERVICE_MULTI_REVERSE_GEOCODE,             /**< Indicates that
-       maps_service_multi_reverse_geocode() service is allowed (Since 3.0)*/
-       MAPS_SERVICE_SEARCH_PLACE_LIST                  /** Indicates that
-       maps_service_search_place_list() service is allowed (Since 3.0) */
+       MAPS_SERVICE_GEOCODE,                                   /**< Indicates that maps_service_geocode() service is allowed */
+       MAPS_SERVICE_GEOCODE_INSIDE_AREA,               /**< Indicates that maps_service_geocode_inside_area() service is allowed */
+       MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS,     /**< Indicates that     maps_service_geocode_by_structured_address() service is allowed */
+       MAPS_SERVICE_REVERSE_GEOCODE,                   /**< Indicates that maps_service_reverse_geocode() service is allowed */
+       MAPS_SERVICE_SEARCH_PLACE,                              /**< Indicates that maps_service_search_place() service is allowed */
+       MAPS_SERVICE_SEARCH_PLACE_BY_AREA,              /**< Indicates that maps_service_search_place_by_area() service is allowed */
+       MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS,   /**< Indicates that maps_service_search_place_by_address() service is allowed */
+       MAPS_SERVICE_SEARCH_ROUTE,                              /**< Indicates that maps_service_search_route() service is allowed */
+       MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS,    /**< Indicates that maps_service_search_route_waypoints() service is allowed */
+       MAPS_SERVICE_CANCEL_REQUEST,                    /**< Indicates that maps_service_cancel_request() service is allowed */
+       MAPS_SERVICE_MULTI_REVERSE_GEOCODE,             /**< Indicates that maps_service_multi_reverse_geocode() service is allowed (Since 3.0)*/
+       MAPS_SERVICE_SEARCH_PLACE_LIST,                 /**< Indicates that maps_service_search_place_list() service is allowed (Since 3.0) */
+       MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS   /**< Indicates that maps_service_search_get_place_details() service is allowed (Since 3.0) */
 } maps_service_e;
 
 /**
@@ -98,48 +77,19 @@ typedef enum _maps_service_e {
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  */
 typedef enum _maps_service_data_e {
-
-       MAPS_PLACE_ADDRESS, /**< Indicates the availability of address value
-               in the Place data */
-
-       MAPS_PLACE_RATING, /**< Indicates the availability of rating value in
-               the Place data */
-
-       MAPS_PLACE_CATEGORIES, /**< Indicates the availability of place category
-               list in the Place data */
-
-       MAPS_PLACE_ATTRIBUTES, /**< Indicates the availability of place
-               attribute list in the Place data */
-
-       MAPS_PLACE_CONTACTS, /**< Indicates the availability of place contact
-               list in the Place data */
-
-       MAPS_PLACE_EDITORIALS, /**< Indicates the availability of place
-               editorial list in the Place data */
-
-       MAPS_PLACE_REVIEWS, /**< Indicates the availability of place review list
-               in the Place data */
-
-       MAPS_PLACE_IMAGE, /**< Indicates the availability of place image in
-               Place the data */
-
-       MAPS_PLACE_SUPPLIER, /**< Indicates the availability of place supplier
-               link value in the Place data */
-
-       MAPS_PLACE_RELATED, /**< Indicates the availability of related place
-               link in the Place data */
-
-       MAPS_ROUTE_PATH, /**< Indicates that the Route Data Structure is defined
-               as a Path (a list of geographical coordinates) */
-
-       MAPS_ROUTE_SEGMENTS_PATH, /**< Indicates that the Route Data Structure
-               is defined as a list of Segments while each segment is defined
-               as a Path */
-
-       MAPS_ROUTE_SEGMENTS_MANEUVERS /**< Indicates that the Route Data
-               Structure is defined as a list of Segments while each segment is
-               defined as a list of Maneuvers*/
-
+       MAPS_PLACE_ADDRESS,             /**< Indicates the availability of address value in the Place data */
+       MAPS_PLACE_RATING,              /**< Indicates the availability of rating value in the Place data */
+       MAPS_PLACE_CATEGORIES,  /**< Indicates the availability of place category list in the Place data */
+       MAPS_PLACE_ATTRIBUTES,  /**< Indicates the availability of place attribute list in the Place data */
+       MAPS_PLACE_CONTACTS,    /**< Indicates the availability of place contact list in the Place data */
+       MAPS_PLACE_EDITORIALS,  /**< Indicates the availability of place editorial list in the Place data */
+       MAPS_PLACE_REVIEWS,             /**< Indicates the availability of place review list in the Place data */
+       MAPS_PLACE_IMAGE,               /**< Indicates the availability of place image in Place the data */
+       MAPS_PLACE_SUPPLIER,    /**< Indicates the availability of place supplier link value in the Place data */
+       MAPS_PLACE_RELATED,             /**< Indicates the availability of related place link in the Place data */
+       MAPS_ROUTE_PATH,                /**< Indicates that the Route Data Structure is defined as a Path (a list of geographical coordinates) */
+       MAPS_ROUTE_SEGMENTS_PATH,               /**< Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a Path */
+       MAPS_ROUTE_SEGMENTS_MANEUVERS   /**< Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a list of Maneuvers*/
 } maps_service_data_e;
 
 /**
@@ -481,12 +431,12 @@ int maps_service_cancel_request(const maps_service_h maps, int request_id);
  * @addtogroup CAPI_MAPS_GEOCODER_MODULE
  * @{
  * @brief This provides APIs for Geocoder Service
- * @details The Maps Geocoding API allows mapping an address to its geographical
- * location defined in terms of latitude and longitude; the input can be a
- * qualified, structured address or a free form single search text with full
- * or partial address information.
- * \n The Maps Reverse Geocoding API allows to inverse mapping a geographical
- * location (longitude, latitude) to an address;
+ * @details The Maps Geocoding API allows translating an address to its
+ * geographical location defined in terms of latitude and longitude;
+ * the input can be a qualified, structured address or a free form single search
+ * text with full or partial address information.
+ * \n The Maps Reverse Geocoding API allows to inverse translating a
+ * geographical location (longitude, latitude) to an address;
  * it can be used to answer the question "Where am I?".
  *
  */
@@ -992,7 +942,7 @@ typedef void(*maps_service_get_place_details_cb) (maps_error_e error,
  *
  * @param[in]  maps            The Maps Service handle
  * @param[in]  position        The interested position
- * @param[in]  distance        The search area distance in meters
+ * @param[in]  distance        The search area distance
  * @param[in]  filter          The filter handle
  * @param[in]  preference      The place preference handle
  * @param[in]  callback        The result callback
index e9213e1d7207b2053d8c8973563ac96a1f806f8d..ead367d7dc14cd77ecf006b333f91b0b96d470cf 100755 (executable)
@@ -58,7 +58,7 @@ EXPORT_API int maps_address_create(maps_address_h *address)
        if (!address)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       maps_address_s *a = g_slice_new0(maps_address_s);
+       maps_address_s *a = g_new0(maps_address_s, 1);
        if (!a) {
                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
                return MAPS_ERROR_OUT_OF_MEMORY;
@@ -96,7 +96,7 @@ EXPORT_API int maps_address_destroy(maps_address_h address)
        if (a->county)
                g_free(a->county);
 
-       g_slice_free(maps_address_s, a);
+       g_free(a);
        address = NULL;
 
        return MAPS_ERROR_NONE;
@@ -432,8 +432,7 @@ EXPORT_API int maps_address_list_foreach(maps_address_list_h address_list, maps_
 
        GList *l = (GList *)address_list;
        l = g_list_first(l);
-       while (l != NULL)
-       {
+       while (l != NULL) {
                GList *next = l->next;
                maps_address_s *address = (maps_address_s *)l->data;
                if (address) {
@@ -452,32 +451,6 @@ EXPORT_API int maps_address_list_foreach(maps_address_list_h address_list, maps_
        return MAPS_ERROR_NONE;
 }
 
-#if 0
-static void _free_address(gpointer data, gpointer user_data)
-{
-       if (!data) return;
-
-       maps_address_h address = (maps_address_h) data;
-       maps_address_h address_list = (maps_address_list_h) user_data;
-       int ret;
-
-       if (address_list) {
-               ret = maps_address_list_remove(address_list, address);
-               if (ret) {
-                       MAPS_LOGI("Failed to maps_address_list_remove!!!");
-               }
-       }
-
-       if (address) {
-               MAPS_LOGD("%p", address);
-               ret = maps_address_destroy(address);
-               if (ret) {
-                       MAPS_LOGI("Failed to maps_address_destroy!!!");
-               }
-       }
-}
-#endif
-
 EXPORT_API int maps_address_list_destroy(maps_address_list_h address_list)
 {
        if (!address_list)
@@ -486,14 +459,69 @@ EXPORT_API int maps_address_list_destroy(maps_address_list_h address_list)
        GList *list = (GList *) address_list;
        MAPS_LOGD("address_list:%p, length = %d", list, g_list_length(list));
 
-#if 0
-       list = g_list_first(list);
-       g_list_foreach(list, _free_address, list);
-       g_list_free(list);
-#endif
        g_list_free_full(list, (GDestroyNotify) maps_address_destroy);
        address_list = NULL;
 
        return MAPS_ERROR_NONE;
 }
 
+bool maps_address_is_valid(const maps_address_h address)
+{
+       if (!address) return false;
+
+       bool ret = true;
+       maps_address_s *a = (maps_address_s *) address;
+
+       do {
+               if (a->building_number && strlen(a->building_number) > _MAPS_ADDRESS_BUILDING_NUMBER_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+               if (a->street && strlen(a->street) > _MAPS_ADDRESS_STREET_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->district && strlen(a->district) > _MAPS_ADDRESS_DISTRICT_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->city && strlen(a->city) > _MAPS_ADDRESS_CITY_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->state && strlen(a->state) > _MAPS_ADDRESS_STATE_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->country_code && strlen(a->country_code) > _MAPS_ADDRESS_COUNTRY_CODE_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->postal_code && strlen(a->postal_code) > _MAPS_ADDRESS_POSTAL_CODE_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->freetext && strlen(a->freetext) > _MAPS_ADDRESS_FREE_TEXT_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->country && strlen(a->country) > _MAPS_ADDRESS_COUNTRY_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+
+               if (a->county && strlen(a->county) > _MAPS_ADDRESS_COUNTY_MAX_LENGTH) {
+                       ret = false;
+                       break;
+               }
+       } while (false);
+
+       return ret;
+}
\ No newline at end of file
index f579da09f032e3c36c1564b607387ded877bdc50..77d6a146a2f45d2204f40c33cc62833d1c46f49b 100755 (executable)
@@ -19,6 +19,8 @@
 #include "maps_area.h"
 #include "maps_util.h"
 
+extern bool maps_coordinates_is_valid(const maps_coordinates_h coordinates);
+
 EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h top_left,
                                          const maps_coordinates_h bottom_right,
                                          maps_area_h *area)
@@ -47,7 +49,7 @@ EXPORT_API int maps_area_create_rectangle(const maps_coordinates_h top_left,
                        return MAPS_ERROR_INVALID_PARAMETER;
        }
 
-       maps_area_s *bound = g_slice_new0(maps_area_s);
+       maps_area_s *bound = g_new0(maps_area_s, 1);
 
        if (bound == NULL) {
                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
@@ -72,9 +74,7 @@ EXPORT_API int maps_area_create_circle(const maps_coordinates_h center,
        if (radius < 0)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       /* MAPS_CHECK_CONDITION(radius > 0, MAPS_ERROR_INVALID_PARAMETER,
-       * "MAPS_ERROR_INVALID_PARAMETER"); */
-       maps_area_s *bound = g_slice_new0(maps_area_s);
+       maps_area_s *bound = g_new0(maps_area_s, 1);
 
        if (bound == NULL) {
                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
@@ -96,7 +96,7 @@ EXPORT_API int maps_area_destroy(maps_area_h area)
 
        maps_area_s *handle = (maps_area_s *) area;
 
-       g_slice_free(maps_area_s, handle);
+       g_free(handle);
        return MAPS_ERROR_NONE;
 }
 
@@ -115,10 +115,9 @@ EXPORT_API int maps_area_clone(const maps_area_h origin, maps_area_h *cloned)
                        (maps_coordinates_h) & rec_br, &new_rect);
                if (new_rect) {
                        *cloned = new_rect;
-               }
-               else
+               } else {
                        return MAPS_ERROR_INVALID_PARAMETER;
-
+               }
        }
        else if (origin_handle->type == MAPS_AREA_CIRCLE) {
                maps_area_h new_circle = NULL;
@@ -129,10 +128,83 @@ EXPORT_API int maps_area_clone(const maps_area_h origin, maps_area_h *cloned)
                        &new_circle);
                if (new_circle) {
                        *cloned = new_circle;
-               }
-               else
+               } else {
                        return MAPS_ERROR_INVALID_PARAMETER;
+               }
        }
 
        return MAPS_ERROR_NONE;
 }
+
+bool __is_valid_rect(maps_coordinates_h top_left, maps_coordinates_h bottom_right)
+{
+       bool ret = true;
+
+       do {
+               if (!maps_coordinates_is_valid(top_left) ||
+                       !maps_coordinates_is_valid(bottom_right)) {
+                       ret = false;
+                       break;
+               }
+
+               double tf_lat = .0;
+               double tf_lon = .0;
+               double rb_lat = .0;
+               double rb_lon = .0;
+
+               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_lon;
+
+               if (lon_interval < 180 && lon_interval > -180) {
+                       if (rb_lon <= tf_lon || rb_lat >= tf_lat)
+                               ret = false;
+               }
+               else {
+                       if (rb_lon >= tf_lon || rb_lat >= tf_lat)
+                               ret = false;
+               }
+       } while (false);
+
+       return ret;
+}
+
+bool maps_area_is_valid(const maps_area_h area)
+{
+       if (!area) return false;
+
+       bool ret = true;
+       maps_area_s *handle = (maps_area_s *) area;
+
+       do {
+               if (handle->type == MAPS_AREA_RECTANGLE) {
+                       maps_area_rectangle_s rect = handle->rect;
+
+                       if (!__is_valid_rect(&rect.top_left, &rect.bottom_right)) {
+                               ret = false;
+                               break;
+                       }
+               }
+               else if (handle->type == MAPS_AREA_CIRCLE) {
+                       maps_area_circle_s cir = handle->circle;
+                       maps_coordinates_s center = cir.center;
+
+                       if (cir.radius <= 0) {
+                               ret = false;
+                               break;
+                       }
+                       if (!maps_coordinates_is_valid(&center)) {
+                               ret = false;
+                               break;
+                       }
+               }
+               else {
+                       ret = false;
+               }
+       } while (false);
+
+       return ret;
+}
\ No newline at end of file
index f146a78be74a8843b002c571af3f2acad1436cf3..8aa25e4bd6a31b6eb17dabf07f69bdcb5aa3d040 100755 (executable)
@@ -34,8 +34,7 @@ EXPORT_API int maps_coordinates_create(const double latitude,
                && longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
                "MAPS_ERROR_INVALID_PARAMETER");
 
-       maps_coordinates_s *coord = g_slice_new0(maps_coordinates_s);
-
+       maps_coordinates_s *coord = g_new0(maps_coordinates_s, 1);
        if (coord == NULL) {
                MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
                return MAPS_ERROR_OUT_OF_MEMORY;
@@ -53,8 +52,7 @@ EXPORT_API int maps_coordinates_destroy(maps_coordinates_h coords)
                return MAPS_ERROR_INVALID_PARAMETER;
 
        maps_coordinates_s *handle = (maps_coordinates_s *) coords;
-       g_slice_free(maps_coordinates_s, handle);
-
+       g_free(handle);
        coords = NULL;
 
        return MAPS_ERROR_NONE;
@@ -65,20 +63,14 @@ EXPORT_API int maps_coordinates_clone(const maps_coordinates_h origin,
 {
        if (!cloned || !origin)
                return MAPS_ERROR_INVALID_PARAMETER;
-
        int error = MAPS_ERROR_NONE;
        do {
                maps_coordinates_s *c = (maps_coordinates_s *) origin;
-
-               error = maps_coordinates_create(c->latitude, c->longitude,
-                       cloned);
-
+               error = maps_coordinates_create(c->latitude, c->longitude, cloned);
                if (!(*cloned) or(error != MAPS_ERROR_NONE))
                        break;
-
                return MAPS_ERROR_NONE;
        } while (false);
-
        maps_coordinates_destroy(*cloned);
        *cloned = NULL;
        return error;
@@ -169,53 +161,23 @@ EXPORT_API int maps_coordinates_list_create(maps_coordinates_list_h *coordinates
 
        GList *list = g_list_alloc();
        MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
-       *coordinates_list = (void *) list;
-
-       return MAPS_ERROR_NONE;
-}
 
-EXPORT_API int maps_coordinates_list_append(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
-{
-       if (!coordinates_list || !coordinates)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
-       GList *list = g_list_append((GList *) coordinates_list, (gpointer) coordinates);
-       /*
-       Although this logic is faster, it doesn't guarantee the order of item.
-       GList *list = g_list_prepend((GList *) coordinates_list, (gpointer) coordinates);
-       list = g_list_reverse(list);
-       */
-
-       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
-       coordinates_list = (void *) list;
+       *coordinates_list = (void *) list;
 
        return MAPS_ERROR_NONE;
 }
 
-#if 0
-static void _free_coordinates(gpointer data, gpointer user_data)
+static void _free_coordinates(gpointer data)
 {
        if (!data) return;
 
-       maps_coordinates_h coordinates = (maps_coordinates_h) data;
-       maps_coordinates_list_h coordinates_list = (maps_coordinates_list_h) user_data;
        int ret = 0;
-
-       if (coordinates_list) {
-               ret = maps_coordinates_list_remove(coordinates_list, coordinates);
-               if (ret) {
-                       MAPS_LOGI("Failed to maps_coordinates_list_remove!!!");
-               }
-       }
-
-       if (coordinates) {
-               ret = maps_coordinates_destroy(coordinates);
-               if (ret) {
-                       MAPS_LOGI("Failed to maps_coordinates_destroy!!!");
-               }
+       maps_coordinates_s *coordinates = (maps_coordinates_s *) data;
+       ret = maps_coordinates_destroy(coordinates);
+       if (ret) {
+               MAPS_LOGI("Failed to maps_coordinates_destroy!!!");
        }
 }
-#endif
 
 EXPORT_API int maps_coordinates_list_destroy(maps_coordinates_list_h coordinates_list)
 {
@@ -223,26 +185,34 @@ EXPORT_API int maps_coordinates_list_destroy(maps_coordinates_list_h coordinates
                return MAPS_ERROR_INVALID_PARAMETER;
 
        GList *list = (GList *) coordinates_list;
-       MAPS_LOGD("length = %d", g_list_length(list));
-
-#if 0
-       list = g_list_first(list);
-       g_list_foreach(list, _free_coordinates, list);
-       g_list_free(list);
-#endif
-       g_list_free_full(list, (GDestroyNotify) maps_coordinates_destroy); 
+
+       g_list_free_full(list, (GDestroyNotify) _free_coordinates);
        coordinates_list = NULL;
 
        return MAPS_ERROR_NONE;
 }
 
+EXPORT_API int maps_coordinates_list_append(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
+{
+       if (!coordinates_list || !coordinates)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       GList *list = (GList *)coordinates_list;
+       maps_coordinates_s *coord = (maps_coordinates_s *)coordinates;
+       list = g_list_append(list, coord);
+       coordinates_list = (void *) list;
+
+       return MAPS_ERROR_NONE;
+}
+
 EXPORT_API int maps_coordinates_list_remove(maps_coordinates_list_h coordinates_list, maps_coordinates_h coordinates)
 {
        if (!coordinates_list || !coordinates)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       GList *list = g_list_remove((GList *)coordinates_list, (gpointer) coordinates);
-       MAPS_CHECK_CONDITION(list, MAPS_ERROR_OUT_OF_MEMORY, "MAPS_ERROR_OUT_OF_MEMORY");
+       GList *list = (GList *)coordinates_list;
+       maps_coordinates_s *coord = (maps_coordinates_s *)coordinates;
+       list = g_list_remove(list, coord);
        coordinates_list = (void *) list;
 
        return MAPS_ERROR_NONE;
@@ -266,24 +236,32 @@ EXPORT_API int maps_coordinates_list_foreach(maps_coordinates_list_h coordinates
        bool ret = true;
        int index = 0;
 
-       GList *list = (GList *)coordinates_list;
-       list = g_list_first(list);
-       while (list != NULL)
-       {
-               GList *next = list->next;
-               maps_coordinates_s *coordinates = (maps_coordinates_s *)list->data;
+       GList *list = g_list_first((GList *)coordinates_list);
+
+       GList *l;
+       for (l = (GList *)list; l != NULL; l = l->next)
+        {
+               maps_coordinates_s *coordinates = (maps_coordinates_s *)l->data;
                if (coordinates) {
-                       /*
-                       int ret = callback(index++, coordinates->latitude, coordinates->longitude, user_data);
-                       */
-                       MAPS_LOGD("index = %d", index);
                        ret = callback(index++, coordinates, user_data);
+                       if(!ret) break;
                }
-               if (ret)
-                       list = next;
-               else
-                       break;
        }
 
        return MAPS_ERROR_NONE;
 }
+
+bool maps_coordinates_is_valid(const maps_coordinates_h coordinates)
+{
+       if (!coordinates)
+               return false;
+
+       maps_coordinates_s *coord = (maps_coordinates_s *)coordinates;
+
+       MAPS_CHECK_CONDITION(coord->latitude >= -90 && coord->latitude <= 90, MAPS_ERROR_INVALID_PARAMETER,
+               "MAPS_ERROR_INVALID_PARAMETER");
+       MAPS_CHECK_CONDITION(coord->longitude >= -180 && coord->longitude <= 180, MAPS_ERROR_INVALID_PARAMETER,
+               "MAPS_ERROR_INVALID_PARAMETER");
+
+       return true;
+}
index a9dd48064b53e77338d4aa6bbba0b70f899f8f43..b46fe75a868eccbabeeba713174885919492959d 100755 (executable)
@@ -55,12 +55,17 @@ EXPORT_API int maps_item_list_destroy(maps_item_list_h list)
 EXPORT_API int maps_item_list_append(maps_item_list_h list, const void *data,
                                     maps_item_list_clone_cb clone_func)
 {
-       if (!list || !data || !clone_func)
+       if (!list || !data)
                return MAPS_ERROR_INVALID_PARAMETER;
        void *p = NULL;
-       const int error = clone_func((void *) data, &p);
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (clone_func) {
+               const int error = clone_func((void *) data, &p);
+               if (error != MAPS_ERROR_NONE)
+                       return error;
+       }
+       else {
+               p = (void*)data;
+       }
        maps_item_list_s *l = (maps_item_list_s *) list;
        l->l = g_list_append(l->l, (gpointer) p);
        return MAPS_ERROR_NONE;
@@ -69,9 +74,9 @@ EXPORT_API int maps_item_list_append(maps_item_list_h list, const void *data,
 EXPORT_API int maps_item_list_foreach(maps_item_list_h list,
                                      maps_item_list_clone_cb clone_func,
                                      maps_item_list_foreach_cb callback,
-       void *user_data)
+                                     void *user_data)
 {
-       if (!list || !clone_func || !callback)
+       if (!list || !callback)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_item_list_s *l = (maps_item_list_s *) list;
 
@@ -85,8 +90,13 @@ EXPORT_API int maps_item_list_foreach(maps_item_list_h list,
                void *data = head->data;
                head = head->next;
                void *clone = NULL;
-               if (clone_func(data, &clone) != MAPS_ERROR_NONE)
-                       continue;
+               if (clone_func) {
+                       if (clone_func(data, &clone) != MAPS_ERROR_NONE)
+                               continue;
+               }
+               else {
+                       clone = data;
+               }
                if (!callback(index++, total, clone, user_data))
                        break;
        }
@@ -94,6 +104,22 @@ EXPORT_API int maps_item_list_foreach(maps_item_list_h list,
        return MAPS_ERROR_NONE;
 }
 
+EXPORT_API int maps_item_list_remove(maps_item_list_h list,
+                                    void *item,
+                                    maps_item_list_free_cb free_func)
+{
+       if (!list)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       maps_item_list_s *l = (maps_item_list_s *) list;
+       if (l->l) {
+               l->l = g_list_remove(l->l, item);
+               if (free_func)
+                       free_func(item);
+       }
+       return MAPS_ERROR_NONE;
+}
+
 EXPORT_API int maps_item_list_foreach_noclone(maps_item_list_h list, maps_item_list_foreach_noclone_cb callback, void *user_data)
 {
        if (!list || !callback)
@@ -111,7 +137,6 @@ EXPORT_API int maps_item_list_foreach_noclone(maps_item_list_h list, maps_item_l
                if (!callback(index++, data, user_data))
                        break;
        }
-
        return MAPS_ERROR_NONE;
 }
 
@@ -144,7 +169,6 @@ EXPORT_API int maps_item_list_clone(const maps_item_list_h origin,
 
        int error = MAPS_ERROR_NONE;
        do {
-
                error = maps_item_list_create(cloned);
                if (!(*cloned) || (error != MAPS_ERROR_NONE))
                        break;
@@ -169,7 +193,6 @@ EXPORT_API int maps_item_list_clone(const maps_item_list_h origin,
                        head = head->next;
                }
                return MAPS_ERROR_NONE;
-
        } while (false);
 
        maps_item_list_destroy(*cloned);
@@ -266,7 +289,6 @@ EXPORT_API int maps_string_hashtable_foreach(maps_string_hashtable_h table,
        int index = 0;
        g_hash_table_iter_init(&iter, t->t);
        while (g_hash_table_iter_next(&iter, &key, &value)) {
-
                char *key_clone = NULL;
                if (maps_item_hashtable_clone_string(key,
                                (void **) &key_clone) != MAPS_ERROR_NONE)
@@ -279,7 +301,6 @@ EXPORT_API int maps_string_hashtable_foreach(maps_string_hashtable_h table,
                if (!callback(index++, total, key_clone, value_clone,
                                user_data))
                        break;
-
        }
        return MAPS_ERROR_NONE;
 }
@@ -292,7 +313,6 @@ EXPORT_API int maps_string_hashtable_clone(const maps_string_hashtable_h origin,
 
        int error = MAPS_ERROR_NONE;
        do {
-
                error = maps_string_hashtable_create(cloned);
                if (!(*cloned) || (error != MAPS_ERROR_NONE))
                        break;
@@ -315,7 +335,6 @@ EXPORT_API int maps_string_hashtable_clone(const maps_string_hashtable_h origin,
                }
 
                return MAPS_ERROR_NONE;
-
        } while (false);
 
        maps_string_hashtable_destroy(*cloned);
@@ -334,6 +353,168 @@ EXPORT_API int maps_string_hashtable_contains(maps_string_hashtable_h table,
        return MAPS_ERROR_NONE;
 }
 
+/*----------------------------------------------------------------------------*/
+typedef struct _maps_int_hashtable_s
+{
+       GHashTable *t;
+} maps_int_hashtable_s;
+
+EXPORT_API int maps_int_hashtable_create(maps_int_hashtable_h *table)
+{
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = g_slice_new0(maps_int_hashtable_s);
+
+       if (!t) {
+               MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
+               return MAPS_ERROR_OUT_OF_MEMORY;
+       }
+
+       t->t = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free);
+       *table = t;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_destroy(maps_int_hashtable_h table)
+{
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t)
+               g_hash_table_unref(t->t);
+       g_slice_free(maps_int_hashtable_s, t);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_set(maps_int_hashtable_h table,
+                                     const int key, const int value)
+{
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t) {
+               int *new_key = g_new0(int, 1);
+               *new_key = key;
+               int *new_value = g_new0(int, 1);
+               *new_value = value;
+               g_hash_table_insert(t->t,
+                                   (gpointer)new_key,
+                                   (gpointer)new_value);
+       }
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_get(maps_int_hashtable_h table,
+                                     const int key, int *value)
+{
+       if (!table || !value)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (!t->t)
+               return MAPS_ERROR_NOT_FOUND;
+       const int *table_value = (const int *) g_hash_table_lookup(t->t, &key);
+       if (!table_value)
+               return MAPS_ERROR_NONE;
+       *value = *table_value;
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_remove(maps_int_hashtable_h table,
+                                        const int key)
+{
+       if (!table)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t)
+               g_hash_table_remove(t->t, (gpointer) &key);
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_foreach(maps_int_hashtable_h table,
+                                         maps_int_hashtable_foreach_cb
+                                         callback,
+                                         void *user_data)
+{
+       if (!table || !callback)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+
+       if (!t->t)
+               return MAPS_ERROR_NOT_FOUND;
+
+       GHashTableIter iter;
+       gpointer key, value;
+       const int total = g_hash_table_size(t->t);
+       int index = 0;
+       g_hash_table_iter_init(&iter, t->t);
+       while (g_hash_table_iter_next(&iter, &key, &value)) {
+
+               if(!key || !value)
+                       continue;
+
+               int *key_ptr = (int *)key;
+               int *value_ptr = (int *)value;
+               if (!callback(index++, total, *key_ptr, *value_ptr, user_data))
+                       break;
+
+       }
+       return MAPS_ERROR_NONE;
+}
+
+EXPORT_API int maps_int_hashtable_clone(const maps_int_hashtable_h origin,
+                                       maps_int_hashtable_h *cloned)
+{
+       if (!cloned || !origin)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int error = MAPS_ERROR_NONE;
+       do {
+
+               error = maps_int_hashtable_create(cloned);
+               if (!(*cloned) || (error != MAPS_ERROR_NONE))
+                       break;
+
+               maps_int_hashtable_s *t = (maps_int_hashtable_s *) origin;
+
+               if (!t->t)
+                       return MAPS_ERROR_NONE;
+
+               maps_int_hashtable_s *t_cloned =
+                       (maps_int_hashtable_s *) (*cloned);
+
+               GHashTableIter iter;
+               gpointer key, value;
+               g_hash_table_iter_init(&iter, t->t);
+               while (g_hash_table_iter_next(&iter, &key, &value)) {
+                       int *new_key = g_new0(int, 1);
+                       *new_key = *((int *)key);
+                       int *new_value = g_new0(int, 1);
+                       *new_value = *((int *)value);
+                       g_hash_table_insert(t_cloned->t,
+                               (gpointer) new_key,
+                               (gpointer) new_value);
+               }
+
+               return MAPS_ERROR_NONE;
+
+       } while (false);
+
+       maps_int_hashtable_destroy(*cloned);
+       *cloned = NULL;
+       return error;
+}
+
+EXPORT_API int maps_int_hashtable_contains(maps_int_hashtable_h table,
+                                          const int key, bool *contains)
+{
+       if (!table || !contains)
+               return MAPS_ERROR_INVALID_PARAMETER;
+       maps_int_hashtable_s *t = (maps_int_hashtable_s *) table;
+       if (t->t)
+               *contains = g_hash_table_contains(t->t, (gpointer)&key);
+       return MAPS_ERROR_NONE;
+}
+
 /*----------------------------------------------------------------------------*/
 
 typedef struct _maps_hashtable_item_s
@@ -619,7 +800,6 @@ EXPORT_API int maps_item_hashtable_clone(const maps_item_hashtable_h origin,
 
        int error = MAPS_ERROR_NONE;
        do {
-
                error = maps_item_hashtable_create(cloned);
                if (!(*cloned) || (error != MAPS_ERROR_NONE))
                        break;
@@ -643,7 +823,6 @@ EXPORT_API int maps_item_hashtable_clone(const maps_item_hashtable_h origin,
                }
 
                return MAPS_ERROR_NONE;
-
        } while (false);
 
        maps_item_hashtable_destroy(*cloned);
index a554b993f7fd2dff0b7bc77d719490d4448271a4..d9068a67aa75df6a279b19400fc33b65f6702bfa 100755 (executable)
@@ -32,7 +32,6 @@ static bool __is_supported(const maps_place_h place, maps_service_data_e data)
 
 typedef struct _maps_place_s
 {
-
        char *id;
        char *name;
        char *uri;
@@ -84,8 +83,7 @@ typedef struct _maps_place_s
        maps_place_link_object_h related;
 
        /* The table of available data features */
-       maps_string_hashtable_h supported_data;
-       /* TODO: implement hashtable<int, int> */
+       maps_int_hashtable_h supported_data;
 
 } maps_place_s;
 
@@ -177,7 +175,7 @@ EXPORT_API int maps_place_destroy(maps_place_h place)
                maps_place_link_object_destroy(p->related);
 
        if (p->supported_data)
-               maps_item_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
 
        g_slice_free(maps_place_s, place);
        return MAPS_ERROR_NONE;
@@ -566,7 +564,8 @@ int _maps_place_is_data_supported(const maps_place_h place,
        if (!place || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       if (!((maps_place_s*) place)->supported_data) {
+       maps_place_s *p = (maps_place_s *)place;
+       if (!p->supported_data) {
                /* This is a case when the "supported" flags are not set yet */
                /* No need to limit access to fields */
                *supported = true;
@@ -574,43 +573,7 @@ int _maps_place_is_data_supported(const maps_place_h place,
        }
 
        *supported = false;
-       string data_feature;
-       switch (data) {
-       case MAPS_PLACE_ADDRESS:
-               data_feature = _S(MAPS_PLACE_ADDRESS);
-               break;
-       case MAPS_PLACE_RATING:
-               data_feature = _S(MAPS_PLACE_RATING);
-               break;
-       case MAPS_PLACE_CATEGORIES:
-               data_feature = _S(MAPS_PLACE_CATEGORIES);
-               break;
-       case MAPS_PLACE_ATTRIBUTES:
-               data_feature = _S(MAPS_PLACE_ATTRIBUTES);
-               break;
-       case MAPS_PLACE_CONTACTS:
-               data_feature = _S(MAPS_PLACE_CONTACTS);
-               break;
-       case MAPS_PLACE_EDITORIALS:
-               data_feature = _S(MAPS_PLACE_EDITORIALS);
-               break;
-       case MAPS_PLACE_REVIEWS:
-               data_feature = _S(MAPS_PLACE_REVIEWS);
-               break;
-       case MAPS_PLACE_IMAGE:
-               data_feature = _S(MAPS_PLACE_IMAGE);
-               break;
-       case MAPS_PLACE_SUPPLIER:
-               data_feature = _S(MAPS_PLACE_SUPPLIER);
-               break;
-       case MAPS_PLACE_RELATED:
-               data_feature = _S(MAPS_PLACE_RELATED);
-               break;
-       default:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       }
-       return maps_string_hashtable_contains(((maps_place_s *) place)->
-               supported_data, data_feature.c_str(), supported);
+       return maps_int_hashtable_contains(p->supported_data, data, supported);
 }
 
 /*----------------------------------------------------------------------------*/
@@ -805,14 +768,14 @@ EXPORT_API int maps_place_set_related_link(maps_place_h place,
 }
 
 int _maps_place_set_supported_data(maps_place_h place,
-                                  const maps_string_hashtable_h supported_data)
+                                  const maps_int_hashtable_h supported_data)
 {
        if (!place || !supported_data)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_place_s *p = (maps_place_s *) place;
        if (p->supported_data)
-               maps_string_hashtable_destroy(p->supported_data);
-       return maps_string_hashtable_clone(supported_data, &p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
+       return maps_int_hashtable_clone(supported_data, &p->supported_data);
 }
 
 EXPORT_API int maps_place_list_foreach(const maps_place_list_h place_list,
index afe5c8e4163daacd360cec161f4355264046221e..21443744aaa41b410ab655cf0463911de62921d8 100755 (executable)
@@ -74,8 +74,7 @@ int _maps_place_is_data_supported(const maps_place_h place,
  * @see maps_place_create()
  */
 int _maps_place_set_supported_data(maps_place_h place,
-                                  const maps_string_hashtable_h
-                                  supported_data);
+                                  const maps_int_hashtable_h supported_data);
 
 #ifdef __cplusplus
 }
index eeceaac98ba4c9b54930e296eef317577f7c42c6..afb14981d7bd6abfbc720d00d545cb8287b888c6 100755 (executable)
@@ -38,12 +38,6 @@ static bool __maps_route_set_supported_data_foreach_cb(int index, int total,
        return true;
 }
 
-static int __maps_route_set_supported_data_clone_cb(void *origin, void **cloned)
-{
-       *cloned = origin;       /* No clonning, please */
-       return MAPS_ERROR_NONE;
-}
-
 /*----------------------------------------------------------------------------*/
 
 /*
@@ -66,7 +60,7 @@ typedef struct _maps_route_s
        maps_item_hashtable_h properties;       /*< Key/Value> */
 
        /* The table of available data features */
-       maps_string_hashtable_h supported_data;
+       maps_int_hashtable_h supported_data;
        /* TODO: implement hashtable<int, int> */
 } maps_route_s;
 
@@ -118,7 +112,7 @@ EXPORT_API int maps_route_destroy(maps_route_h route)
        }
 
        if (p->supported_data)
-               maps_item_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
 
        g_slice_free(maps_route_s, route);
        return MAPS_ERROR_NONE;
@@ -349,7 +343,9 @@ int _maps_route_is_data_supported(const maps_route_h route,
        if (!route || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       if (!((maps_route_s *) route)->supported_data) {
+       maps_route_s *r = (maps_route_s *)route;
+
+       if (!r->supported_data) {
                /* This is a case when the "supported" flags are not set yet */
                /* No need to limit access to fields */
                *supported = true;
@@ -357,22 +353,7 @@ int _maps_route_is_data_supported(const maps_route_h route,
        }
 
        *supported = false;
-       string data_feature;
-       switch (data) {
-       case MAPS_ROUTE_PATH:
-               data_feature = _S(MAPS_ROUTE_PATH);
-               break;
-       case MAPS_ROUTE_SEGMENTS_PATH:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_PATH);
-               break;
-       case MAPS_ROUTE_SEGMENTS_MANEUVERS:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_MANEUVERS);
-               break;
-       default:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       }
-       return maps_string_hashtable_contains(((maps_route_s *) route)->
-               supported_data, data_feature.c_str(), supported);
+       return maps_int_hashtable_contains(r->supported_data, data, supported);
 }
 
 /*----------------------------------------------------------------------------*/
@@ -504,23 +485,20 @@ EXPORT_API int maps_route_set_distance_unit(maps_route_h route,
 }
 
 int _maps_route_set_supported_data(maps_route_h route,
-                                  const maps_string_hashtable_h supported_data)
+                                  const maps_int_hashtable_h supported_data)
 {
        if (!route || !supported_data)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_s *p = (maps_route_s *) route;
        if (p->supported_data)
-               maps_string_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
        int error =
-               maps_string_hashtable_clone(supported_data, &p->supported_data);
+               maps_int_hashtable_clone(supported_data, &p->supported_data);
        if (error != MAPS_ERROR_NONE)
                return error;
 
-       if (!p->segments)
-               return error;
-
-       return maps_item_list_foreach(p->segments,
-               __maps_route_set_supported_data_clone_cb,
-               __maps_route_set_supported_data_foreach_cb, supported_data);
-
+       if (p->segments)
+               error = maps_item_list_foreach(p->segments, NULL,
+                       __maps_route_set_supported_data_foreach_cb, supported_data);
+       return error;
 }
index 6bc2906d8eb39099992454234339abf976bdf2e9..065f38705a54ff27157e320797b5452d0f1b3e6b 100755 (executable)
 #include <maps_extra_types.h>
 
 /**
- * @ingroup    CAPI_MAPS_PLACE_MODULE
- * @defgroup   CAPI_MAPS_PLACE_DATA_MODULE Place
- *
  * @file maps_route_private.h
- * @brief This file contains the functions related to Place information.
+ * @brief This file contains the functions related to Route information.
  *
- * @addtogroup CAPI_MAPS_PLACE_DATA_MODULE
+ * @addtogroup CAPI_MAPS_ROUTE_DATA_MODULE
  * @{
  * @brief This provides APIs related to Place information, used in Place
  * Discovery and Search.
@@ -74,8 +71,7 @@ int _maps_route_is_data_supported(const maps_route_h route,
  * @see maps_route_create()
  */
 int _maps_route_set_supported_data(maps_route_h route,
-                                  const maps_string_hashtable_h
-                                  supported_data);
+                                  const maps_int_hashtable_h supported_data);
 
 #ifdef __cplusplus
 }
index 0a3c8fdb4944b1fabfab5ebfa15435bc54360b9b..4963538051656e8ca3d5915c13c2817a4e6628fc 100755 (executable)
@@ -44,8 +44,7 @@ typedef struct _maps_route_segment_s
                                          maps_route_maneuver_h */
 
        /* The table of available data features */
-       maps_string_hashtable_h supported_data;
-       /* TODO: implement hashtable<int, int> */
+       maps_int_hashtable_h supported_data;
 } maps_route_segment_s;
 
 /*----------------------------------------------------------------------------*/
@@ -88,7 +87,7 @@ EXPORT_API int maps_route_segment_destroy(maps_route_segment_h segment)
        }
 
        if (p->supported_data)
-               maps_item_hashtable_destroy(p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
 
        g_slice_free(maps_route_segment_s, segment);
        return MAPS_ERROR_NONE;
@@ -266,7 +265,8 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
        if (!segment || !supported)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       if (!((maps_route_segment_s *) segment)->supported_data) {
+       maps_route_segment_s *s = (maps_route_segment_s *)segment;
+       if (!s->supported_data) {
                /* This is a case when the "supported" flags are not set yet */
                /* No need to limit access to fields */
                *supported = true;
@@ -274,20 +274,7 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
        }
 
        *supported = false;
-       string data_feature;
-       switch (data) {
-       case MAPS_ROUTE_SEGMENTS_PATH:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_PATH);
-               break;
-       case MAPS_ROUTE_SEGMENTS_MANEUVERS:
-               data_feature = _S(MAPS_ROUTE_SEGMENTS_MANEUVERS);
-               break;
-       default:
-               return MAPS_ERROR_NOT_SUPPORTED;
-       }
-       return maps_string_hashtable_contains(((maps_route_segment_s *)
-                       segment)->supported_data, data_feature.c_str(),
-               supported);
+       return maps_int_hashtable_contains(s->supported_data, data, supported);
 }
 
 /*----------------------------------------------------------------------------*/
@@ -313,7 +300,6 @@ EXPORT_API int maps_route_segment_set_destination(maps_route_segment_h segment,
        if (p->destination)
                maps_coordinates_destroy(p->destination);
        return maps_coordinates_clone(destination, &p->destination);
-
 }
 
 EXPORT_API int maps_route_segment_set_bounding_box(maps_route_segment_h segment,
@@ -378,14 +364,13 @@ EXPORT_API int maps_route_segment_set_maneuvers(maps_route_segment_h segment,
 }
 
 int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
-                                          const maps_string_hashtable_h
+                                          const maps_int_hashtable_h
                                           supported_data)
 {
-
        if (!segment || !supported_data)
                return MAPS_ERROR_INVALID_PARAMETER;
        maps_route_segment_s *p = (maps_route_segment_s *) segment;
        if (p->supported_data)
-               maps_string_hashtable_destroy(p->supported_data);
-       return maps_string_hashtable_clone(supported_data, &p->supported_data);
+               maps_int_hashtable_destroy(p->supported_data);
+       return maps_int_hashtable_clone(supported_data, &p->supported_data);
 }
index 9e29b324233bd55d5b60e92fab2d3d9001fdf2fd..c7e580eac767d5d28282f459454b9d3e9c54d37f 100755 (executable)
@@ -75,8 +75,7 @@ int _maps_route_segment_is_data_supported(const maps_route_segment_h segment,
  * @see maps_route_segment_create()
  */
 int _maps_route_segment_set_supported_data(maps_route_segment_h segment,
-                                          const maps_string_hashtable_h
-                                          supported_data);
+                                          const maps_int_hashtable_h supported_data);
 
 #ifdef __cplusplus
 }
index 09a18aa920270e83bd667a16605e6ed6d5928b9a..dd94dad9c86f79b891bc60912033cf428223a20b 100755 (executable)
@@ -36,11 +36,6 @@ typedef struct _maps_service_s
 
 const gsize _MAPS_PROVIDER_KEY_MAX_LENGTH = 1024;
 
-static session::command_queue *q()
-{
-       return session::command_queue::interface();
-}
-
 /* This function is used in command class */
 plugin::plugin_s *__extract_plugin(maps_service_h maps)
 {
@@ -50,14 +45,13 @@ plugin::plugin_s *__extract_plugin(maps_service_h maps)
        return (plugin::plugin_s *) maps_service->plugin;
 }
 
-static bool __maps_provider_supported(maps_service_h maps,
-                                     maps_service_e service)
+static bool __maps_provider_supported(maps_service_h maps, maps_service_e service)
 {
        if (!maps)
                return false;
        bool supported = false;
-       if (maps_service_provider_is_service_supported(maps, service,
-                       &supported) != MAPS_ERROR_NONE)
+       if (maps_service_provider_is_service_supported(maps, service, &supported)
+               != MAPS_ERROR_NONE)
                return false;
        return supported;
 }
@@ -74,17 +68,15 @@ static bool __has_maps_service_privilege()
 /* */
 /* Maps Service & Preference */
 
-EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb
-                                            callback,
+EXPORT_API int maps_service_foreach_provider(maps_service_provider_info_cb callback,
                                             void *user_data)
 {
        if (!callback)
                return MAPS_ERROR_INVALID_PARAMETER;
 
-       /* The list of map provider info, obtained by enumerating available
-        *  plugins */
+       /* The list of map provider info, obtained by enumerating available plugins */
        plugin::discovery pd;
-       vector < plugin::provider_info > v = pd.get_available_list();
+       vector <plugin::provider_info> v = pd.get_available_list();
 
        /* Send obtained provider info to the user */
        const int total = int(v.size());
@@ -134,7 +126,6 @@ EXPORT_API int maps_service_create(const char *maps_provider, maps_service_h *ma
 
                /* 3. Initialize the requested plugin */
                int init_error = MAPS_ERROR_NONE; /* Storage for init error code */
-
                maps_plugin_h plugin_h = plugin::binary_extractor().init(info, &init_error);
                if (!plugin_h) {
                        error = init_error;
@@ -143,7 +134,6 @@ EXPORT_API int maps_service_create(const char *maps_provider, maps_service_h *ma
                }
 
                maps_service->plugin = plugin_h;
-               MAPS_LOGD("maps_service->plugin:(0x%08x)", maps_service->plugin);
 
                /* 4. Initialize an output pointer to maps service */
                *maps = maps_service;
@@ -170,10 +160,8 @@ EXPORT_API int maps_service_destroy(maps_service_h maps)
 
        maps_service_s *maps_service = (maps_service_s *) maps;
 
-       if (maps_service->plugin) {
-               MAPS_LOGD("maps_service->plugin:(0x%08x)", maps_service->plugin);
+       if (maps_service->plugin)
                plugin::binary_extractor().shutdown(maps_service->plugin);
-       }
 
        g_slice_free(maps_service_s, maps);
 
@@ -224,8 +212,7 @@ EXPORT_API int maps_service_get_preference(maps_service_h maps,
        return p->interface.maps_plugin_get_preference(preference);
 }
 
-EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h
-                                                         maps,
+EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h maps,
                                                        maps_service_e service,
                                                        bool *supported)
 {
@@ -237,12 +224,10 @@ EXPORT_API int maps_service_provider_is_service_supported(const maps_service_h
        const plugin::plugin_s *p = __extract_plugin(maps);
        if (!p)
                return MAPS_ERROR_NOT_SUPPORTED;
-       return p->interface.maps_plugin_is_service_supported(service,
-               supported);
+       return p->interface.maps_plugin_is_service_supported(service, supported);
 }
 
-EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h
-                                                      maps,
+EXPORT_API int maps_service_provider_is_data_supported(const maps_service_h maps,
                                                       maps_service_data_e data,
                                                       bool *supported)
 {
@@ -285,16 +270,20 @@ EXPORT_API int maps_service_geocode(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_geocode(maps, address, preference,
-                       callback, user_data, request_id));
+       session::command *cmd = new session::command_geocode(maps, address, preference,
+                       callback, user_data, request_id);
+
+       int ret = (cmd || cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
                                                const char *address,
                                                const maps_area_h bounds,
-                                       const maps_preference_h preference,
-                                       maps_service_geocode_cb callback,
-                                       void *user_data, int *request_id)
+                                               const maps_preference_h preference,
+                                               maps_service_geocode_cb callback,
+                                               void *user_data, int *request_id)
 {
        /* Check if the handle of the Maps Service is valid */
        if (!maps)
@@ -313,17 +302,16 @@ EXPORT_API int maps_service_geocode_inside_area(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_geocode_inside_bounds(maps,
-                       address, bounds, preference, callback, user_data,
-                       request_id));
+       session::command *cmd = new session::command_geocode_inside_bounds(maps,
+                       address, bounds, preference, callback, user_data, request_id);
+
+       int ret = (cmd || cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
-EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h
-                                                         maps,
-                                       const maps_address_h address,
-                                       const maps_preference_h preference,
-                                       maps_service_geocode_cb callback,
-                                       void *user_data, int *request_id)
+EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h maps, const maps_address_h address,
+       const maps_preference_h preference, maps_service_geocode_cb callback, void *user_data, int *request_id)
 {
        /* Check if the handle of the Maps Service is valid */
        if (!maps)
@@ -342,9 +330,12 @@ EXPORT_API int maps_service_geocode_by_structured_address(const maps_service_h
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->
-               push(new session::command_geocode_by_structured_address(maps,
-                       address, preference, callback, user_data, request_id));
+       session::command *cmd = new session::command_geocode_by_structured_address(maps,
+                       address, preference, callback, user_data, request_id);
+
+       int ret = (cmd || cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
@@ -374,9 +365,12 @@ EXPORT_API int maps_service_reverse_geocode(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_reverse_geocode(maps, latitude,
-                       longitude, preference, callback, user_data,
-                       request_id));
+       session::command *cmd = new session::command_reverse_geocode(maps, latitude,
+                       longitude, preference, callback, user_data, request_id);
+
+       int ret = (cmd || cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -407,9 +401,12 @@ EXPORT_API int maps_service_search_place(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_search_place(maps, position,
-                       distance, preference, filter, callback, user_data,
-                       request_id));
+       session::command *cmd = new session::command_search_place(maps, position,
+                       distance, preference, filter, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
@@ -437,9 +434,12 @@ EXPORT_API int maps_service_search_place_by_area(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_search_by_area_place(maps,
-                       boundary, preference, filter, callback, user_data,
-                       request_id));
+       session::command *cmd = new session::command_search_by_area_place(maps,
+                       boundary, preference, filter, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
@@ -468,9 +468,12 @@ EXPORT_API int maps_service_search_place_by_address(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_search_by_address_place(maps,
-                       address, boundary, preference, filter, callback,
-                       user_data, request_id));
+       session::command *cmd = new session::command_search_by_address_place(maps,
+                       address, boundary, preference, filter, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_search_place_list(const maps_service_h maps,
@@ -492,13 +495,17 @@ EXPORT_API int maps_service_search_place_list(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_search_place_list(maps,
-                       boundary, preference, filter, callback, user_data, request_id));
+       session::command *cmd = new session::command_search_place_list(maps,
+                       boundary, preference, filter, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_get_place_details(const maps_service_h maps,
-                       const char *url, maps_service_get_place_details_cb callback,
-                       void *user_data, int *request_id)
+       const char *url, maps_service_get_place_details_cb callback,
+       void *user_data, int *request_id)
 {
        if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
@@ -512,8 +519,12 @@ EXPORT_API int maps_service_get_place_details(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_get_place_details(maps,
-                       url, callback, user_data, request_id));
+       session::command *cmd = new session::command_get_place_details(maps,
+                       url, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -543,8 +554,12 @@ EXPORT_API int maps_service_search_route(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_search_route(maps, preference,
-                       origin, destination, callback, user_data, request_id));
+       session::command *cmd = new session::command_search_route(maps, preference,
+                       origin, destination, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
@@ -572,17 +587,19 @@ EXPORT_API int maps_service_search_route_waypoints(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_search_route_waypoints(maps,
-                       preference, waypoint_list, waypoint_num, callback,
-                       user_data, request_id));
+       session::command *cmd = new session::command_search_route_waypoints(maps,
+                       preference, waypoint_list, waypoint_num, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 /*----------------------------------------------------------------------------*/
 /* */
 /* Cancel Service Request */
 
-EXPORT_API int maps_service_cancel_request(const maps_service_h maps,
-                                          int request_id)
+EXPORT_API int maps_service_cancel_request(const maps_service_h maps, int request_id)
 {
        /* Check if the handle of the Maps Service is valid */
        if (!maps)
@@ -600,7 +617,11 @@ EXPORT_API int maps_service_cancel_request(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_cancel_request(maps, request_id));
+       session::command *cmd = new session::command_cancel_request(maps, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -608,8 +629,8 @@ EXPORT_API int maps_service_cancel_request(const maps_service_h maps,
 /* Multi geocoder */
 
 EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
-                               const maps_coordinates_list_h coordinates_list, const maps_preference_h preference,
-                               maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
+       const maps_coordinates_list_h coordinates_list, const maps_preference_h preference,
+       maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
 {
        if (!maps)
                return MAPS_ERROR_INVALID_PARAMETER;
@@ -623,7 +644,11 @@ EXPORT_API int maps_service_multi_reverse_geocode(const maps_service_h maps,
        if (!__has_maps_service_privilege())
                return MAPS_ERROR_PERMISSION_DENIED;
 
-       return q()->push(new session::command_multi_reverse_geocode(maps,
-                       coordinates_list, preference, callback, user_data, request_id));
+       session::command *cmd = new session::command_multi_reverse_geocode(maps,
+                       coordinates_list, preference, callback, user_data, request_id);
+
+       int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
+       if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
+       return ret;
 }
 
index 5db405348519d5ddce8158e99a01153e7f8244d4..7ee5ed9045c8157f4a6ac7a44ff9b2b08a007fec 100755 (executable)
@@ -139,6 +139,10 @@ public:
        {
                return current_size;
        }
+       bool empty() const
+       {
+               return size() == 0;
+       }
 };
 
 class string
index 3fe1446d27c609b2416abb088cad7267dec74ce2..2313f3d3eebd92c53bd4f71095875a26564dbfbe 100755 (executable)
@@ -57,14 +57,12 @@ 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)
+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)
+int maps_plugin_is_data_supported_empty(maps_service_data_e data, bool *supported)
 {
        return 0;
 }
index 0c8cc91663a26a4fd6313c33b626bdbe1ee6a636..d4ebd16a406ea4b351d72a1c4a57d17763304824 100755 (executable)
@@ -316,7 +316,7 @@ void plugin::binary_extractor::shutdown(maps_plugin_h plugin_h)
        gmod_free((GMod *) plugin->module);
 
        /* 5. Destroying the table with plugin capabilities */
-       /*maps_string_hashtable_destroy(plugin->capabilities); */
+       /*maps_int_hashtable_destroy(plugin->capabilities); */
 
        /* 6. Release memory used by plugin structure */
        g_slice_free(plugin_s, plugin);
@@ -432,8 +432,7 @@ void plugin::binary_extractor::trace_dbg(const plugin_s *plugin) const
                MAPS_LOGD("PLUGIN request queue is NULL");
        }
        else {
-               MAPS_LOGD("plugin request queue:\t\t\t%p",
-                       plugin->request_queue);
+               MAPS_LOGD("plugin request queue:\t\t\t%p", plugin->request_queue);
        }
 
        const interface_s *itf = &plugin->interface;
index 81559bc1f22890bded9f2a379a28bdd4b0c68eb7..97f3a421c4220292f828c2a96e94e86404fb1916 100644 (file)
@@ -35,94 +35,73 @@ typedef int (*maps_plugin_set_provider_key_f) (const char *provider_key);
 typedef int (*maps_plugin_get_provider_key_f) (char **provider_key);
 typedef int (*maps_plugin_set_preference_f) (maps_preference_h preference);
 typedef int (*maps_plugin_get_preference_f) (maps_preference_h *preference);
-typedef int (*maps_plugin_is_service_supported_f) (maps_service_e service,
-                                                  bool *supported);
-typedef int (*maps_plugin_is_data_supported_f) (maps_service_data_e data,
-                                               bool *supported);
+typedef int (*maps_plugin_is_service_supported_f) (maps_service_e service, bool *supported);
+typedef int (*maps_plugin_is_data_supported_f) (maps_service_data_e data, bool *supported);
 
 /* Geocode */
 typedef int (*maps_plugin_geocode_f) (const char *address,
-                                     const maps_preference_h preference,
-                                     maps_service_geocode_cb callback,
-                                     void *user_data, int *request_id);
+                                               const maps_preference_h preference,
+                                               maps_service_geocode_cb callback,
+                                               void *user_data, int *request_id);
 typedef int (*maps_plugin_geocode_inside_area_f) (const char *address,
-                                                 const maps_area_h bounds,
-                                                 const maps_preference_h
-                                                 preference,
-                                                 maps_service_geocode_cb
-                                                 callback,
-                                                 void *user_data,
-                                                 int *request_id);
-typedef int (*maps_plugin_geocode_by_structured_address_f) (const maps_address_h
-                                                           address,
-                                                           const
-                                                           maps_preference_h
-                                                           preference,
-                                                       maps_service_geocode_cb
-                                                       callback,
-                                                       void *user_data,
-                                                       int *request_id);
+                                               const maps_area_h bounds,
+                                               const maps_preference_h preference,
+                                               maps_service_geocode_cb callback,
+                                               void *user_data,
+                                               int *request_id);
+typedef int (*maps_plugin_geocode_by_structured_address_f) (const maps_address_h address,
+                                               const maps_preference_h preference,
+                                               maps_service_geocode_cb callback,
+                                               void *user_data,
+                                               int *request_id);
 typedef int (*maps_plugin_reverse_geocode_f) (double latitude, double longitude,
-                                             const maps_preference_h
-                                             preference,
-                                             maps_service_reverse_geocode_cb
-                                             callback,
-                                             void *user_data, int *request_id);
+                                               const maps_preference_h preference,
+                                               maps_service_reverse_geocode_cb callback,
+                                               void *user_data, int *request_id);
 typedef int (*maps_plugin_multi_reverse_geocode_f) (const maps_coordinates_list_h maps_list,
-                                                       const maps_preference_h preference,
-                                                       maps_service_multi_reverse_geocode_cb callback,
-                                                       void *user_data, int *request_id);
+                                               const maps_preference_h preference,
+                                               maps_service_multi_reverse_geocode_cb callback,
+                                               void *user_data, int *request_id);
 
 /* Place */
 typedef int (*maps_plugin_search_place_f) (const maps_coordinates_h position,
-                                          int distance,
-                                          const maps_place_filter_h filter,
-                                          maps_preference_h preference,
-                                          maps_service_search_place_cb
-                                          callback,
-                                          void *user_data, int *request_id);
+                                               int distance,
+                                               const maps_place_filter_h filter,
+                                               maps_preference_h preference,
+                                               maps_service_search_place_cb callback,
+                                               void *user_data, int *request_id);
 typedef int (*maps_plugin_search_place_by_area_f) (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);
+                                               const maps_place_filter_h filter,
+                                               maps_preference_h preference,
+                                               maps_service_search_place_cb callback,
+                                               void *user_data,
+                                               int *request_id);
 typedef int (*maps_plugin_search_place_by_address_f) (const char *address,
-                                                     const maps_area_h
-                                                     boundary,
-                                                     const maps_place_filter_h
-                                                     filter,
-                                                     maps_preference_h
-                                                     preference,
-                                               maps_service_search_place_cb
-                                               callback,
+                                               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);
 typedef int (*maps_plugin_search_place_list_f) (const maps_area_h boundary,
-                                          const maps_place_filter_h filter,
-                                          maps_preference_h preference,
-                                          maps_service_search_place_list_cb callback,
-                                          void *user_data, int *request_id);
+                                               const maps_place_filter_h filter,
+                                               maps_preference_h preference,
+                                               maps_service_search_place_list_cb callback,
+                                               void *user_data, int *request_id);
 typedef int (*maps_plugin_get_place_details_f) (const char *url,
                                                maps_service_get_place_details_cb callback,
                                                void *user_data, int *request_id);
 
 /* Route */
 typedef int (*maps_plugin_search_route_f) (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);
-typedef int (*maps_plugin_search_route_waypoints_f) (const maps_coordinates_h *
-                                                    waypoint_list,
-                                                    int waypoint_num,
-                                                    maps_preference_h
-                                                    preference,
-                                               maps_service_search_route_cb
-                                               callback,
+                                               const maps_coordinates_h destination,
+                                               maps_preference_h preference,
+                                               maps_service_search_route_cb callback,
+                                               void *user_data, int *request_id);
+typedef int (*maps_plugin_search_route_waypoints_f) (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);
 
@@ -132,111 +111,96 @@ typedef int (*maps_plugin_cancel_request_f) (int request_id);
 
 namespace plugin {
 
-       /* Plugin interface */
-       typedef struct _interface_s {
-
-               /* Plugin dedicated functions */
-               maps_plugin_init_f maps_plugin_init;
-               maps_plugin_shutdown_f maps_plugin_shutdown;
-               maps_plugin_get_info_f maps_plugin_get_info;
-
-               /* Maps Provider access key, preference and capabilities */
-               maps_plugin_set_provider_key_f maps_plugin_set_provider_key;
-               maps_plugin_get_provider_key_f maps_plugin_get_provider_key;
-               maps_plugin_set_preference_f maps_plugin_set_preference;
-               maps_plugin_get_preference_f maps_plugin_get_preference;
-               maps_plugin_is_service_supported_f
-                       maps_plugin_is_service_supported;
-               maps_plugin_is_data_supported_f maps_plugin_is_data_supported;
-
-               /* Geocode */
-               maps_plugin_geocode_f maps_plugin_geocode;
-               maps_plugin_geocode_inside_area_f
-                       maps_plugin_geocode_inside_area;
-                maps_plugin_geocode_by_structured_address_f
-                       maps_plugin_geocode_by_structured_address;
-               maps_plugin_reverse_geocode_f maps_plugin_reverse_geocode;
-               maps_plugin_multi_reverse_geocode_f maps_plugin_multi_reverse_geocode;
-
-               /* Place */
-               maps_plugin_search_place_f maps_plugin_search_place;
-               maps_plugin_search_place_by_area_f
-                       maps_plugin_search_place_by_area;
-               maps_plugin_search_place_by_address_f
-                       maps_plugin_search_place_by_address;
-               maps_plugin_search_place_list_f maps_plugin_search_place_list;
-               maps_plugin_get_place_details_f maps_plugin_get_place_details;
-
-               /* Route */
-               maps_plugin_search_route_f maps_plugin_search_route;
-               maps_plugin_search_route_waypoints_f
-                       maps_plugin_search_route_waypoints;
-
-               /* Cancel Request */
-               maps_plugin_cancel_request_f maps_plugin_cancel_request;
-
-       } interface_s;
-
-       /* Plugin structure */
-       typedef struct _plugin_s {
-               interface_s interface;  /* Plugin interface function pointers */
-               gpointer module;        /* Plugin module pointer, GMod */
-               GAsyncQueue *request_queue;     /* Queue of asynchronous requests */
-               GThread *thread;        /* Request queue thread: there is
-                                          happening delivery of request from
-                                          app to plugin */
-
-               /* Flag: is the plugin in use */
-               volatile bool is_working;       /* It is discouraged to use this
-                                                  approach; */
-               /* probably, it must be exchanged with event dispite of
-               *  performance trade-off */
-
-               /*maps_string_hashtable_h capabilities; // The table of plugin
-               * capabilities */
-
-               GMutex pending_request_mutex;   /* Mutex for synchronizing the
-                                                  map of pending requests */
-               GHashTable *pending_request_maps;       /* Map of pending
-                                                          requests */
-       } plugin_s;
-
-       /* TODO: Refactor to encapsulate everithing in a single calss
-       *  plugin::module */
-       typedef struct _GMod {
-               gchar *name;
-               gchar *path;
-               GModule *module;
-       } GMod;
-
-       /* RAII Class implementing the mutex helper on the base of GLib mutex */
-       /* which automatically locks mutex during its creation and unlocks while
-       *  exiting the scope */
-       class scope_mutex {
-               GMutex *mutex;
-       public:
-                scope_mutex(GMutex *m);
-               ~scope_mutex();
-       };
-
-       class binary_extractor {
-       public:
-               binary_extractor();
-               virtual ~binary_extractor()
-               {
-               }
-       public:
-               provider_info get_plugin_info(const string &file_name) const;
-               maps_plugin_h init(const provider_info &info, int *init_error);
-               void shutdown(maps_plugin_h plugin_h);
-       private:
-                GMod *gmod_new(const string &module_file,
-                               gboolean is_resident) const;
-               void gmod_free(GMod *gmod) const;
-               gpointer gmod_find_sym(GMod *gmod,
-                                      const gchar *func_name) const;
-               void trace_dbg(const plugin_s *plugin) const;
-       };
+/* Plugin interface */
+typedef struct _interface_s {
+
+       /* Plugin dedicated functions */
+       maps_plugin_init_f maps_plugin_init;
+       maps_plugin_shutdown_f maps_plugin_shutdown;
+       maps_plugin_get_info_f maps_plugin_get_info;
+
+       /* Maps Provider access key, preference and capabilities */
+       maps_plugin_set_provider_key_f maps_plugin_set_provider_key;
+       maps_plugin_get_provider_key_f maps_plugin_get_provider_key;
+       maps_plugin_set_preference_f maps_plugin_set_preference;
+       maps_plugin_get_preference_f maps_plugin_get_preference;
+       maps_plugin_is_service_supported_f maps_plugin_is_service_supported;
+       maps_plugin_is_data_supported_f maps_plugin_is_data_supported;
+
+       /* Geocode */
+       maps_plugin_geocode_f maps_plugin_geocode;
+       maps_plugin_geocode_inside_area_f maps_plugin_geocode_inside_area;
+        maps_plugin_geocode_by_structured_address_f maps_plugin_geocode_by_structured_address;
+       maps_plugin_reverse_geocode_f maps_plugin_reverse_geocode;
+       maps_plugin_multi_reverse_geocode_f maps_plugin_multi_reverse_geocode;
+
+       /* Place */
+       maps_plugin_search_place_f maps_plugin_search_place;
+       maps_plugin_search_place_by_area_f maps_plugin_search_place_by_area;
+       maps_plugin_search_place_by_address_f maps_plugin_search_place_by_address;
+       maps_plugin_search_place_list_f maps_plugin_search_place_list;
+       maps_plugin_get_place_details_f maps_plugin_get_place_details;
+
+       /* Route */
+       maps_plugin_search_route_f maps_plugin_search_route;
+       maps_plugin_search_route_waypoints_f maps_plugin_search_route_waypoints;
+
+       /* Cancel Request */
+       maps_plugin_cancel_request_f maps_plugin_cancel_request;
+
+} interface_s;
+
+/* Plugin structure */
+typedef struct _plugin_s {
+       interface_s interface;  /* Plugin interface function pointers */
+       gpointer module;        /* Plugin module pointer, GMod */
+       GAsyncQueue *request_queue;     /* Queue of asynchronous requests */
+       GThread *thread;        /* Request queue thread: there is
+                                  happening delivery of request from app to plugin */
+
+       /* Flag: is the plugin in use */
+       volatile bool is_working;       /* It is discouraged to use this approach */
+       /* probably, it must be exchanged with event dispite of  performance trade-off */
+
+       /*maps_int_hashtable_h capabilities; */ /* The table of plugin capabilities */
+
+       GMutex pending_request_mutex;   /* Mutex for synchronizing the
+                                          map of pending requests */
+       GHashTable *pending_request_maps;       /* Map of pending requests */
+} plugin_s;
+
+/* TODO: Refactor to encapsulate everything in a single calss
+*  plugin::module */
+typedef struct _GMod {
+       gchar *name;
+       gchar *path;
+       GModule *module;
+} GMod;
+
+/* RAII Class implementing the mutex helper on the base of GLib mutex */
+/* which automatically locks mutex during its creation and unlocks while
+*  exiting the scope */
+class scope_mutex {
+       GMutex *mutex;
+public:
+        scope_mutex(GMutex *m);
+       ~scope_mutex();
+};
+
+class binary_extractor {
+public:
+       binary_extractor();
+       virtual ~binary_extractor() {}
+public:
+       provider_info get_plugin_info(const string &file_name) const;
+       maps_plugin_h init(const provider_info &info, int *init_error);
+       void shutdown(maps_plugin_h plugin_h);
+private:
+       GMod *gmod_new(const string &module_file, gboolean is_resident) const;
+       void gmod_free(GMod *gmod) const;
+       gpointer gmod_find_sym(GMod *gmod, const gchar *func_name) const;
+       void trace_dbg(const plugin_s *plugin) const;
+};
 };
 
 #endif                         /* __MAPS_SERVICE_PLUGIN_MODULE_H__ */
index 0a95858b0ac3c9f05b5f4be085a7c08f047edda3..9643005fc74a292babd1205c31aca7fd45f95a88 100755 (executable)
 #include "maps_route_private.h"
 #include "empty_module.h"
 
+extern bool maps_address_is_valid(const maps_address_h address);
+extern bool maps_area_is_valid(const maps_area_h area);
+extern bool maps_coordinates_is_valid(const maps_coordinates_h coordinates);
+
 static int __put_to_hashtable(session::command_handler *ch,
                              maps_service_data_e feature,
-                             const char *feature_str,
-                             maps_string_hashtable_h t)
+                             maps_int_hashtable_h t)
 {
-       if (!ch || !feature_str || !t)
+       if (!ch || !t)
                return MAPS_ERROR_INVALID_PARAMETER;
        bool supported = false;
-       ch->plugin()->interface.maps_plugin_is_data_supported(feature,
-               &supported);
-       return (supported) ? maps_string_hashtable_set(t, feature_str,
-               feature_str) : MAPS_ERROR_NONE;
+       ch->plugin()->interface.maps_plugin_is_data_supported(feature, &supported);
+       if(supported)
+               return  maps_int_hashtable_set(t, feature, feature);
+       return MAPS_ERROR_NONE;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -43,29 +46,22 @@ session::command_geocode::command_geocode(maps_service_h ms, const string a,
                                          void *ud, int *request_id)
  : command(ms)
  , address(a)
- , preference(NULL)
+ , preference(pref)
  , callback(cb)
  , user_data(ud)
  , error(0)
 {
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
-
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
 }
 
 session::command_geocode::~command_geocode()
 {
-       maps_item_hashtable_destroy(preference);
 }
 
 int session::command_geocode::run()
 {
-
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -125,25 +121,21 @@ bool session::command_geocode_handler::foreach_geocode_cb(maps_error_e error,
                                                          void *user_data)
 {
 
-       command_geocode_handler *handler =
-               (command_geocode_handler *) user_data;
+       command_geocode_handler *handler = (command_geocode_handler *) user_data;
 
        if (request_id != handler->plg_req_id) {
-               MAPS_LOGE(
-"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+               MAPS_LOGE("\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n",
                        request_id, handler->plg_req_id);
        }
 
        /* Make a user's copy of result data */
        maps_coordinates_h cloned_result = NULL;
        if (error == MAPS_ERROR_NONE)
-               error = (maps_error_e) maps_coordinates_clone(coordinates,
-                       &cloned_result);
+               error = (maps_error_e) maps_coordinates_clone(coordinates, &cloned_result);
        maps_coordinates_destroy(coordinates);
 
        /* Send data to user */
-       const bool b =
-               handler->callback(error, handler->user_req_id, index,
+       const bool b = handler->callback(error, handler->user_req_id, index,
                total_count, cloned_result, handler->user_data);
        if (!b || (index >= (total_count - 1))) {
                pending_request pr(handler->plugin());
@@ -167,7 +159,7 @@ session::command_geocode_inside_bounds::command_geocode_inside_bounds(
  : command(ms)
  , address(a)
  , bounds(NULL)
- , preference(NULL)
+ , preference(pref)
  , callback(cb)
  , user_data(ud)
  , error(0)
@@ -175,24 +167,23 @@ session::command_geocode_inside_bounds::command_geocode_inside_bounds(
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (maps_area_clone(b, &bounds) != MAPS_ERROR_NONE)
+       if (maps_area_is_valid(b)) {
+               bounds = b;
+       }
+       else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+               *request_id = -1;
+       }
 
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
 }
 
 session::command_geocode_inside_bounds::~command_geocode_inside_bounds()
 {
-       maps_area_destroy(bounds);
-       maps_item_hashtable_destroy(preference);
 }
 
 int session::command_geocode_inside_bounds::run()
 {
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -249,7 +240,7 @@ session::command_geocode_by_structured_address::
                                              void *ud, int *request_id)
  : command(ms)
  , address(NULL)
- , preference(NULL)
+ , preference(pref)
  , callback(cb)
  , user_data(ud)
  , error(0)
@@ -257,25 +248,25 @@ session::command_geocode_by_structured_address::
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (maps_address_clone(a, &address) != MAPS_ERROR_NONE)
+       if (maps_address_is_valid(a)) {
+               address = a;
+       }
+       else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+               *request_id = -1;
+               MAPS_LOGD("Invalid parameter");
+       }
 
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
 }
 
 session::command_geocode_by_structured_address::
        ~command_geocode_by_structured_address()
 {
-       maps_address_destroy(address);
-       maps_item_hashtable_destroy(preference);
 }
 
 int session::command_geocode_by_structured_address::run()
 {
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -330,7 +321,7 @@ session::command_reverse_geocode::command_reverse_geocode(maps_service_h ms,
  : command(ms)
  , latitude(lat)
  , longitude(lon)
- , preference(NULL)
+ , preference(pref)
  , callback(cb)
  , user_data(ud)
  , error(0)
@@ -338,27 +329,20 @@ session::command_reverse_geocode::command_reverse_geocode(maps_service_h ms,
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
 }
 
 session::command_reverse_geocode::~command_reverse_geocode()
 {
-       maps_item_hashtable_destroy(preference);
 }
 
 int session::command_reverse_geocode::run()
 {
-
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
        /* Get the plugin interface function */
-       maps_plugin_reverse_geocode_f func =
-               interface()->maps_plugin_reverse_geocode;
+       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 */
@@ -372,7 +356,7 @@ int session::command_reverse_geocode::run()
                        /* Run the plugin interface function */
                        error = func(latitude, longitude, preference,
                                                command_reverse_geocode_handler::foreach_reverse_geocode_cb,
-                                       handler, &handler->plg_req_id);
+                                               handler, &handler->plg_req_id);
 
                        pr.update(my_req_id, handler);
 
@@ -458,24 +442,20 @@ session::command_multi_reverse_geocode::command_multi_reverse_geocode(
 
        int list_size = 0;
        maps_coordinates_list_get_length(list, &list_size);
-       if (list_size < 2 || list_size > 100)
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (pref && (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
+       if (list_size < 2 || list_size > 100) {
                error = MAPS_ERROR_INVALID_PARAMETER;
-
+               *request_id = -1;
+       }
        maps_list = list;
 }
 
 session::command_multi_reverse_geocode::~command_multi_reverse_geocode()
 {
-       maps_item_hashtable_destroy(preference);
 }
 
 int session::command_multi_reverse_geocode::run()
 {
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -565,8 +545,8 @@ session::command_search_place::command_search_place(maps_service_h ms,
  : command(ms)
  , position(NULL)
  , distance(dst)
- , preference(NULL)
- , filter(NULL)
+ , preference(pref)
+ , filter(flt)
  , callback(cb)
  , user_data(ud)
  , error(MAPS_ERROR_NONE)
@@ -574,29 +554,23 @@ session::command_search_place::command_search_place(maps_service_h ms,
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (maps_coordinates_clone(pos, &position) != MAPS_ERROR_NONE)
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+       if (maps_coordinates_is_valid(pos)) {
+               position = pos;
+       }
+       else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+               *request_id = -1;
+               MAPS_LOGD("Invalid parameter");
+       }
 }
 
 session::command_search_place::~command_search_place()
 {
-       maps_coordinates_destroy(position);
-       maps_item_hashtable_destroy(preference);
-       maps_place_filter_destroy(filter);
 }
 
 int session::command_search_place::run()
 {
-
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -647,39 +621,26 @@ session::command_search_place_handler::command_search_place_handler(
 {
 }
 
-void session::command_search_place_handler::set_supported_data(maps_place_h
-                                                              place)
+void session::command_search_place_handler::set_supported_data(maps_place_h place)
 {
-       if (!place || !plugin())
-               return;
-
-       maps_string_hashtable_h data_supported = NULL;
-       if (maps_string_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
-               return;
-
-       __put_to_hashtable(this, MAPS_PLACE_ADDRESS, _S(MAPS_PLACE_ADDRESS),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_RATING, _S(MAPS_PLACE_RATING),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_CATEGORIES,
-               _S(MAPS_PLACE_CATEGORIES), data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_ATTRIBUTES,
-               _S(MAPS_PLACE_ATTRIBUTES), data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_CONTACTS, _S(MAPS_PLACE_CONTACTS),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_EDITORIALS,
-               _S(MAPS_PLACE_EDITORIALS), data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_REVIEWS, _S(MAPS_PLACE_REVIEWS),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_IMAGE, _S(MAPS_PLACE_IMAGE),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_SUPPLIER, _S(MAPS_PLACE_SUPPLIER),
-               data_supported);
-       __put_to_hashtable(this, MAPS_PLACE_RELATED, _S(MAPS_PLACE_RELATED),
-               data_supported);
+       if (!place || !plugin()) return;
+
+       maps_int_hashtable_h data_supported = NULL;
+       if (maps_int_hashtable_create(&data_supported) != MAPS_ERROR_NONE) return;
+
+       __put_to_hashtable(this, MAPS_PLACE_ADDRESS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_RATING, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_CATEGORIES, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_ATTRIBUTES, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_CONTACTS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_EDITORIALS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_REVIEWS, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_IMAGE, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_SUPPLIER, data_supported);
+       __put_to_hashtable(this, MAPS_PLACE_RELATED, data_supported);
 
        _maps_place_set_supported_data(place, data_supported);
-       maps_string_hashtable_destroy(data_supported);
+       maps_int_hashtable_destroy(data_supported);
 }
 
 bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
@@ -694,8 +655,7 @@ bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
                (command_search_place_handler *) user_data;
 
        if (request_id != handler->plg_req_id) {
-               MAPS_LOGE(
-"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+               MAPS_LOGE("\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n",
                        request_id, handler->plg_req_id);
        }
 
@@ -710,8 +670,7 @@ bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
                handler->set_supported_data(cloned_result);
 
        /* Send data to user */
-       const bool b =
-               handler->callback(error, handler->user_req_id, index, length,
+       const bool b = handler->callback(error, handler->user_req_id, index, length,
                cloned_result, handler->user_data);
        if (!b || (index >= (length - 1))) {
                pending_request pr(handler->plugin());
@@ -734,8 +693,8 @@ session::command_search_by_area_place::command_search_by_area_place(
                                        void *ud, int *request_id)
  : command(ms)
  , boundary(NULL)
- , preference(NULL)
- , filter(NULL)
+ , preference(pref)
+ , filter(flt)
  , callback(cb)
  , user_data(ud)
  , error(MAPS_ERROR_NONE)
@@ -743,29 +702,22 @@ session::command_search_by_area_place::command_search_by_area_place(
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (maps_area_clone(b, &boundary) != MAPS_ERROR_NONE)
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+       if (maps_area_is_valid(b)) {
+               boundary = b;
+       }
+       else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+               *request_id = -1;
+       }
 }
 
 session::command_search_by_area_place::~command_search_by_area_place()
 {
-       maps_area_destroy(boundary);
-       maps_item_hashtable_destroy(preference);
-       maps_place_filter_destroy(filter);
 }
 
 int session::command_search_by_area_place::run()
 {
-
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -826,8 +778,8 @@ session::command_search_by_address_place::command_search_by_address_place(
  : command(ms)
  , address(a)
  , boundary(NULL)
- , preference(NULL)
- , filter(NULL)
+ , preference(pref)
+ , filter(flt)
  , callback(cb)
  , user_data(ud)
  , error(MAPS_ERROR_NONE)
@@ -835,22 +787,17 @@ session::command_search_by_address_place::command_search_by_address_place(
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (maps_area_clone(b, &boundary) != MAPS_ERROR_NONE)
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+       if (maps_area_is_valid(b)) {
+               boundary = b;
+       } else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+               *request_id = -1;
+               MAPS_LOGD("Invalid parameter");
+       }
 }
 
 session::command_search_by_address_place::~command_search_by_address_place()
 {
-       maps_area_destroy(boundary);
-       maps_item_hashtable_destroy(preference);
-       maps_place_filter_destroy(filter);
 }
 
 int session::command_search_by_address_place::run()
@@ -879,9 +826,7 @@ int session::command_search_by_address_place::run()
 
                        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);
                }
                else {
                        error = MAPS_ERROR_OUT_OF_MEMORY;
@@ -914,8 +859,8 @@ session::command_search_place_list::command_search_place_list(maps_service_h ms,
                                        void *ud, int *request_id)
  : command(ms)
  , boundary(NULL)
- , preference(NULL)
- , filter(NULL)
+ , preference(pref)
+ , filter(flt)
  , callback(cb)
  , user_data(ud)
  , error(MAPS_ERROR_NONE)
@@ -923,21 +868,17 @@ session::command_search_place_list::command_search_place_list(maps_service_h ms,
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (maps_area_clone(b, &boundary) != MAPS_ERROR_NONE)
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (pref && (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (maps_place_filter_clone(flt, &filter) != MAPS_ERROR_NONE)
+       if (maps_area_is_valid(b)) {
+               boundary = b;
+       } else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+               *request_id = -1;
+               MAPS_LOGD("Invalid parameter");
+       }
 }
 
 session::command_search_place_list::~command_search_place_list()
 {
-       maps_area_destroy(boundary);
-       maps_item_hashtable_destroy(preference);
-       maps_place_filter_destroy(filter);
 }
 
 int session::command_search_place_list::run()
@@ -1137,30 +1078,33 @@ session::command_search_route::command_search_route(maps_service_h ms,
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
-       if (maps_coordinates_clone(orig, &origin) != MAPS_ERROR_NONE)
+       if (maps_coordinates_is_valid(orig)) {
+               origin = orig;
+       }
+       else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+       }
 
-       if (maps_coordinates_clone(dest, &destination) != MAPS_ERROR_NONE)
+       if (maps_coordinates_is_valid(dest)) {
+               destination = dest;
+       }
+       else {
                error = MAPS_ERROR_INVALID_PARAMETER;
+       }
 
+       if (error) {
+               *request_id = -1;
+               MAPS_LOGD("Invalid parameter");
+       }
 }
 
 session::command_search_route::~command_search_route()
 {
-       maps_item_hashtable_destroy(preference);
-       maps_coordinates_destroy(origin);
-       maps_coordinates_destroy(destination);
 }
 
 int session::command_search_route::run()
 {
-
-       if (error != MAPS_ERROR_NONE)
-               return error;
+       if (error != MAPS_ERROR_NONE) return error;
 
        pending_request pr(plugin());
 
@@ -1215,7 +1159,7 @@ session::command_search_route_waypoints::command_search_route_waypoints(
                                int num, maps_service_search_route_cb cb,
                                void *ud, int *request_id)
  : command(ms)
- , preference(NULL)
+ , preference(pref)
  , waypoint_list(NULL)
  , waypoint_num(num)
  , callback(cb)
@@ -1225,10 +1169,6 @@ session::command_search_route_waypoints::command_search_route_waypoints(
        *request_id = command::command_request_id++;
        my_req_id = *request_id;
 
-       if (pref &&
-           (maps_item_hashtable_clone(pref, &preference) != MAPS_ERROR_NONE))
-               error = MAPS_ERROR_INVALID_PARAMETER;
-
        waypoint_list = new maps_coordinates_h[num];
        for (int index = 0; index < num; index++) {
                if (list[index] != NULL) {
@@ -1240,8 +1180,6 @@ session::command_search_route_waypoints::command_search_route_waypoints(
 
 session::command_search_route_waypoints::~command_search_route_waypoints()
 {
-       maps_item_hashtable_destroy(preference);
-
        for (int index = 0; index < waypoint_num; index++) {
                if (waypoint_list[index] != NULL) {
                        maps_coordinates_destroy(waypoint_list[index]);
@@ -1252,7 +1190,6 @@ session::command_search_route_waypoints::~command_search_route_waypoints()
 
 int session::command_search_route_waypoints::run()
 {
-
        if (error != MAPS_ERROR_NONE)
                return error;
 
@@ -1308,25 +1245,21 @@ session::command_search_route_handler::command_search_route_handler(
 {
 }
 
-void session::command_search_route_handler::set_supported_data(maps_route_h
-                                                              route)
+void session::command_search_route_handler::set_supported_data(maps_route_h route)
 {
        if (!route || !plugin())
                return;
 
-       maps_string_hashtable_h data_supported = NULL;
-       if (maps_string_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
+       maps_int_hashtable_h data_supported = NULL;
+       if (maps_int_hashtable_create(&data_supported) != MAPS_ERROR_NONE)
                return;
 
-       __put_to_hashtable(this, MAPS_ROUTE_PATH, _S(MAPS_ROUTE_PATH),
-               data_supported);
-       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_PATH,
-               _S(MAPS_ROUTE_SEGMENTS_PATH), data_supported);
-       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_MANEUVERS,
-               _S(MAPS_ROUTE_SEGMENTS_MANEUVERS), data_supported);
+       __put_to_hashtable(this, MAPS_ROUTE_PATH, data_supported);
+       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_PATH, data_supported);
+       __put_to_hashtable(this, MAPS_ROUTE_SEGMENTS_MANEUVERS, data_supported);
 
        _maps_route_set_supported_data(route, data_supported);
-       maps_string_hashtable_destroy(data_supported);
+       maps_int_hashtable_destroy(data_supported);
 }
 
 bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
@@ -1340,8 +1273,7 @@ bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
                (command_search_route_handler *) user_data;
 
        if (request_id != handler->plg_req_id) {
-               MAPS_LOGE(
-"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+               MAPS_LOGE("\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
                        request_id, handler->plg_req_id);
        }
 
@@ -1358,7 +1290,7 @@ bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
        /* Send data to user */
        const bool b =
                handler->callback(error, handler->user_req_id, index, length,
-               cloned_result, handler->user_data);
+                                                       cloned_result, handler->user_data);
        if (!b || (index >= (length - 1))) {
                pending_request pr(handler->plugin());
                pr.remove(handler->user_req_id);
@@ -1373,14 +1305,9 @@ bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
 int session::command_cancel_request::run()
 {
        pending_request pr(plugin());
-       MAPS_LOGD("session::command_cancel_request::run: %d, %d", request_id,
-               pr.look_up(request_id));
-       const int error =
-               (pr.contains(request_id)) ? interface()->
-               maps_plugin_cancel_request(pr.
-               extract_plg_id(request_id)) : MAPS_ERROR_NOT_FOUND;
-
-       const int ret = error;
+       MAPS_LOGD("session::command_cancel_request::run: %d, %d", request_id, pr.look_up(request_id));
+       const int error = (pr.contains(request_id)) ?
+               interface()->maps_plugin_cancel_request(pr.extract_plg_id(request_id)) : MAPS_ERROR_NOT_FOUND;
        destroy();
-       return ret;
+       return error;
 }
index 693a2fd007083b8e1593f2eab5bbc73fb4e866f5..08df12b749479f171db44e6e3ea3d718ed637882 100644 (file)
@@ -23,757 +23,738 @@ namespace session
 {
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_geocode_f)(maps_service_h maps,
-       * const char *address, maps_service_geocode_cb callback,
-       * void *user_data, int* request_id); */
-       class command_geocode : public command
-       {
-       public:
-               const string address;
-               maps_item_hashtable_h preference;
-               maps_service_geocode_cb callback;
-               void *user_data;
-               int error;
-       public:
-               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();
-       private:
-               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();
-       };
+/*typedef int (*maps_plugin_geocode_f)(maps_service_h maps,
+* const char *address, maps_service_geocode_cb callback,
+* void *user_data, int* request_id); */
+class command_geocode : public command
+{
+public:
+       const string address;
+       maps_item_hashtable_h preference;
+       maps_service_geocode_cb callback;
+       void *user_data;
+       int error;
+public:
+       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();
+private:
+       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
+class command_geocode_handler : public command_handler
+{
+       maps_service_geocode_cb callback;
+public:
+       command_geocode_handler(plugin::plugin_s *plugin,
+                                maps_service_geocode_cb callback,
+                                void *user_data,
+                                int user_req_id);
+        virtual ~command_geocode_handler()
        {
-               maps_service_geocode_cb callback;
-       public:
-               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,
-                                              int total_count,
-                                              maps_coordinates_h coordinates,
-                                              void *user_data);
-               friend class command_geocode;
-               friend class command_geocode_inside_bounds;
-               friend class command_geocode_by_structured_address;
        };
+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,
+                                      maps_coordinates_h coordinates,
+                                      void *user_data);
+       friend class command_geocode;
+       friend class command_geocode_inside_bounds;
+       friend class command_geocode_by_structured_address;
+};
 
 /*----------------------------------------------------------------------------*/
 
-       /* 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,
-       * int* request_id); */
-       class command_geocode_inside_bounds : public command
-       {
-       public:
-               string address;
-               maps_area_h bounds;
-               maps_item_hashtable_h preference;
-               maps_service_geocode_cb callback;
-               void *user_data;
-               int error;
-       public:
-               command_geocode_inside_bounds(maps_service_h ms,
-                                              const char *address,
-                                              const maps_area_h bounds,
-                                              const maps_item_hashtable_h
-                                              preference,
+/* 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,
+* int* request_id); */
+class command_geocode_inside_bounds : public command
+{
+public:
+       string address;
+       maps_area_h bounds;
+       maps_item_hashtable_h preference;
+       maps_service_geocode_cb callback;
+       void *user_data;
+       int error;
+public:
+       command_geocode_inside_bounds(maps_service_h ms,
+                                      const char *address,
+                                      const maps_area_h bounds,
+                                      const maps_item_hashtable_h preference,
+                                      maps_service_geocode_cb callback,
+                                      void *user_data,
+                                      int *request_id);
+       virtual ~command_geocode_inside_bounds();
+private:
+       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();
+};
+
+/*----------------------------------------------------------------------------*/
+/*typedef int (*maps_plugin_geocode_by_structured_address_f)(
+* maps_service_h maps, maps_address_h address,
+* maps_preference_h preference, maps_service_geocode_cb callback,
+* void *user_data, int *request_id); */
+class command_geocode_by_structured_address : public command
+{
+public:
+       maps_address_h address;
+       maps_item_hashtable_h preference;
+       maps_service_geocode_cb callback;
+       void *user_data;
+       int error;
+public:
+       command_geocode_by_structured_address(maps_service_h ms,
+                                              const maps_address_h address,
+                                              const maps_item_hashtable_h preference,
                                               maps_service_geocode_cb callback,
                                               void *user_data,
                                               int *request_id);
-               virtual ~command_geocode_inside_bounds();
-       private:
-               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();
-       };
+       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();
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_geocode_by_structured_address_f)(
-       * maps_service_h maps, maps_address_h address,
-       * maps_preference_h preference, maps_service_geocode_cb callback,
-       * void *user_data, int *request_id); */
-       class command_geocode_by_structured_address : public command
-       {
-       public:
-               maps_address_h address;
-               maps_item_hashtable_h preference;
-               maps_service_geocode_cb callback;
-               void *user_data;
-               int error;
-       public:
-               command_geocode_by_structured_address(maps_service_h ms,
-                                                      const maps_address_h
-                                                      address,
-                                                      const
-                                                      maps_item_hashtable_h
-                                                      preference,
-                                                      maps_service_geocode_cb
-                                                      callback,
-                                                      void *user_data,
-                                                      int *request_id);
-               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();
+/*typedef int (*maps_plugin_reverse_geocode_f)(maps_service_h maps,
+* double latitude, double longitude,
+* maps_service_reverse_geocode_cb callback, void *user_data,
+* int *request_id); */
+class command_reverse_geocode : public command
+{
+public:
+       const string address;
+       double latitude;
+       double longitude;
+       maps_item_hashtable_h preference;
+       maps_service_reverse_geocode_cb callback;
+       void *user_data;
+       int error;
+public:
+       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();
+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();
+};
+
+class command_reverse_geocode_handler : public command_handler
+{
+       maps_service_reverse_geocode_cb callback;
+public:
+       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()
+       {
        };
+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,
+                                              maps_address_h address,
+                                              void *user_data);
+       friend class command_reverse_geocode;
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_reverse_geocode_f)(maps_service_h maps,
-       * double latitude, double longitude,
-       * maps_service_reverse_geocode_cb callback, void *user_data,
-       * int *request_id); */
-       class command_reverse_geocode : public command
-       {
-       public:
-               const string address;
-               double latitude;
-               double longitude;
-               maps_item_hashtable_h preference;
-               maps_service_reverse_geocode_cb callback;
-               void *user_data;
-               int error;
-       public:
-               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();
-       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();
-       };
+/*typedef int (*maps_plugin_multi_reverse_geocode_f)(maps_service_h maps,
+* maps_maps_h maps_list, maps_preference_h preference,
+* maps_service_multi_reverse_geocode_cb callback, void *user_data, * int *request_id); */
+class command_multi_reverse_geocode : public command
+{
+public:
+       const string address;
+       maps_coordinates_list_h maps_list;
+       maps_item_hashtable_h preference;
+       maps_service_multi_reverse_geocode_cb callback;
+       void *user_data;
+       int error;
+public:
+       command_multi_reverse_geocode(maps_service_h ms,
+                                const maps_coordinates_list_h maps_list,
+                                const maps_item_hashtable_h preference,
+                                maps_service_multi_reverse_geocode_cb callback,
+                                void *user_data, int *request_id);
+       virtual ~command_multi_reverse_geocode();
+private:
+       command_multi_reverse_geocode() : command(NULL)
+       {
+       }
+       command_multi_reverse_geocode(const command_multi_reverse_geocode &src)
+                : command(NULL)
+       {
+       }
+       command_multi_reverse_geocode &operator=(
+               const command_multi_reverse_geocode &src)
+       {
+               return *this;
+       }
+private:
+       virtual int run();
+};
 
-       class command_reverse_geocode_handler : public command_handler
-       {
-               maps_service_reverse_geocode_cb callback;
-       public:
-               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()
-               {
-               };
-       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,
-                                                      maps_address_h address,
-                                                      void *user_data);
-               friend class command_reverse_geocode;
+class command_multi_reverse_geocode_handler : public command_handler
+{
+       maps_service_multi_reverse_geocode_cb callback;
+public:
+       command_multi_reverse_geocode_handler(plugin::plugin_s *plugin,
+                                        maps_service_multi_reverse_geocode_cb callback,
+                                        void *user_data,
+                                        int user_req_id);
+       virtual ~command_multi_reverse_geocode_handler()
+       {
        };
+private:
+       command_multi_reverse_geocode_handler()
+                : command_handler(NULL, NULL, 0)
+       {
+       }
+       command_multi_reverse_geocode_handler(
+               command_multi_reverse_geocode_handler &src)
+                : command_handler(NULL, NULL, 0)
+       {
+       }
+       command_multi_reverse_geocode_handler &operator=(
+               const command_multi_reverse_geocode_handler &src)
+       {
+               return *this;
+       }
+private:
+       static bool foreach_multi_reverse_geocode_cb(maps_error_e result,
+                                              int request_id,
+                                                  int total,
+                                                  maps_coordinates_list_h address_list,
+                                              void *user_data);
+       friend class command_multi_reverse_geocode;
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_multi_reverse_geocode_f)(maps_service_h maps,
-       * maps_maps_h maps_list, maps_preference_h preference,
-       * maps_service_multi_reverse_geocode_cb callback, void *user_data, * int *request_id); */
-       class command_multi_reverse_geocode : public command
-       {
-       public:
-               const string address;
-               maps_coordinates_list_h maps_list;
-               maps_item_hashtable_h preference;
-               maps_service_multi_reverse_geocode_cb callback;
-               void *user_data;
-               int error;
-       public:
-               command_multi_reverse_geocode(maps_service_h ms,
-                                        const maps_coordinates_list_h maps_list,
-                                        const maps_item_hashtable_h preference,
-                                        maps_service_multi_reverse_geocode_cb callback,
-                                        void *user_data, int *request_id);
-               virtual ~command_multi_reverse_geocode();
-       private:
-               command_multi_reverse_geocode() : command(NULL)
-               {
-               }
-               command_multi_reverse_geocode(const command_multi_reverse_geocode &src)
-                        : command(NULL)
-               {
-               }
-               command_multi_reverse_geocode &operator=(
-                       const command_multi_reverse_geocode &src)
-               {
-                       return *this;
-               }
-       private:
-               virtual int run();
-       };
+/*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
+* maps_coordinates_h position, int distance,
+* maps_item_hashtable_h preference, maps_place_filter_h filter,
+* maps_service_search_place_cb callback, void *user_data,
+* int *request_id); */
+class command_search_place : public command
+{
+public:
+       maps_coordinates_h position;
+       int distance;
+       maps_item_hashtable_h preference;
+       maps_place_filter_h filter;
+       maps_service_search_place_cb callback;
+       void *user_data;
+
+       int error;
+public:
+       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();
+private:
+       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_multi_reverse_geocode_handler : public command_handler
-       {
-               maps_service_multi_reverse_geocode_cb callback;
-       public:
-               command_multi_reverse_geocode_handler(plugin::plugin_s *plugin,
-                                                maps_service_multi_reverse_geocode_cb callback,
-                                                void *user_data,
-                                                int user_req_id);
-               virtual ~command_multi_reverse_geocode_handler()
-               {
-               };
-       private:
-               command_multi_reverse_geocode_handler()
-                        : command_handler(NULL, NULL, 0)
-               {
-               }
-               command_multi_reverse_geocode_handler(
-                       command_multi_reverse_geocode_handler &src)
-                        : command_handler(NULL, NULL, 0)
-               {
-               }
-               command_multi_reverse_geocode_handler &operator=(
-                       const command_multi_reverse_geocode_handler &src)
-               {
-                       return *this;
-               }
-       private:
-               static bool foreach_multi_reverse_geocode_cb(maps_error_e result,
-                                                      int request_id,
-                                                          int total,
-                                                          maps_coordinates_list_h address_list,
-                                                      void *user_data);
-               friend class command_multi_reverse_geocode;
+class command_search_place_handler : public command_handler
+{
+       maps_service_search_place_cb callback;
+public:
+       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()
+       {
        };
+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,
+                                    void *user_data);
+       void set_supported_data(maps_place_h place);
+       friend class command_search_place;
+       friend class command_search_by_area_place;
+       friend class command_search_by_address_place;
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_search_place_f)(maps_service_h maps,
-       * maps_coordinates_h position, int distance,
-       * maps_item_hashtable_h preference, maps_place_filter_h filter,
-       * maps_service_search_place_cb callback, void *user_data,
-       * int *request_id); */
-       class command_search_place : public command
-       {
-       public:
-               maps_coordinates_h position;
-               int distance;
-               maps_item_hashtable_h preference;
-               maps_place_filter_h filter;
-               maps_service_search_place_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-               command_search_place(maps_service_h ms,
-                                     const maps_coordinates_h position,
-                                     int distance,
+/*typedef int (*maps_plugin_search_place_by_area_f)(maps_service_h maps,
+* maps_area_h boundary , maps_item_hashtable_h preference,
+* maps_place_filter_h filter, maps_service_search_place_cb callback,
+* void *user_data, int *request_id); */
+class command_search_by_area_place : public command
+{
+public:
+       maps_area_h boundary;
+       maps_item_hashtable_h preference;
+       maps_place_filter_h filter;
+       maps_service_search_place_cb callback;
+       void *user_data;
+
+       int error;
+public:
+       command_search_by_area_place(maps_service_h ms,
+                                     const maps_area_h boundary,
                                      const maps_item_hashtable_h preference,
                                      const maps_place_filter_h filter,
-                                     maps_service_search_place_cb callback,
+                                     maps_service_search_place_cb
+                                     callback,
                                      void *user_data, int *request_id);
-               virtual ~command_search_place();
-       private:
-               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,
-                                             maps_service_search_place_cb
-                                             callback,
-                                             void *user_data, int user_req_id);
-               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,
-                                            void *user_data);
-               void set_supported_data(maps_place_h place);
-               friend class command_search_place;
-               friend class command_search_by_area_place;
-               friend class command_search_by_address_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();
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_search_place_by_area_f)(maps_service_h maps,
-       * maps_area_h boundary , maps_item_hashtable_h preference,
-       * maps_place_filter_h filter, maps_service_search_place_cb callback,
-       * void *user_data, int *request_id); */
-       class command_search_by_area_place : public command
-       {
-       public:
-               maps_area_h boundary;
-               maps_item_hashtable_h preference;
-               maps_place_filter_h filter;
-               maps_service_search_place_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-               command_search_by_area_place(maps_service_h ms,
-                                             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_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();
-       };
+/*typedef int (*maps_plugin_search_place_by_address_f)(
+* maps_service_h maps, const char *address, maps_area_h boundary,
+* maps_place_preference_h preference, maps_place_filter_h filter,
+* maps_service_search_place_cb callback, void *user_data,
+* int *request_id); */
+class command_search_by_address_place : public command
+{
+public:
+       const string address;
+       maps_area_h boundary;
+       maps_item_hashtable_h preference;
+       maps_place_filter_h filter;
+       maps_service_search_place_cb callback;
+       void *user_data;
+
+       int error;
+public:
+       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();
+private:
+       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();
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_search_place_by_address_f)(
-       * maps_service_h maps, const char *address, maps_area_h boundary,
-       * maps_place_preference_h preference, maps_place_filter_h filter,
-       * maps_service_search_place_cb callback, void *user_data,
-       * int *request_id); */
-       class command_search_by_address_place : public command
-       {
-       public:
-               const string address;
-               maps_area_h boundary;
-               maps_item_hashtable_h preference;
-               maps_place_filter_h filter;
-               maps_service_search_place_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-               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();
-       private:
-               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();
-       };
+/*typedef int (*maps_plugin_search_place_list_f)(maps_service_h maps,
+* maps_area_h boundary, maps_item_hashtable_h preference, maps_place_filter_h filter,
+* maps_service_search_place_list_cb callback, void *user_data,
+* int *request_id); */
+class command_search_place_list : public command
+{
+public:
+       maps_area_h boundary;
+       maps_item_hashtable_h preference;
+       maps_place_filter_h filter;
+       maps_service_search_place_list_cb callback;
+       void *user_data;
+
+       int error;
+public:
+       command_search_place_list(maps_service_h ms,
+                               const maps_area_h boundary,
+                               const maps_item_hashtable_h preference,
+                               const maps_place_filter_h filter,
+                               maps_service_search_place_list_cb callback,
+                               void *user_data, int *request_id);
+       virtual ~command_search_place_list();
+private:
+       command_search_place_list() : command(NULL)
+       {
+       }
+       command_search_place_list(const command_search_place_list &src)
+                : command(NULL)
+       {
+       }
+       command_search_place_list &operator=(
+               const command_search_place_list &src)
+       {
+               return *this;
+       }
+private:
+       virtual int run();
+};
 
-/*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_search_place_list_f)(maps_service_h maps,
-       * maps_area_h boundary, maps_item_hashtable_h preference, maps_place_filter_h filter,
-       * maps_service_search_place_list_cb callback, void *user_data,
-       * int *request_id); */
-       class command_search_place_list : public command
-       {
-       public:
-               maps_area_h boundary;
-               maps_item_hashtable_h preference;
-               maps_place_filter_h filter;
-               maps_service_search_place_list_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-               command_search_place_list(maps_service_h ms,
-                                       const maps_area_h boundary,
-                                       const maps_item_hashtable_h preference,
-                                       const maps_place_filter_h filter,
+class command_search_place_list_handler : public command_handler
+{
+       maps_service_search_place_list_cb callback;
+public:
+       command_search_place_list_handler(plugin::plugin_s *plugin,
                                        maps_service_search_place_list_cb callback,
-                                       void *user_data, int *request_id);
-               virtual ~command_search_place_list();
-       private:
-               command_search_place_list() : command(NULL)
-               {
-               }
-               command_search_place_list(const command_search_place_list &src)
-                        : command(NULL)
-               {
-               }
-               command_search_place_list &operator=(
-                       const command_search_place_list &src)
-               {
-                       return *this;
-               }
-       private:
-               virtual int run();
-       };
-
-       class command_search_place_list_handler : public command_handler
+                                       void *user_data, int user_req_id);
+       virtual ~command_search_place_list_handler()
        {
-               maps_service_search_place_list_cb callback;
-       public:
-               command_search_place_list_handler(plugin::plugin_s *plugin,
-                                               maps_service_search_place_list_cb callback,
-                                               void *user_data, int user_req_id);
-               virtual ~command_search_place_list_handler()
-               {
-               };
-       private:
-               command_search_place_list_handler()
-                        : command_handler(NULL, NULL, 0)
-               {
-               }
-               command_search_place_list_handler(
-                       const command_search_place_list_handler &src)
-                        : command_handler(NULL, NULL, 0)
-               {
-               }
-               command_search_place_list_handler &operator=(
-                       const command_search_place_list_handler &src)
-               { return *this;
-               }
-       private:
-               static void foreach_place_list_cb(maps_error_e error, int request_id,
-                                               int total, maps_place_list_h place, void *user_data);
-               friend class command_search_place_list;
        };
+private:
+       command_search_place_list_handler()
+                : command_handler(NULL, NULL, 0)
+       {
+       }
+       command_search_place_list_handler(const command_search_place_list_handler &src)
+                : command_handler(NULL, NULL, 0)
+       {
+       }
+       command_search_place_list_handler &operator=(const command_search_place_list_handler &src)
+       { return *this;
+       }
+private:
+       static void foreach_place_list_cb(maps_error_e error, int request_id,
+                                       int total, maps_place_list_h place, void *user_data);
+       friend class command_search_place_list;
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_get_place_details_f) */
-       class command_get_place_details : public command
-       {
-       public:
-               const string url;
-               maps_service_get_place_details_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-                command_get_place_details(maps_service_h ms, const char *url,
-                       maps_service_get_place_details_cb callback, void *user_data, int *request_id);
-                virtual ~command_get_place_details();
-       private:
-               command_get_place_details() : command(NULL)
-               {
-               }
-               command_get_place_details(
-                       const command_get_place_details &src)
-                        : command(NULL)
-               {
-               }
-               command_get_place_details &operator=(
-                       const command_get_place_details &src)
-               {
-                       return *this;
-               }
-       private:
-               virtual int run();
-       };
+/*typedef int (*maps_plugin_get_place_details_f) */
+class command_get_place_details : public command
+{
+public:
+       const string url;
+       maps_service_get_place_details_cb callback;
+       void *user_data;
+
+       int error;
+public:
+        command_get_place_details(maps_service_h ms, const char *url,
+               maps_service_get_place_details_cb callback, void *user_data, int *request_id);
+        virtual ~command_get_place_details();
+private:
+       command_get_place_details() : command(NULL)
+       {
+       }
+       command_get_place_details( const command_get_place_details &src)
+                : command(NULL)
+       {
+       }
+       command_get_place_details &operator=(const command_get_place_details &src)
+       {
+               return *this;
+       }
+private:
+       virtual int run();
+};
 
-       class command_get_place_details_handler : public command_handler
-       {
-               maps_service_get_place_details_cb callback;
-       public:
-               command_get_place_details_handler(plugin::plugin_s *plugin,
-                                                       maps_service_get_place_details_cb callback,
-                                                       void *user_data, int user_req_id);
-               virtual ~command_get_place_details_handler()
-               {
-               };
-       private:
-               command_get_place_details_handler()
-                        : command_handler(NULL, NULL, 0)
-               {
-               }
-               command_get_place_details_handler(
-                       const command_get_place_details_handler &src)
-                        : command_handler(NULL, NULL, 0)
-               {
-               }
-               command_get_place_details_handler &operator=(
-                       const command_get_place_details_handler &src)
-               { return *this;
-               }
-       private:
-               static void foreach_place_details_cb(maps_error_e error, int request_id,
-                                                       maps_place_h place, void *user_data);
-               friend class command_get_place_details;
+class command_get_place_details_handler : public command_handler
+{
+       maps_service_get_place_details_cb callback;
+public:
+       command_get_place_details_handler(plugin::plugin_s *plugin,
+                                               maps_service_get_place_details_cb callback,
+                                               void *user_data, int user_req_id);
+       virtual ~command_get_place_details_handler()
+       {
        };
+private:
+       command_get_place_details_handler()
+                : command_handler(NULL, NULL, 0)
+       {
+       }
+       command_get_place_details_handler(const command_get_place_details_handler &src)
+                : command_handler(NULL, NULL, 0)
+       {
+       }
+       command_get_place_details_handler &operator=(const command_get_place_details_handler &src)
+       { return *this;
+       }
+private:
+       static void foreach_place_details_cb(maps_error_e error, int request_id,
+                                               maps_place_h place, void *user_data);
+       friend class command_get_place_details;
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_search_route_f)(
-       * maps_service_h maps, maps_item_hashtable_h preference,
-       * maps_coordinates_h origin, maps_coordinates_h destination,
-       * maps_service_search_route_cb callback, void *user_data,
-       * int *request_id); */
-       class command_search_route_handler : public command_handler
-       {
-               maps_service_search_route_cb callback;
-       public:
-               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()
-               {
-               };
-       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,
-                                            void *user_data);
-               void set_supported_data(maps_route_h route);
-               friend class command_search_route;
-               friend class command_search_route_waypoints;
-       };
-
-       class command_search_route : public command
+/*typedef int (*maps_plugin_search_route_f)(
+* maps_service_h maps, maps_item_hashtable_h preference,
+* maps_coordinates_h origin, maps_coordinates_h destination,
+* maps_service_search_route_cb callback, void *user_data,
+* int *request_id); */
+class command_search_route_handler : public command_handler
+{
+       maps_service_search_route_cb callback;
+public:
+       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()
        {
-       public:
-               maps_item_hashtable_h preference;
-               maps_coordinates_h origin;
-               maps_coordinates_h destination;
-               maps_service_search_route_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-               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();
-       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();
        };
+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,
+                                    void *user_data);
+       void set_supported_data(maps_route_h route);
+       friend class command_search_route;
+       friend class command_search_route_waypoints;
+};
+
+class command_search_route : public command
+{
+public:
+       maps_item_hashtable_h preference;
+       maps_coordinates_h origin;
+       maps_coordinates_h destination;
+       maps_service_search_route_cb callback;
+       void *user_data;
+
+       int error;
+public:
+       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();
+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();
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_search_route_f)(maps_service_h maps,
-       * maps_item_hashtable_h preference, maps_coordinates_h *waypoint_list,
-       * int waypoint_num, maps_service_search_route_cb callback,
-       * void *user_data, int *request_id); */
-       class command_search_route_waypoints:public command
-       {
-       public:
-               maps_item_hashtable_h preference;
-               maps_coordinates_h *waypoint_list;
-               int waypoint_num;
-               maps_service_search_route_cb callback;
-               void *user_data;
-
-               int error;
-       public:
-               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();
-       private:
-               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();
-       };
+/*typedef int (*maps_plugin_search_route_f)(maps_service_h maps,
+* maps_item_hashtable_h preference, maps_coordinates_h *waypoint_list,
+* int waypoint_num, maps_service_search_route_cb callback,
+* void *user_data, int *request_id); */
+class command_search_route_waypoints:public command
+{
+public:
+       maps_item_hashtable_h preference;
+       maps_coordinates_h *waypoint_list;
+       int waypoint_num;
+       maps_service_search_route_cb callback;
+       void *user_data;
+
+       int error;
+public:
+       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();
+private:
+       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();
+};
 
 /*----------------------------------------------------------------------------*/
-       /*typedef int (*maps_plugin_cancel_request_f)(maps_service_h maps,
-       * int request_id); */
-       class command_cancel_request : public command
-       {
-       public:
-               int request_id;
-       public:
-               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();
+/*typedef int (*maps_plugin_cancel_request_f)(maps_service_h maps,
+* int request_id); */
+class command_cancel_request : public command
+{
+public:
+       int request_id;
+public:
+       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__ */
index 9576ac96d6d98f24b05d5e499b36324646fa3332..9f85959539f4321891a3d5012c6c0fece50d99ec 100644 (file)
@@ -45,13 +45,6 @@ void utc_maps_route_create_n(void)
 }
 
 /*----------------------------------------------------------------------------*/
-static int __utc_put_to_hashtable(const char* feature_str,
-       maps_string_hashtable_h t)
-{
-       if (!feature_str || !t)
-               return MAPS_ERROR_INVALID_PARAMETER;
-       return maps_string_hashtable_set(t, feature_str, feature_str);
-}
 
 class test_env
 {
@@ -65,19 +58,23 @@ class test_env
                 g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
                 g_assert(h);
 
-               maps_string_hashtable_h data_supported = NULL;
-               if (maps_string_hashtable_create(&data_supported) !=
+               maps_int_hashtable_h data_supported = NULL;
+               if (maps_int_hashtable_create(&data_supported) !=
                        MAPS_ERROR_NONE)
                         return;
 
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_PATH), data_supported);
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_PATH),
-                       data_supported);
-                __utc_put_to_hashtable(_S(MAPS_ROUTE_SEGMENTS_MANEUVERS),
-                       data_supported);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_PATH,
+                                      MAPS_ROUTE_PATH);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_SEGMENTS_PATH,
+                                      MAPS_ROUTE_SEGMENTS_PATH);
+               maps_int_hashtable_set(data_supported,
+                                      MAPS_ROUTE_SEGMENTS_MANEUVERS,
+                                      MAPS_ROUTE_SEGMENTS_MANEUVERS);
 
                 _maps_route_set_supported_data(h, data_supported);
-                maps_string_hashtable_destroy(data_supported);
+                maps_int_hashtable_destroy(data_supported);
 
        }
        ~test_env()
@@ -158,11 +155,7 @@ void utc_maps_route_origin_p(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -185,11 +178,7 @@ void utc_maps_route_origin_n(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -220,11 +209,7 @@ void utc_maps_route_destination_p(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -247,11 +232,7 @@ void utc_maps_route_destination_n(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        /* start test ------------------------------------------------------- */
@@ -282,11 +263,7 @@ void utc_maps_route_bounding_box_p(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        maps_area_h bounding_box = NULL;
@@ -316,11 +293,7 @@ void utc_maps_route_bounding_box_n(void)
        test_env e;
 
        maps_coordinates_h coords = NULL;
-       int error = maps_coordinates_create(11.1, 22.2,
-#if _MAPS_COORDS_3D_
-               33.3,
-#endif
-               &coords);
+       int error = maps_coordinates_create(11.1, 22.2, &coords);
        g_assert_cmpint(error, ==, MAPS_ERROR_NONE);
 
        maps_area_h bounding_box = NULL;