Support multi reverse geocode 95/52495/3 accepted/tizen/mobile/20151126.113045 submit/tizen_mobile/20151126.082715 submit/tizen_mobile/20151126.082722
authorchanywa <cbible.kim@samsung.com>
Tue, 24 Nov 2015 00:40:30 +0000 (09:40 +0900)
committerchanywa <cbible.kim@samsung.com>
Wed, 25 Nov 2015 05:09:05 +0000 (14:09 +0900)
Change-Id: Iea40b5248777d9ae2d03f9112cd765762495285b

31 files changed:
CMakeLists.txt
inc/engine/base/EventDrivenThread.h
inc/engine/common/HereConfig.h
inc/engine/common/HereMaps_global.h
inc/engine/geocoder/MultiReverseQuery.h [new file with mode: 0755]
inc/engine/geocoder/MultiReverseQueryListener.h [new file with mode: 0755]
inc/engine/geocoder/MultiReverseReply.h [new file with mode: 0755]
inc/engine/internal/RestCurl.h
inc/engine/internal/RestEngine.h
inc/engine/internal/RestItem.h
inc/here_api.h
inc/here_manager.h
inc/here_multirevgeocode.h [new file with mode: 0755]
inc/here_place.h
inc/here_revgeocode.h
inc/here_utils.h
lib/aarch64/libheremaps-engine.so.1
lib/aarch64/libheremaps-engine.so.1.0.6_8 [moved from lib/aarch64/libheremaps-engine.so.1.0.6_7 with 64% similarity]
lib/arm/libheremaps-engine.so.1
lib/arm/libheremaps-engine.so.1.0.6_8 [moved from lib/arm/libheremaps-engine.so.1.0.6_7 with 61% similarity]
lib/i586/libheremaps-engine.so.1
lib/i586/libheremaps-engine.so.1.0.6_8 [moved from lib/i586/libheremaps-engine.so.1.0.6_7 with 61% similarity]
lib/x86_64/libheremaps-engine.so.1
lib/x86_64/libheremaps-engine.so.1.0.6_8 [moved from lib/x86_64/libheremaps-engine.so.1.0.6_7 with 64% similarity]
maps-plugin-here.changes
packaging/maps-plugin-here.spec
src/here_api.cpp
src/here_manager.cpp
src/here_multirevgeocode.cpp [new file with mode: 0755]
src/here_place.cpp
src/here_plugin.cpp

index cb083d2..0a1a2ff 100644 (file)
@@ -32,7 +32,7 @@ ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
 # Main Include file
 SET(INC_DIR
-       inc     
+       inc
        inc/engine
 )
 
@@ -54,6 +54,7 @@ SET(SRCS
        src/here_geocode.cpp
        src/here_place.cpp
        src/here_revgeocode.cpp
+       src/here_multirevgeocode.cpp
        src/here_route.cpp
        src/here_utils.cpp
 )
@@ -67,7 +68,9 @@ SET_TARGET_PROPERTIES(${pkg_name}
     CLEAN_DIRECT_OUTPUT 1
 )
 
-TARGET_LINK_LIBRARIES(${pkg_name} ${pkgs_LDFLAGS})
+FIND_LIBRARY(HERE_ENGINE heremaps-engine lib/${ARCH})
+
+TARGET_LINK_LIBRARIES(${pkg_name} ${HERE_ENGINE} ${pkgs_LDFLAGS})
 
 # Install
 INSTALL(TARGETS ${pkg_name} DESTINATION ${LIBDIR}/maps/plugins)
index 05215c1..2b9c3ea 100755 (executable)
@@ -100,26 +100,10 @@ private:
        GIOChannel* __pChannel;
        GMainContext* __pGmainContext;
 
-       int __WorkingThreadNum;
-       bool __WaitingForJoin;
-       pthread_cond_t __join_condition;
-       pthread_mutex_t __join_mutex;
-
-       class ThreadArg
-       {
-       public:
-               int requestType;
-               void* pArg;
-               void* ReqInstance;
-       };
-
        FireArg_List FireArgs;
        pthread_mutex_t FireArgsLock;
-
-       static void* EventDrivenThreadHandler(void* thread_arg);
        static gboolean OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpointer data);
-       static gboolean __stopWaitingForJoin(gpointer data);
-
+       static void __flush(EventDrivenThread *pArg);
 }; // EventDrivenThread
 
 TIZEN_MAPS_END_NAMESPACE
index 840de74..499564a 100755 (executable)
@@ -38,4 +38,3 @@ public:
 TIZEN_MAPS_END_NAMESPACE
 
 #endif /* HERE_CONFIG_H */
-
index 8c5f6af..a13ea2f 100755 (executable)
 #ifndef HEREMAPS_GLOBAL_H
 #define HEREMAPS_GLOBAL_H
 
-#ifndef TIZEN_MIGRATION // Migration for Tizen 2.4
 #define TIZEN_MIGRATION
-#endif
 
-#ifndef TIZEN_CUSTOMIZATION
+#ifdef TIZEN_MIGRATION
+/* enhancement for updated HERE APIs */
 #define TIZEN_CUSTOMIZATION
+
+/* sub-features */
+#define TIZEN_SUPPORT_POST_METHOD
+#define TIZEN_SUPPORT_CRYPTO_LOCK                      /* mutex locking system for SSL */
+
+/* configuration */
+#define TIZEN_CFG_CURL_TIMEOUT         20      /* seconds */
+#define TIZEN_CFG_CURL_MULTITHREADS    8       /* the limit of multi-threads for CURL */
+
+/* for debugging */
+//#define TIZEN_PROFILING_CURL_TIME
+//#define TIZEN_PROFILING_MEMLEAK
 #endif
 
 
@@ -43,6 +54,7 @@ typedef unsigned char byte;
 #endif
 
 
+
 /*
  * Note: DEBUG variable should be set from the outside.
  * Currently done in CMAKE file
@@ -65,15 +77,10 @@ typedef unsigned char byte;
 #endif
 #define LOG_TAG "HERE_PLUGIN"
 
-#define MAPS_LOGD(fmt,args...)  LOGD(fmt, ##args)
-#define MAPS_LOGW(fmt,args...)  LOGW(fmt, ##args)
-#define MAPS_LOGI(fmt,args...)  LOGI(fmt, ##args)
-#define MAPS_LOGE(fmt,args...)  LOGE(fmt, ##args)
-#define MAPS_SECLOG(fmt,args...)  SECURE_LOGD(fmt, ##args)
-
 #define HERE_MAPS_LOG_DBG_INFO(fmt,args...)  LOGD(fmt, ##args);
 #define HERE_MAPS_LOG_ERROR(fmt,args...)     LOGE(fmt, ##args);
 #define HERE_MAPS_LOG_WARNING(fmt,args...)   LOGW(fmt, ##args);
+#define HERE_MAPS_SECLOG(fmt,args...)  SECURE_LOGD(fmt, ##args)
 
 #define HERE_MAPS_RETURN_RESULT(cond,ret,fmt,args...)\
         if (!cond) {\
diff --git a/inc/engine/geocoder/MultiReverseQuery.h b/inc/engine/geocoder/MultiReverseQuery.h
new file mode 100755 (executable)
index 0000000..56c9444
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2013 HERE Global B.V. All rights reserved.
+ * This software, including documentation, is protected by copyright controlled by
+ * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
+ * storing, adapting or translating, any or all of this material requires the prior
+ * written consent of HERE Global B.V. You may use this
+ * Software in accordance with the terms and conditions defined in the
+ * HERE Location Platform Services Terms and Conditions, available at
+ * http://developer.here.com/terms-conditions-base
+ *
+ * As an additional permission to the above, you may distribute Software,
+ * in object code format as part of an Application, according to, and subject to, terms and
+ * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
+ * You may distribute such object code format Application under terms of your choice,
+ * provided that the header and source files of the Software have not been modified.
+ */
+
+#ifndef MULTIREVERSEQUERY_H
+#define MULTIREVERSEQUERY_H
+
+#include "common/HereMaps_global.h"
+#include "common/GeoCoordinates.h"
+
+#include "geocoder/GeoCoderQueryBase.h"
+
+HERE_MAPS_BEGIN_NAMESPACE
+
+class MultiReverseReply;
+class GeoCoordinates;
+class MultiReverseQueryListener;
+
+/**
+ * This class represents a reverse geocoding query.
+ *
+ * Instances of the class are used to obtain an address (or a set of addresses)
+ * corresponding to a set of geographic coordinates.
+ *
+ * @ingroup geocoding
+ */
+class EXPORT_API MultiReverseQuery : public GeoCoderQueryBase
+{
+public:
+    /**
+     * This enumeration defines identifiers for reverse geocoding modes. A mode
+     * indicates whether addresses are to be returned or
+     * administrative area names (such as city, county, state, country).
+     */
+    enum ReverseMode
+    {
+        RM_RetrieveAreas,    ///< Indicates that administrative area names are to be retrieved.
+        RM_RetrieveAddresses ///< Indicates that addresses are to be retrieved.
+    };
+
+    /**
+     * This method is the default constructor.
+     */
+    MultiReverseQuery();
+
+    /**
+     * This method is a constructor that initializes the query with the location
+     * to reverse-geocode and the mode.
+     *
+     * @param rCoordinate A constant reference to an object containing the geographic
+     *        coordinates of the location to reverse-geocode.
+     *
+     * @param aMode A value indicating the reverse geocoding mode to use.
+     */
+    MultiReverseQuery(const GeoCoordinates& rCoordinate, ReverseMode aMode);
+
+    /**
+     * This method is a constructor that initializes the query with the location
+     * to reverse-geocode, the mode and the radius within which to conduct the
+     * search.
+     *
+     * @param rCoordinate A constant reference to an object containing the geographic
+     *        coordinates of the location to reverse-geocode.
+     *
+     * @param aMode A value indicating the reverse geocoding mode to use.
+     *
+     * @param fRadius A float value indicating the radius (in meters) within
+     *        which to search.
+     */
+    MultiReverseQuery(const GeoCoordinates& rCoordinate, ReverseMode aMode, float fRadius);
+
+    /**
+     * This method is the (virtual) destructor.
+     */
+    virtual ~MultiReverseQuery();
+
+    /**
+     * This method sets the properties defining a circular area within which a
+     * search is to be conducted. The area is defined in terms of its center and
+     * radius.
+     *
+     * @param rCoord A constant reference to an object containing the latitude
+     *        and longitude of the center of the proximity area (search center).
+     *
+     * @param rRadius A value specifying the radius of the search area in meters.
+     */
+    void SetProximity(const GeoCoordinates& rCoord, float fRadius = 0);
+
+    /**
+     * This method detects whether coordinates/proximity (the center of search area
+     * set or not).
+     *
+     * @return <code>true</code> if the proximity was set,
+     *        otherwise <code>false</code>
+     */
+    bool HasProximity() const;
+
+    /**
+     * This method sets the reverse geocoding mode to apply to the query.
+     *
+     * @param aMode A value indicating the reverse geocoding mode to use.
+     */
+    void SetMode(ReverseMode aMode);
+
+       void SetGeocodeList(const GeoCoordinateList& rGeocodeList);
+    /**
+     * This method attempts to establish a connection
+     * with the server and then, if the connection has been established, it
+     * builds and submits a query.
+     *
+     * @param rListener A shared pointer to an object that is to be notified when
+     *        the reply to the query has arrived from the server.
+     *
+     * @param pUserData A pointer to user data to be echoed in the reply object.
+     *
+     * @return A value representing the identifier of the issued request.
+     */
+    RestItemHandle::RequestId Execute(MultiReverseQueryListener& rListener, Tizen::Maps::HereObject* pUserData = NULL) const;
+
+    /**
+     * This method returns the base URI to be used for all subsequent
+     * reverse geocoder queries.
+     *
+     * @return A string containing the base URI.
+     */
+    String GetBaseUri() const;
+
+    /**
+     * This method returns the base URI to be used for all subsequent
+     * reverse geocoder queries.
+     *
+     * @param sUri A constant reference to a string containing the base URI.
+     */
+    void SetBaseUri(const String& sUri);
+
+private:
+    /**
+     * This method creates the URI for the request.
+     *
+     * @return URI request string.
+     */
+    String CreateUri() const;
+
+#ifdef TIZEN_MIGRATION_TO_SUPPORT_POST_METHOD
+    /**
+     * This method creates the URI for the request.
+     *
+     * @return URI request string.
+     */
+    String CreatePostData() const;
+#endif
+
+private:
+    HERE_MAPS_NO_COPY_NO_ASSIGN(MultiReverseQuery);
+
+    class MultiReverseQueryImpl;
+    MultiReverseQueryImpl* m_pImpl;
+};
+
+HERE_MAPS_END_NAMESPACE
+
+#endif
diff --git a/inc/engine/geocoder/MultiReverseQueryListener.h b/inc/engine/geocoder/MultiReverseQueryListener.h
new file mode 100755 (executable)
index 0000000..ccee5b0
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2013 HERE Global B.V. All rights reserved.
+ * This software, including documentation, is protected by copyright controlled by
+ * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
+ * storing, adapting or translating, any or all of this material requires the prior
+ * written consent of HERE Global B.V. You may use this
+ * Software in accordance with the terms and conditions defined in the
+ * HERE Location Platform Services Terms and Conditions, available at
+ * http://developer.here.com/terms-conditions-base
+ *
+ * As an additional permission to the above, you may distribute Software,
+ * in object code format as part of an Application, according to, and subject to, terms and
+ * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
+ * You may distribute such object code format Application under terms of your choice,
+ * provided that the header and source files of the Software have not been modified.
+ */
+
+#ifndef MULTIREVERSEQUERYLISTENER_H
+#define MULTIREVERSEQUERYLISTENER_H
+
+#include "common/HereMaps_global.h"
+
+#include "common/QueryListener.h"
+
+HERE_MAPS_BEGIN_NAMESPACE
+
+class MultiReverseReply;
+
+/**
+ * This class encapsulates a listener facility that is informed when the results
+ * of a query become available.
+ *
+ * The class exposes a callback method that must be implemented by the derived
+ * classes to process the data received from the server.
+ *
+ * @ingroup geocoding
+ */
+class EXPORT_API MultiReverseQueryListener : public QueryListener
+{
+public:
+    /**
+     * This method is the default constructor.
+     */
+    MultiReverseQueryListener();
+
+    /**
+     * This method is the destructor.
+     */
+    ~MultiReverseQueryListener();
+
+    /**
+     * This method is a callback invoked when data have arrived in response to a
+     * geocoding request.
+     *
+     * @param rReply A Constant reference to an object containing the response data.
+     */
+    virtual void OnMultiReverseReply(const MultiReverseReply& rReply) = 0;
+
+    #ifdef TIZEN_MIGRATION
+    /**
+     * This method is a callback invoked when geocoding request is failed.
+     *
+     * @param rReply A Constant reference to an object containing the response data.
+     */
+    virtual void OnMultiReverseFailure(const MultiReverseReply& rReply) = 0;
+    #endif
+
+private:
+
+    void OnReplySuccess(BaseReply& rReply);
+
+    #ifdef TIZEN_MIGRATION
+    void OnFailure(const BaseReply& rReply);
+    #endif
+
+};
+
+HERE_MAPS_END_NAMESPACE
+
+#endif
diff --git a/inc/engine/geocoder/MultiReverseReply.h b/inc/engine/geocoder/MultiReverseReply.h
new file mode 100755 (executable)
index 0000000..81ded6d
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2013 HERE Global B.V. All rights reserved.
+ * This software, including documentation, is protected by copyright controlled by
+ * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
+ * storing, adapting or translating, any or all of this material requires the prior
+ * written consent of HERE Global B.V. You may use this
+ * Software in accordance with the terms and conditions defined in the
+ * HERE Location Platform Services Terms and Conditions, available at
+ * http://developer.here.com/terms-conditions-base
+ *
+ * As an additional permission to the above, you may distribute Software,
+ * in object code format as part of an Application, according to, and subject to, terms and
+ * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
+ * You may distribute such object code format Application under terms of your choice,
+ * provided that the header and source files of the Software have not been modified.
+ */
+
+#ifndef MULTIREVERSEREPLY_H_
+#define MULTIREVERSEREPLY_H_
+
+#include "common/HereMaps_global.h"
+#include "common/BaseReply.h"
+
+HERE_MAPS_BEGIN_NAMESPACE
+
+class Result;
+class MetaInfo;
+
+
+/**
+ * This class encapsulates a reply to a geocoding query.
+ *
+ * The class receives the response data returned by the server in reply to a
+ * query asynchronously. Notification that the data is available comes via a
+ * listener object registered on the class by calling <code>AddListener()</code>.
+ *
+ * @ingroup geocoding
+ */
+class EXPORT_API MultiReverseReply : public BaseReply
+{
+public:
+
+    /**
+     * This is the default constructor.
+     */
+    MultiReverseReply();
+
+    /**
+     * This is a destructor.
+     */
+    virtual ~MultiReverseReply();
+
+    /**
+     * This method retrieves a value indicating the number of results in the
+     * reply to the query.
+     *
+     * @return An integer value indicating the number of results.
+     */
+    size_t GetNumResults() const;
+
+    /**
+     * This method retrieves a result at the index specified by the caller.
+     *
+     * @param A value indicating the index of the result to retrieve.
+     *
+     * @return A constant pointer to an instance of <code>Result</code>.
+     */
+    const Result* GetResult(size_t idx) const;
+
+    /**
+     * This method retrieves the reply meta information.
+     *
+     * @return A constant pointer to an instance of <code>MetaInfo</code>.
+     */
+    const MetaInfo* GetMetaInfo() const;
+
+private:
+    HERE_MAPS_NO_COPY_NO_ASSIGN(MultiReverseReply);
+    friend class TestGeoCoderParser;
+
+    virtual bool OnDataReceived(const unsigned char* pBuffer, size_t uSize);
+
+    class MultiReverseReplyImpl;
+    MultiReverseReplyImpl* m_pImpl;
+};
+
+HERE_MAPS_END_NAMESPACE
+
+#endif /* MULTIREVERSEREPLY_H_ */
index 5e5598b..ba0670c 100755 (executable)
 #include "base/BaseByteBuffer.h"
 #include "base/EventDrivenThread.h"
 
-#define RESTCURL_CRYPTO_LOCK
-
 TIZEN_MAPS_BEGIN_NAMESPACE
 
 using namespace Tizen::Maps;
 
 typedef struct MemoryStruct {
+       MemoryStruct() : memory(NULL), size(0), http_code(0), error(0) {};
+
        char *memory;
        size_t size;
        long http_code;
+       int error;
 } MemoryStruct_s;
 
 class RestCurl
@@ -47,17 +48,32 @@ class RestCurl
 public:
        RestCurl();
        virtual ~RestCurl();
+
+       static RestCurl& GetInstance();
        bool Commit(void *pArgs);
+       void Abort(const Here::Maps::RestItemHandle::RequestId aRequestId);
        void Clear();
+       void Join();
        void Shutdown();
-       void Abort(const Here::Maps::RestItemHandle::RequestId aRequestId);
-       int EasyCurl(String sUrl, MemoryStruct_s* pChunk);
-       String UrlEncode(String sStr);
-       static RestCurl& GetInstance();
-
 private:
-       static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp);
+       int EasyCurl(String sUrl, MemoryStruct_s* pChunk
+               #ifdef TIZEN_SUPPORT_POST_METHOD
+               , bool bPost = false, String sPostData = ""
+               #endif
+       );
        static void *ThreadFunc(void *pArgs);
+       static size_t WriteMemoryCb(void *pContents, size_t nSize, size_t nNmemb, void *pUser);
+       static int XferInfoCb(void *pUser, curl_off_t dlTotal, curl_off_t dlNow,
+                                          curl_off_t ulTotal, curl_off_t ulNow);
+       String UrlEncode(String sStr);
+       bool CreateDetachedThread(void* (*pFunc)(void*), void *pArgs);
+
+       #ifdef TIZEN_SUPPORT_CRYPTO_LOCK
+       static void CRYPTO_MutexLock(int mode, int type, char *file, int line);
+       static void CRYPTO_InitMutexLocks(void);
+       static void CRYPTO_KillMutexLocks(void);
+       static unsigned long CRYPTO_ThreadId(void);
+       #endif
 
        class RestCurlImpl;
        RestCurlImpl* m_pImpl;
index 62127ec..1a0576e 100755 (executable)
@@ -50,9 +50,18 @@ class RestEngineArgument
 : public Tizen::Maps::Object
 {
 public:
+#ifdef TIZEN_SUPPORT_POST_METHOD
+    RestEngineArgument(const String& sUrl, RestItem* pRestItem,
+                       bool bPost = false, const String& sPostData = "")
+    : m_sUrl(sUrl)
+    , m_pRestItem(pRestItem)
+    , m_bPost(bPost)
+    , m_sPostData(sPostData)
+#else
     RestEngineArgument(const String& sUrl, RestItem* pRestItem)
     : m_sUrl(sUrl)
     , m_pRestItem(pRestItem)
+#endif
     {
     }
 
@@ -73,9 +82,13 @@ public:
     String m_sUrl;
     RestItem* m_pRestItem;
     RestItemHandle::RequestId m_aRequestId;
-    #ifdef TIZEN_MIGRATION
+#ifdef TIZEN_MIGRATION
     Tizen::Maps::MemoryStruct_s m_Chunk;
-    #endif
+#endif
+#ifdef TIZEN_SUPPORT_POST_METHOD
+    bool m_bPost;
+    String m_sPostData;
+#endif
 };
 
 //this is an internal class and should not be used outside
@@ -88,7 +101,12 @@ class RestEngine
 public:
     static RestEngine& GetInstance();
 
+#ifdef TIZEN_SUPPORT_POST_METHOD
+    RestItemHandle::RequestId OpenRequest(const String& sUrl, QueryListener* pListener, BaseReplyPtr pReply,
+                                          bool bPost = false, const String& sPostData = "");
+#else
     RestItemHandle::RequestId OpenRequest(const String& sUrl, QueryListener* pListener, BaseReplyPtr pReply);
+#endif
     size_t GetNumPendingRequests() const;
     void ShutdownEngine();
     void AbortRequest(RestItemHandle::RequestId aRequestId);
@@ -111,6 +129,7 @@ private:
         RT_CloseRestItem,
         RT_DeleteRestItem
     };
+
     bool CheckRequestIn(RestItem* pRestItem);
     RestItem* GetChechedInRequest(RestItemHandle::RequestId aRequestId) const;
 
@@ -163,7 +182,12 @@ private:
 
     void RegisterListener(QueryListener* rListener);
 
+#ifdef TIZEN_SUPPORT_POST_METHOD
+    bool DoOpenRequest(const String& sUrl, RestItem* pRestItem,
+                       bool bPost = false, const String& sPostData = "");
+#else
     bool DoOpenRequest(const String& sUrl, RestItem* pRestItem);
+#endif
     void DoCloseRestItemLater(RestItemHandle::RequestId aRequestId);
     void DoDeleteRestItemLater(RestItem* pRestItem);
 
index 8b13f77..ae52890 100755 (executable)
@@ -54,7 +54,11 @@ public:
     RestItem(QueryListener* rListener, BaseReplyPtr pBaseReply);
     ~RestItem();
 
+#ifdef TIZEN_SUPPORT_POST_METHOD
+    bool Run(const String& rUri, bool bPost = false, const String& rPostData = "");
+#else
     bool Run(const String& rUri);
+#endif
     void Stop();
 
     void OnError(ErrorBase& rError);
index 61694ef..6c764ab 100644 (file)
@@ -46,6 +46,10 @@ int HerePluginReverseGeocode(double dLatitude, double dLongitude,
        maps_item_hashtable_h hPref, maps_service_reverse_geocode_cb pCbFunc,
        void *pUserData, int *nReqId);
 
+int HerePluginMultiReverseGeocode(const maps_coordinates_list_h hGeocodeList,
+       maps_item_hashtable_h hPref, maps_service_multi_reverse_geocode_cb pCbFunc,
+       void *pUserData, int *nReqId);
+
 int HerePluginSearchPlace(maps_coordinates_h hPos, int nDistance,
        maps_item_hashtable_h hPref, maps_place_filter_h hFilter, maps_service_search_place_cb pCbFunc,
        void * pUserData, int *nReqId);
index 8984392..25d78d5 100644 (file)
@@ -64,7 +64,8 @@ public:
                HERE_SVC_GEOCODE,
                HERE_SVC_REV_GEOCODE,
                HERE_SVC_PLACE,
-               HERE_SVC_ROUTE
+               HERE_SVC_ROUTE,
+               HERE_SVC_MULTI_REV_GEOCODE
        };
 
        void* CreateInstance(HereSvcType nHereSvc, void* pCbFunc, void* pUserData, int *nReqId);
diff --git a/inc/here_multirevgeocode.h b/inc/here_multirevgeocode.h
new file mode 100755 (executable)
index 0000000..5c1a704
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LOCATION_HERE_MULTI_REV_GEOCODER_H_
+#define _LOCATION_HERE_MULTI_REV_GEOCODER_H_
+
+//plug-in header
+#include "here_manager.h"
+
+#include <maps_coordinates.h>
+
+//map engine header
+#include <geocoder/MultiReverseQuery.h>
+#include <geocoder/MultiReverseReply.h>
+#include <geocoder/MultiReverseQueryListener.h>
+#include <geocoder/Result.h>
+#include <common/GeoLocation.h>
+#include <common/Address.h>
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+using namespace HERE_MAPS_NAMESPACE_PREFIX;
+
+class HereMultiRevGeocode
+: public HereBase
+, public MultiReverseQueryListener
+{
+public:
+       /**
+        *This is the default constructor for reverse Geocoder.
+        */
+
+       HereMultiRevGeocode(void *pCbFunc, void *pUserData, int nReqId);
+
+       /**
+        *This is the default destructor for reverse Geocoder.
+        */
+
+       ~HereMultiRevGeocode();
+
+
+       here_error_e PrepareQuery();
+       here_error_e PreparePositionList(const maps_coordinates_list_h hGeocodeList);
+       here_error_e StartMultiReverse(maps_item_hashtable_h hPref);
+
+       virtual void OnMultiReverseReply(const MultiReverseReply& Reply);
+       virtual void OnMultiReverseFailure(const MultiReverseReply& Reply);
+
+private:
+       MultiReverseQuery* m_pQuery;
+       GeoCoordinates m_geoCoord;
+};
+
+HERE_PLUGIN_END_NAMESPACE
+
+#endif //_LOCATION_HERE_MULTI_REV_GEOCODER_H_
index 2ba5fba..250d3c3 100644 (file)
@@ -100,6 +100,7 @@ private:
        void ProcessPlaceRated(PlaceDetails herePlace, maps_place_h mapsPlace);
 
        void __sortList(PlaceList &list);
+       void __flushReplies(int error);
        static bool __compareWithTitle(const maps_place_h &item1, const maps_place_h &item2);
        static bool __compareWithId(const maps_place_h &item1, const maps_place_h &item2);
        static bool __compareWithType(const maps_place_h &item1, const maps_place_h &item2);
@@ -114,6 +115,7 @@ private:
        int m_nReplyCnt;
        int m_nReplyIdx;
        char *m_szSortBy;
+       bool m_bPlaceDetailsInternal;
 
        PlaceList m_PlaceList;
 
index 43507a1..7a75b91 100644 (file)
@@ -20,7 +20,6 @@
 //plug-in header
 #include "here_manager.h"
 
-#include <maps_extra_types.h>
 #include <maps_coordinates.h>
 
 //map engine header
index ff47926..3a54031 100644 (file)
@@ -26,8 +26,6 @@
 #include <vector>
 
 //maps-service header
-#include <maps_extra_types.h>
-#include <maps_plugin_types.h>
 #include <maps_area.h>
 #include <maps_preference.h>
 #include <maps_route_maneuver.h>
index 9345673..e36a8f8 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_7
\ No newline at end of file
+libheremaps-engine.so.1.0.6_8
\ No newline at end of file
similarity index 64%
rename from lib/aarch64/libheremaps-engine.so.1.0.6_7
rename to lib/aarch64/libheremaps-engine.so.1.0.6_8
index 56cc739..9c102cd 100755 (executable)
Binary files a/lib/aarch64/libheremaps-engine.so.1.0.6_7 and b/lib/aarch64/libheremaps-engine.so.1.0.6_8 differ
index 9345673..e36a8f8 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_7
\ No newline at end of file
+libheremaps-engine.so.1.0.6_8
\ No newline at end of file
similarity index 61%
rename from lib/arm/libheremaps-engine.so.1.0.6_7
rename to lib/arm/libheremaps-engine.so.1.0.6_8
index 3602a23..73f239b 100755 (executable)
Binary files a/lib/arm/libheremaps-engine.so.1.0.6_7 and b/lib/arm/libheremaps-engine.so.1.0.6_8 differ
index 9345673..e36a8f8 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_7
\ No newline at end of file
+libheremaps-engine.so.1.0.6_8
\ No newline at end of file
similarity index 61%
rename from lib/i586/libheremaps-engine.so.1.0.6_7
rename to lib/i586/libheremaps-engine.so.1.0.6_8
index 7973594..d40e06d 100755 (executable)
Binary files a/lib/i586/libheremaps-engine.so.1.0.6_7 and b/lib/i586/libheremaps-engine.so.1.0.6_8 differ
index 9345673..e36a8f8 120000 (symlink)
@@ -1 +1 @@
-libheremaps-engine.so.1.0.6_7
\ No newline at end of file
+libheremaps-engine.so.1.0.6_8
\ No newline at end of file
similarity index 64%
rename from lib/x86_64/libheremaps-engine.so.1.0.6_7
rename to lib/x86_64/libheremaps-engine.so.1.0.6_8
index cd43eb7..c68d8f7 100755 (executable)
Binary files a/lib/x86_64/libheremaps-engine.so.1.0.6_7 and b/lib/x86_64/libheremaps-engine.so.1.0.6_8 differ
index 1087dc3..7264e7b 100644 (file)
@@ -1,3 +1,13 @@
+[Version]   maps-plugin-here_0.1.7
+[Date]      19 Nov 2015
+[Title]     Support multi reverse geocode
+[Developer] Kyoungjun Sung <kj7.sung@samsung.com>
+
+[Version]   maps-plugin-here_0.1.6
+[Date]      10 Nov 2015
+[Title]     Fixed to manage dropped requests of PlaceDetails
+[Developer] Seechan Kim <cbible.kim@samsung.com>
+
 [Version]   maps-plugin-here_0.1.5
 [Date]      06 Oct 2015
 [Title]     Fixed to return more proper error codes
index 5a94839..989cff6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       maps-plugin-here
 Summary:    Tizen HERE Maps Plug-in Library
-Version:    0.1.6
+Version:    0.1.7
 Release:    1
 Group:      Location/Libraries
 License:    Apache-2.0 and HERE
@@ -59,7 +59,7 @@ export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
 %endif
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=%{_libdir} -DARCH=%{ARCH}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=lib -DARCH=%{ARCH}
 make %{?jobs:-j%jobs}
 
 %install
@@ -79,6 +79,6 @@ cp -a lib/%{ARCH}/libheremaps-engine.so* %{buildroot}%{_prefix}/lib/
 %files
 %manifest maps-plugin-here.manifest
 %defattr(-,root,root,-)
-%{_libdir}/maps/plugins/libmaps-plugin-here.so*
+%{_prefix}/lib/maps/plugins/libmaps-plugin-here.so*
 %{_prefix}/lib/libheremaps-engine.so*
 /usr/share/license/maps-plugin-here
index f6cf4d2..ea0c870 100644 (file)
@@ -18,6 +18,7 @@
 #include "here_types.h"
 #include "here_geocode.h"
 #include "here_revgeocode.h"
+#include "here_multirevgeocode.h"
 #include "here_place.h"
 #include "here_route.h"
 #include <common/HereConfig.h>
@@ -264,6 +265,45 @@ int HerePluginReverseGeocode(double dLatitude, double dLongitude,
        return error;
 }
 
+int HerePluginMultiReverseGeocode(const maps_coordinates_list_h hGeocodeList,
+       maps_item_hashtable_h hPref, maps_service_multi_reverse_geocode_cb pCbFunc,
+       void *pUserData, int *nReqId)
+{
+       /* checking parmaters */
+       if (!hGeocodeList || !pCbFunc || !nReqId)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       if (!HereManager::GetHandler())
+               return HERE_ERROR_INVALID_OPERATION;
+
+       /* creating instance */
+       HereMultiRevGeocode *pMultiRevGeocode =
+               (HereMultiRevGeocode*)(HereManager::GetHandler()->CreateInstance(HereManager::HERE_SVC_MULTI_REV_GEOCODE,
+               (void*)pCbFunc, pUserData, nReqId));
+
+       if(!pMultiRevGeocode)
+               return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+
+       /* sending request */
+       here_error_e error = HERE_ERROR_UNKNOWN;
+
+       do {
+               error = pMultiRevGeocode->PrepareQuery();
+               if (error != HERE_ERROR_NONE) break;
+
+               error = pMultiRevGeocode->PreparePositionList(hGeocodeList);
+               if (error != HERE_ERROR_NONE) break;
+
+               error = pMultiRevGeocode->StartMultiReverse(hPref);
+       } while(0);
+
+       /* finishing task */
+       if(error != HERE_ERROR_NONE)
+               pMultiRevGeocode->TerminateService();
+
+       return error;
+}
+
 int HerePluginSearchPlace(maps_coordinates_h hPos, int nDistance,
        maps_item_hashtable_h hPref, maps_place_filter_h hFilter, maps_service_search_place_cb pCbFunc,
        void *pUserData, int *nReqId)
index 2f08b7e..8ccace9 100644 (file)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <sys/types.h>
 #include <unistd.h>
 #include <libxml/xpath.h>
 
@@ -22,6 +21,7 @@
 #include "here_base.h"
 #include "here_geocode.h"
 #include "here_revgeocode.h"
+#include "here_multirevgeocode.h"
 #include "here_place.h"
 #include "here_route.h"
 #include "here_utils.h"
@@ -85,7 +85,10 @@ bool HereManager::Create()
 void HereManager::Close()
 {
        pthread_mutex_lock(&g_mtxRef);
-       if (--m_nRefCnt == 0 && m_pHereManager)
+       bool terminate = (--m_nRefCnt == 0 && m_pHereManager);
+       pthread_mutex_unlock(&g_mtxRef);
+
+       if (terminate)
        {
                m_pHereManager->TerminateAllServices();
                HereConfig::Shutdown();
@@ -94,7 +97,6 @@ void HereManager::Close()
                m_pHereManager = NULL;
        }
        MAPS_LOGD("Closed a HereManager instance (%d).", m_nRefCnt);
-       pthread_mutex_unlock(&g_mtxRef);
 }
 
 HereManager* HereManager::GetHandler()
@@ -127,6 +129,10 @@ void* HereManager::CreateInstance(HereSvcType nHereSvc, void* pCbFunc,
                pHere = (HereBase*)new HereRoute(pCbFunc, pUserData, *nReqId);
                break;
 
+       case HERE_SVC_MULTI_REV_GEOCODE:
+               pHere = (HereBase*)new HereMultiRevGeocode(pCbFunc, pUserData, *nReqId);
+               break;
+
        default:
                return NULL;
        }
@@ -152,7 +158,7 @@ here_error_e HereManager::CloseInstance(int nReqId)
                }
        }
        pthread_mutex_unlock(&m_mtxHereList);
-       
+
        return HERE_ERROR_NONE;
 }
 
@@ -350,6 +356,7 @@ void HereManager::TerminateAllServices(void)
                        m_HereList.erase(it);
                }
                catch (std::exception &e) {
+                       MAPS_LOGD("Exception caught: %s", e.what());
                }
        };
 
diff --git a/src/here_multirevgeocode.cpp b/src/here_multirevgeocode.cpp
new file mode 100755 (executable)
index 0000000..098163d
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "here_multirevgeocode.h"
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+HereMultiRevGeocode::HereMultiRevGeocode(void* pCbFunc, void* pUserData, int nReqId)
+: m_geoCoord(0,0,0)
+{
+       m_pQuery = NULL;
+       m_pCbFunc = pCbFunc;
+       m_pUserData = pUserData;
+       m_nReqId = nReqId;
+}
+
+HereMultiRevGeocode::~HereMultiRevGeocode()
+{
+       if (m_pQuery)
+       {
+               delete m_pQuery;
+               m_pQuery = NULL;
+       }
+}
+
+here_error_e HereMultiRevGeocode::PrepareQuery()
+{
+       if (m_pQuery)
+               return HERE_ERROR_PERMISSION_DENIED;
+
+       m_pQuery = new MultiReverseQuery();
+
+       if (!m_pQuery)
+               return HERE_ERROR_OUT_OF_MEMORY;
+       else
+               return HERE_ERROR_NONE;
+}
+
+static bool geocoder_coordinates_cb(int index, maps_coordinates_h coordinates, void *user_data)
+{
+       double dLatitude = 0.0;
+       double dLongitude = 0.0;
+       GeoCoordinates hereCoord;
+       maps_coordinates_get_latitude(coordinates, &dLatitude);
+       maps_coordinates_get_longitude(coordinates, &dLongitude);
+       hereCoord = GeoCoordinates(dLatitude, dLongitude);
+
+       if (!HereUtils::IsValid(hereCoord))
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       GeoCoordinateList *pList =(GeoCoordinateList *) user_data;
+       pList->push_back(hereCoord);
+
+       return true;
+}
+
+here_error_e HereMultiRevGeocode::PreparePositionList(const maps_coordinates_list_h hGeocodeList)
+{
+       if (!m_pQuery)
+               return HERE_ERROR_OUT_OF_MEMORY;
+
+       if (!hGeocodeList)
+               return HERE_ERROR_INVALID_PARAMETER;
+
+       GeoCoordinateList hereCoordList;
+       maps_coordinates_list_foreach(hGeocodeList, geocoder_coordinates_cb, &hereCoordList);
+
+       m_pQuery->SetMode(MultiReverseQuery::RM_RetrieveAddresses);
+       m_pQuery->SetGeocodeList(hereCoordList);
+       m_pQuery->SetMaxResults(1);
+       m_pQuery->SetGenParameter(8);
+
+       return HERE_ERROR_NONE;
+}
+
+here_error_e HereMultiRevGeocode::StartMultiReverse(maps_item_hashtable_h hPref)
+{
+       if (!m_pQuery)
+               return HERE_ERROR_OUT_OF_MEMORY;
+
+       m_nRestReqId = m_pQuery->Execute(*this, NULL);
+
+       return (m_nRestReqId > 0 ? HERE_ERROR_NONE : HERE_ERROR_CANCELED);
+}
+
+void HereMultiRevGeocode::OnMultiReverseReply(const MultiReverseReply& Reply)
+{
+       if (m_bCanceled) // ignore call back if it was cancelled.
+       {
+               delete this;
+               return;
+       }
+
+       int nResults = Reply.GetNumResults();
+       Result* pResult;
+
+       maps_address_list_h address_list;
+       maps_address_list_create(&address_list);
+       maps_address_h pAddr = NULL;
+
+       for (size_t i = 0; i < (size_t)nResults; i++)
+       {
+               maps_error_e error = (maps_error_e)maps_address_create(&pAddr);
+
+               if(error == MAPS_ERROR_NONE)
+               {
+                       pResult = (Result*)Reply.GetResult(i);
+
+                       if (pResult)
+                       {
+                               Address tmpAddr = (pResult->GetLocation()).GetAddress();
+
+                               if(!tmpAddr.GetHouseNumber().empty())
+                                       maps_address_set_building_number(pAddr, tmpAddr.GetHouseNumber().c_str());
+
+                               if(!tmpAddr.GetStreet().empty())
+                                       maps_address_set_street(pAddr, tmpAddr.GetStreet().c_str());
+
+                               if(!tmpAddr.GetDistrict().empty())
+                                       maps_address_set_district(pAddr, tmpAddr.GetDistrict().c_str());
+
+                               if(!tmpAddr.GetCity().empty())
+                                       maps_address_set_city(pAddr, tmpAddr.GetCity().c_str());
+
+                               if(!tmpAddr.GetCounty().empty())
+                                       maps_address_set_county(pAddr, tmpAddr.GetCounty().c_str());
+
+                               if(!tmpAddr.GetState().empty())
+                                       maps_address_set_state(pAddr, tmpAddr.GetState().c_str());
+
+                               if(!tmpAddr.GetCountry().empty())
+                                       maps_address_set_country(pAddr, tmpAddr.GetCountry().c_str());
+
+                               if(!tmpAddr.GetCountryCode().empty())
+                                       maps_address_set_country_code(pAddr, tmpAddr.GetCountryCode().c_str());
+
+                               if(!tmpAddr.GetPostalCode().empty())
+                                       maps_address_set_postal_code(pAddr, tmpAddr.GetPostalCode().c_str());
+
+                               if(!tmpAddr.GetLabel().empty())
+                                       maps_address_set_freetext(pAddr, tmpAddr.GetLabel().c_str());
+                       }
+               }
+               maps_address_list_append(address_list, pAddr);
+       }
+
+       if (m_bCanceled)
+       {
+               maps_address_list_destroy(address_list);
+       }
+       else
+       {
+               ((maps_service_multi_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NONE, m_nReqId, nResults, address_list, m_pUserData);
+       }
+
+       delete this;
+}
+
+void HereMultiRevGeocode::OnMultiReverseFailure(const MultiReverseReply& Reply)
+{
+       if (!m_bCanceled)
+               ((maps_service_multi_reverse_geocode_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, NULL, m_pUserData);
+       delete this;
+}
+
+HERE_PLUGIN_END_NAMESPACE
+
index 297a811..8883347 100644 (file)
@@ -30,6 +30,7 @@ HerePlace::HerePlace(void *pCbFunc, void *pUserData, int nReqId)
        m_nReplyCnt = 0;
        m_nReplyIdx = 0;
        m_szSortBy = NULL;
+       m_bPlaceDetailsInternal = false;
 }
 
 HerePlace::~HerePlace()
@@ -329,7 +330,6 @@ here_error_e HerePlace::StartPlaceDetailsInternal(const char *szUrl)
 
        std::unique_ptr<PlaceDetailsQuery> pPlaceDetailsQuery (new (std::nothrow)PlaceDetailsQuery());
 
-
        bool bExcuted = (int)(pPlaceDetailsQuery->Execute(*this, NULL, szUrl) > 0);
 
        return (bExcuted ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION);
@@ -465,10 +465,13 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
                                hereLinkObj = herePlaceIt->GetLinkObject();
                                if (!hereLinkObj.GetHref().empty() && !hereLinkObj.GetId().empty())
                                {
-                                       m_PlaceList.push_back(mapsPlace);
-                                       isPending = true;
-                                       StartPlaceDetailsInternal(hereLinkObj.GetHref().c_str());
-                                       MAPS_LOGD("Add maps_place_h to the pending list. id=%s", hereLinkObj.GetId().data());
+                                       if (StartPlaceDetailsInternal(hereLinkObj.GetHref().c_str()) == HERE_ERROR_NONE)
+                                       {
+                                               m_PlaceList.push_back(mapsPlace);
+                                               isPending = true;
+                                               m_bPlaceDetailsInternal = true;
+                                               MAPS_LOGD("Add maps_place_h to the pending list. id=%s", hereLinkObj.GetId().data());
+                                       }
                                }
                        }
                }
@@ -526,30 +529,18 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
 
        if (m_nReplyIdx == m_nReplyCnt)
        {
-               m_nReplyIdx = 0;
-               __sortList(m_PlaceList);
-       
-               while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty())
-               {
-                       mapsPlace = m_PlaceList.front();
-                       m_PlaceList.pop_front();
-
-                       /* callback function */
-                       if (((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)error, m_nReqId,
-                               m_nReplyIdx++, m_nReplyCnt, mapsPlace, m_pUserData) == FALSE)
-                       {
-                               break;
-                       }
-               }
+               __flushReplies(error);
                delete this;
        }
 }
 
 void HerePlace::OnDiscoverFailure(const DiscoveryReply& Reply)
 {
-       if (!m_bCanceled)
-               ((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 1, NULL, m_pUserData);
-       delete this;
+       if (++m_nReplyIdx == m_nReplyCnt)
+       {
+               __flushReplies((maps_error_e)GetErrorCode(Reply));
+               delete this;
+       }
 }
 
 void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply)
@@ -652,35 +643,21 @@ void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply)
        if (!isPending)
                m_PlaceList.push_back(mapsPlace);
 
-       m_nReplyIdx++;
 
-
-       if (m_nReplyIdx == m_nReplyCnt)
+       if (++m_nReplyIdx == m_nReplyCnt)
        {
-               m_nReplyIdx = 0;
-               __sortList(m_PlaceList);
-       
-               while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty())
-               {
-                       mapsPlace = m_PlaceList.front();
-                       m_PlaceList.pop_front();
-
-                       /* callback function */
-                       if (((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)error, m_nReqId,
-                               m_nReplyIdx++, m_nReplyCnt, mapsPlace, m_pUserData) == FALSE)
-                       {
-                               break;
-                       }
-               }
+               __flushReplies(error);
                delete this;
        }
 }
 
 void HerePlace::OnPlaceDetailsFailure(const PlaceDetailsReply& Reply)
 {
-       if (!m_bCanceled)
-               ((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 1, NULL, m_pUserData);
-       delete this;
+       if (++m_nReplyIdx == m_nReplyCnt)
+       {
+               __flushReplies(m_bPlaceDetailsInternal ? MAPS_ERROR_NONE : GetErrorCode(Reply));
+               delete this;
+       }
 }
 
 void HerePlace::ProcessPlaceLocation(PlaceDetails herePlace, maps_place_h mapsPlace)
@@ -1195,6 +1172,27 @@ void HerePlace::ProcessPlaceRated(PlaceDetails herePlace, maps_place_h mapsPlace
        maps_place_link_object_destroy(mapsRelated);
 }
 
+void HerePlace::__flushReplies(int error)
+{
+       maps_place_h mapsPlace;
+
+       m_nReplyIdx = 0;
+       __sortList(m_PlaceList);
+
+       while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty())
+       {
+               mapsPlace = m_PlaceList.front();
+               m_PlaceList.pop_front();
+
+               /* callback function */
+               if (((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)error, m_nReqId,
+                       m_nReplyIdx++, m_nReplyCnt, mapsPlace, m_pUserData) == FALSE)
+               {
+                       break;
+               }
+       }
+}
+
 bool HerePlace::__compareWithTitle(const maps_place_h &item1, const maps_place_h &item2)
 {
        bool result = false;
index 43e3c77..4d1320c 100644 (file)
@@ -125,6 +125,7 @@ EXPORT_API int maps_plugin_is_service_supported(maps_service_e service, bool *su
                case MAPS_SERVICE_SEARCH_ROUTE:
                case MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS:
                case MAPS_SERVICE_CANCEL_REQUEST:
+               case MAPS_SERVICE_MULTI_REVERSE_GEOCODE:
                        *supported = TRUE;
                        return MAPS_ERROR_NONE;
                default:
@@ -216,6 +217,20 @@ EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
        return ConvertToMapsError(ret);
 }
 
+EXPORT_API int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h geocode_list,
+       const maps_preference_h preference, maps_service_multi_reverse_geocode_cb callback,
+       void *user_data, int *request_id)
+{
+       if (!callback || !request_id)
+               return MAPS_ERROR_INVALID_PARAMETER;
+
+       int ret = HerePluginMultiReverseGeocode(geocode_list, preference, callback, user_data, request_id);
+
+       MAPS_LOGD("here_error_e = %d", ret);
+
+       return ConvertToMapsError(ret);
+}
+
 EXPORT_API int maps_plugin_search_place(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)