fixed to enable getting what kind of search data is supported 68/96768/3 accepted/tizen/common/20161114.171532 accepted/tizen/ivi/20161114.074342 accepted/tizen/mobile/20161114.074241 accepted/tizen/tv/20161114.074303 accepted/tizen/wearable/20161114.074324 submit/tizen/20161114.041915
authorchanywa <cbible.kim@samsung.com>
Thu, 10 Nov 2016 06:18:48 +0000 (15:18 +0900)
committerSeechan Kim <cbible.kim@samsung.com>
Fri, 11 Nov 2016 07:36:24 +0000 (23:36 -0800)
Change-Id: If85205dda00e68c4f6b81453a033a22bba171841

src/session/command.h
src/session/commands.cpp
src/session/commands.h

index 9bc85f6..915ada1 100644 (file)
@@ -112,6 +112,10 @@ class command_handler
                {
                        return plg;
                }
+               void set_supported_place_data(maps_place_h place);
+               void set_supported_route_data(maps_route_h route);
+               void set_supported_place_list_data(maps_place_list_h place_list);
+               static bool set_supported_place_list_data_cb(int index, maps_place_h place, void *user_data);
        public:
                static void destroy(void *p);
 };
@@ -149,4 +153,4 @@ class pending_request
 };
 }
 
-#endif                         /* __MAPS_SERVICE_SESSION_COMMAND_H__ */
\ No newline at end of file
+#endif                         /* __MAPS_SERVICE_SESSION_COMMAND_H__ */
index fd3ffa2..40a8f61 100644 (file)
@@ -44,6 +44,75 @@ static int __put_to_hashtable(session::command_handler *ch,
        return MAPS_ERROR_NONE;
 }
 
+void session::command_handler::set_supported_place_data(maps_place_h place)
+{
+       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_int_hashtable_destroy(data_supported);
+}
+
+bool session::command_handler::set_supported_place_list_data_cb(int index, maps_place_h place, void *user_data)
+{
+       if (!place || !user_data)
+               return false;
+
+       maps_int_hashtable_h data_supported = (maps_int_hashtable_h)user_data;
+       _maps_place_set_supported_data(place, data_supported);
+       return true;
+}
+
+void session::command_handler::set_supported_place_list_data(maps_place_list_h place_list)
+{
+       if (!place_list || !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_list_foreach(place_list, set_supported_place_list_data_cb, data_supported);
+       maps_int_hashtable_destroy(data_supported);
+}
+
+void session::command_handler::set_supported_route_data(maps_route_h route)
+{
+       if (!route || !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_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_int_hashtable_destroy(data_supported);
+}
+
 /*----------------------------------------------------------------------------*/
 /*typedef int (*maps_plugin_geocode_f)(maps_service_h maps, const char *address,
 * maps_service_geocode_cb callback, void *user_data, int *request_id); */
@@ -605,28 +674,6 @@ session::command_search_place_handler::command_search_place_handler(
 {
 }
 
-void session::command_search_place_handler::set_supported_data(maps_place_h place)
-{
-       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_int_hashtable_destroy(data_supported);
-}
-
 bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
                                                             int request_id,
                                                             int index,
@@ -650,7 +697,7 @@ bool session::command_search_place_handler::foreach_place_cb(maps_error_e error,
 
        /* Check which data features are supported */
        if (cloned_result)
-               handler->set_supported_data(cloned_result);
+               handler->set_supported_place_data(cloned_result);
 
        /* Send data to user */
        const bool b = handler->callback(error, handler->user_req_id, index, length,
@@ -924,6 +971,10 @@ void session::command_search_place_list_handler::foreach_place_list_cb(maps_erro
                        request_id, handler->plg_req_id);
        }
 
+       /* Check which data features are supported */
+       if (place_list)
+               handler->set_supported_place_list_data(place_list);
+
        /* Send data to user */
        handler->callback(error, handler->user_req_id, total, place_list, handler->user_data);
 
@@ -1021,6 +1072,10 @@ void session::command_get_place_details_handler::foreach_place_details_cb(maps_e
                error = (maps_error_e) maps_place_clone(place, &cloned_result);
        maps_place_destroy(place);
 
+       /* Check which data features are supported */
+       if (cloned_result)
+               handler->set_supported_place_data(cloned_result);
+
        /* Send data to user */
        handler->callback(error, handler->user_req_id, cloned_result, handler->user_data);
 
@@ -1209,23 +1264,6 @@ session::command_search_route_handler::command_search_route_handler(
 {
 }
 
-void session::command_search_route_handler::set_supported_data(maps_route_h route)
-{
-       if (!route || !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_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_int_hashtable_destroy(data_supported);
-}
-
 bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
                                                             int request_id,
                                                             int index,
@@ -1249,7 +1287,7 @@ bool session::command_search_route_handler::foreach_route_cb(maps_error_e error,
 
        /* Check which data features are supported */
        if (cloned_result)
-               handler->set_supported_data(cloned_result);
+               handler->set_supported_route_data(cloned_result);
 
        /* Send data to user */
        const bool b =
@@ -1514,4 +1552,4 @@ void session::command_view_zoom_rotate::merge(const command *c)
                rotation_angle += cmd->rotation_angle;
                cmd->set_merged();
        }
-}
\ No newline at end of file
+}
index aec3512..9a78323 100644 (file)
@@ -392,7 +392,6 @@ private:
                                     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;
@@ -647,7 +646,6 @@ private:
                                     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;
 };