1.Fixed that some requests failed to be sent are not replied to the maps-service. 30/54930/5 accepted/tizen/mobile/20160108.065340 accepted/tizen/tv/20160108.065400 accepted/tizen/wearable/20160108.065429 submit/tizen/20160108.030452
authorchanywa <cbible.kim@samsung.com>
Mon, 21 Dec 2015 01:32:22 +0000 (10:32 +0900)
committerchanywa <cbible.kim@samsung.com>
Tue, 5 Jan 2016 06:33:07 +0000 (15:33 +0900)
2.Fixed to get the result data correctly from reverse geocoder replier.

Change-Id: I9e7b3e49bb12f2340685ba719069e4b0815512cf

21 files changed:
inc/engine/geocoder/MultiReverseQuery.h
inc/engine/geocoder/MultiReverseQueryListener.h
inc/engine/geocoder/MultiReverseReply.h
inc/engine/internal/RestEngine.h
inc/here_multirevgeocode.h
inc/here_place.h
lib/aarch64/libheremaps-engine.so.1.0.6_8
lib/arm/libheremaps-engine.so.1.0.6_8
lib/i586/libheremaps-engine.so.1.0.6_8
lib/x86_64/libheremaps-engine.so.1.0.6_8
maps-plugin-here.changes
packaging/maps-plugin-here.spec
src/here_api.cpp
src/here_base.cpp
src/here_geocode.cpp
src/here_manager.cpp
src/here_multirevgeocode.cpp
src/here_place.cpp
src/here_plugin.cpp
src/here_revgeocode.cpp
src/here_route.cpp

index 56c9444..70bff98 100755 (executable)
 
 #include "geocoder/GeoCoderQueryBase.h"
 
-HERE_MAPS_BEGIN_NAMESPACE
+TIZEN_MAPS_BEGIN_NAMESPACE
 
 class MultiReverseReply;
-class GeoCoordinates;
 class MultiReverseQueryListener;
 
 /**
@@ -37,7 +36,7 @@ class MultiReverseQueryListener;
  *
  * @ingroup geocoding
  */
-class EXPORT_API MultiReverseQuery : public GeoCoderQueryBase
+class EXPORT_API MultiReverseQuery : public Here::Maps::GeoCoderQueryBase
 {
 public:
     /**
@@ -65,7 +64,7 @@ public:
      *
      * @param aMode A value indicating the reverse geocoding mode to use.
      */
-    MultiReverseQuery(const GeoCoordinates& rCoordinate, ReverseMode aMode);
+    MultiReverseQuery(const Here::Maps::GeoCoordinates& rCoordinate, ReverseMode aMode);
 
     /**
      * This method is a constructor that initializes the query with the location
@@ -80,7 +79,7 @@ public:
      * @param fRadius A float value indicating the radius (in meters) within
      *        which to search.
      */
-    MultiReverseQuery(const GeoCoordinates& rCoordinate, ReverseMode aMode, float fRadius);
+    MultiReverseQuery(const Here::Maps::GeoCoordinates& rCoordinate, ReverseMode aMode, float fRadius);
 
     /**
      * This method is the (virtual) destructor.
@@ -97,7 +96,7 @@ public:
      *
      * @param rRadius A value specifying the radius of the search area in meters.
      */
-    void SetProximity(const GeoCoordinates& rCoord, float fRadius = 0);
+    void SetProximity(const Here::Maps::GeoCoordinates& rCoord, float fRadius = 0);
 
     /**
      * This method detects whether coordinates/proximity (the center of search area
@@ -115,7 +114,12 @@ public:
      */
     void SetMode(ReverseMode aMode);
 
-       void SetGeocodeList(const GeoCoordinateList& rGeocodeList);
+    /**
+     * This method sets the get a list of locations to reverse-geocode.
+     *
+     * @param rGeocodeList A list of locations to reverse-geocode.
+     */
+    void SetGeocodeList(const Here::Maps::GeoCoordinateList& rGeocodeList);
     /**
      * This method attempts to establish a connection
      * with the server and then, if the connection has been established, it
@@ -128,7 +132,8 @@ public:
      *
      * @return A value representing the identifier of the issued request.
      */
-    RestItemHandle::RequestId Execute(MultiReverseQueryListener& rListener, Tizen::Maps::HereObject* pUserData = NULL) const;
+    Here::Maps::RestItemHandle::RequestId Execute(MultiReverseQueryListener& rListener,
+        Tizen::Maps::HereObject* pUserData = NULL) const;
 
     /**
      * This method returns the base URI to be used for all subsequent
@@ -154,7 +159,7 @@ private:
      */
     String CreateUri() const;
 
-#ifdef TIZEN_MIGRATION_TO_SUPPORT_POST_METHOD
+#ifdef TIZEN_SUPPORT_POST_METHOD
     /**
      * This method creates the URI for the request.
      *
@@ -170,6 +175,6 @@ private:
     MultiReverseQueryImpl* m_pImpl;
 };
 
-HERE_MAPS_END_NAMESPACE
+TIZEN_MAPS_END_NAMESPACE
 
 #endif
index ccee5b0..24a4282 100755 (executable)
 #define MULTIREVERSEQUERYLISTENER_H
 
 #include "common/HereMaps_global.h"
-
 #include "common/QueryListener.h"
 
-HERE_MAPS_BEGIN_NAMESPACE
+TIZEN_MAPS_BEGIN_NAMESPACE
 
 class MultiReverseReply;
 
@@ -35,7 +34,7 @@ class MultiReverseReply;
  *
  * @ingroup geocoding
  */
-class EXPORT_API MultiReverseQueryListener : public QueryListener
+class EXPORT_API MultiReverseQueryListener : public Here::Maps::QueryListener
 {
 public:
     /**
@@ -67,14 +66,14 @@ public:
 
 private:
 
-    void OnReplySuccess(BaseReply& rReply);
+    void OnReplySuccess(Here::Maps::BaseReply& rReply);
 
     #ifdef TIZEN_MIGRATION
-    void OnFailure(const BaseReply& rReply);
+    void OnFailure(const Here::Maps::BaseReply& rReply);
     #endif
 
 };
 
-HERE_MAPS_END_NAMESPACE
+TIZEN_MAPS_END_NAMESPACE
 
 #endif
index 81ded6d..6398158 100755 (executable)
 #include "common/HereMaps_global.h"
 #include "common/BaseReply.h"
 
-HERE_MAPS_BEGIN_NAMESPACE
-
-class Result;
-class MetaInfo;
+#include "geocoder/Result.h"
+#include "geocoder/MetaInfo.h"
 
+TIZEN_MAPS_BEGIN_NAMESPACE
 
 /**
  * This class encapsulates a reply to a geocoding query.
@@ -36,7 +35,7 @@ class MetaInfo;
  *
  * @ingroup geocoding
  */
-class EXPORT_API MultiReverseReply : public BaseReply
+class EXPORT_API MultiReverseReply : public Here::Maps::BaseReply
 {
 public:
 
@@ -65,14 +64,14 @@ public:
      *
      * @return A constant pointer to an instance of <code>Result</code>.
      */
-    const Result* GetResult(size_t idx) const;
+    const Here::Maps::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;
+    const Here::Maps::MetaInfo* GetMetaInfo() const;
 
 private:
     HERE_MAPS_NO_COPY_NO_ASSIGN(MultiReverseReply);
@@ -84,6 +83,6 @@ private:
     MultiReverseReplyImpl* m_pImpl;
 };
 
-HERE_MAPS_END_NAMESPACE
+TIZEN_MAPS_END_NAMESPACE
 
 #endif /* MULTIREVERSEREPLY_H_ */
index 1a0576e..7132e97 100755 (executable)
@@ -63,16 +63,31 @@ public:
     , m_pRestItem(pRestItem)
 #endif
     {
+    #ifdef TIZEN_MIGRATION
+        m_aRequestId = RestItemHandle::INVALID_RESTITEM;
+    #endif
     }
 
     RestEngineArgument(RestItemHandle::RequestId aRequestId)
     : m_aRequestId(aRequestId)
     {
+    #ifdef TIZEN_MIGRATION
+        m_pRestItem = NULL;
+    #ifdef TIZEN_SUPPORT_POST_METHOD
+        m_bPost = false;
+    #endif
+    #endif
     }
 
     RestEngineArgument(RestItem* pRestItem)
     : m_pRestItem(pRestItem)
     {
+    #ifdef TIZEN_MIGRATION
+        m_aRequestId = RestItemHandle::INVALID_RESTITEM;
+    #ifdef TIZEN_SUPPORT_POST_METHOD
+        m_bPost = false;
+    #endif
+    #endif
     }
 
     ~RestEngineArgument()
index 5c1a704..3051d1f 100755 (executable)
@@ -33,6 +33,7 @@
 HERE_PLUGIN_BEGIN_NAMESPACE
 
 using namespace HERE_MAPS_NAMESPACE_PREFIX;
+using namespace TIZEN_MAPS_NAMESPACE_PREFIX;
 
 class HereMultiRevGeocode
 : public HereBase
index 250d3c3..0cc4338 100644 (file)
@@ -114,6 +114,7 @@ private:
        PlaceDetailsQuery* m_pPlaceDetailsQuery;
        int m_nReplyCnt;
        int m_nReplyIdx;
+       bool m_bReplyFlushed;
        char *m_szSortBy;
        bool m_bPlaceDetailsInternal;
 
index 9c102cd..d2446f5 100755 (executable)
Binary files a/lib/aarch64/libheremaps-engine.so.1.0.6_8 and b/lib/aarch64/libheremaps-engine.so.1.0.6_8 differ
index 73f239b..33a0c4f 100755 (executable)
Binary files a/lib/arm/libheremaps-engine.so.1.0.6_8 and b/lib/arm/libheremaps-engine.so.1.0.6_8 differ
index d40e06d..4ab209d 100755 (executable)
Binary files a/lib/i586/libheremaps-engine.so.1.0.6_8 and b/lib/i586/libheremaps-engine.so.1.0.6_8 differ
index c68d8f7..3dda9f2 100755 (executable)
Binary files a/lib/x86_64/libheremaps-engine.so.1.0.6_8 and b/lib/x86_64/libheremaps-engine.so.1.0.6_8 differ
index 83c6a74..e8651f4 100644 (file)
@@ -1,3 +1,8 @@
+[Version]   maps-plugin-here_0.1.9
+[Date]      21 Dec 2015
+[Title]     Fixed that some requests failed to be sent are not replied to the maps-service.
+[Developer] Seechan Kim <cbible.kim@samsung.com>
+
 [Version]   maps-plugin-here_0.1.8
 [Date]      18 Dec 2015
 [Title]     Support HERE User consent
index ba70f8e..9c80636 100644 (file)
@@ -1,7 +1,7 @@
 Name:       maps-plugin-here
 Summary:    Tizen HERE Maps Plug-in Library
-Version:    0.1.8
-Release:    1
+Version:    0.1.9
+Release:    2
 Group:      Location/Libraries
 License:    Apache-2.0 and HERE
 Source0:    %{name}-%{version}.tar.gz
@@ -53,7 +53,7 @@ Requires(postun): /sbin/ldconfig
 %endif
 
 %description
-This packages provides Plugin APIs capsulating HERE Maps Engine Library for Maps Service Library.
+This package provides Plugin APIs capsulating HERE Maps Engine Library for Maps Service Library.
 
 %prep
 %setup -q
@@ -95,7 +95,7 @@ Summary:    HereMaps UC popup
 Requires:   %{name} = %{version}-%{release}
 
 %description -n org.tizen.heremaps-uc
-HereMaps UC popup
+This package provides UI interface to get consents from users to the HERE platform Service.
 
 %files -n org.tizen.heremaps-uc
 %manifest heremaps-uc/org.tizen.heremaps-uc.manifest
index dc69dd2..194d050 100644 (file)
 #include "here_route.h"
 #include <common/HereConfig.h>
 
-
 using namespace HERE_PLUGIN_NAMESPACE_PREFIX;
 
 int HerePluginInit(maps_plugin_h *hPlugin)
 {
-       if (!hPlugin)
-               return HERE_ERROR_INVALID_PARAMETER;
-
        here_error_e error = HereManager::CheckAgreement();
        if (error != HERE_ERROR_NONE)
                return error;
@@ -47,9 +43,6 @@ int HerePluginInit(maps_plugin_h *hPlugin)
 
 int HerePluginShutdown(maps_plugin_h hPlugin)
 {
-       if (!hPlugin)
-               return HERE_ERROR_INVALID_PARAMETER;
-
        if (HereManager::GetHandler())
                HereManager::GetHandler()->Close();
 
@@ -135,6 +128,7 @@ int HerePluginGeocode(const char* szAddr,
                if (error != HERE_ERROR_NONE) break;
 
                error = pGeocode->PreparePreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pGeocode->StartGeocode(szAddr);
        } while(0);
@@ -173,6 +167,7 @@ int HerePluginGeocodeByStructuredAddress(const maps_address_h hAddr,
                if (error != HERE_ERROR_NONE) break;
 
                error = pGeocode->PreparePreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pGeocode->StartGeocodeByStructuredAddress(hAddr);
        } while(0);
@@ -214,6 +209,7 @@ int HerePluginGeocodeInsideArea(const char* szAddr, maps_area_h hArea,
                if (error != HERE_ERROR_NONE) break;
 
                error = pGeocode->PreparePreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pGeocode->StartGeocodeInsideArea(szAddr, hArea);
        } while(0);
@@ -255,6 +251,7 @@ int HerePluginReverseGeocode(double dLatitude, double dLongitude,
                if (error != HERE_ERROR_NONE) break;
 
                error = pRevGeocode->PreparePreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pRevGeocode->PreparePosition(dLatitude, dLongitude);
                if (error != HERE_ERROR_NONE) break;
@@ -338,6 +335,7 @@ int HerePluginSearchPlace(maps_coordinates_h hPos, int nDistance,
                if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PrepareDiscoveryPreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PrepareDiscoveryFilter(hFilter);
                if (error != HERE_ERROR_NONE) break;
@@ -382,6 +380,7 @@ int HerePluginSearchPlaceByArea(maps_area_h hArea,
                if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PrepareDiscoveryPreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PrepareDiscoveryFilter(hFilter);
                if (error != HERE_ERROR_NONE) break;
@@ -426,6 +425,7 @@ int HerePluginSearchPlaceByAddress(const char* szAddr, maps_area_h hArea,
                if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PrepareDiscoveryPreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PrepareDiscoveryFilter(hFilter);
                if (error != HERE_ERROR_NONE) break;
@@ -467,6 +467,7 @@ int HerePluginSearchPlaceDetails(const char* szUrl,
                if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->PreparePlaceDetailsPreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pPlace->StartPlaceDetails(szUrl);
        } while(0);
@@ -509,6 +510,7 @@ int HerePluginSearchRoute(maps_coordinates_h hOrigin, maps_coordinates_h hDestin
                if (error != HERE_ERROR_NONE) break;
 
                error = pRoute->PreparePreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pRoute->PrepareWaypoint(hOrigin, hDestination);
                if (error != HERE_ERROR_NONE) break;
@@ -559,6 +561,7 @@ int HerePluginSearchRouteWaypoints(const maps_coordinates_h* hWaypointList, int
                if (error != HERE_ERROR_NONE) break;
 
                error = pRoute->PreparePreference(hPref);
+               if (error != HERE_ERROR_NONE) break;
 
                error = pRoute->StartRoute();
        } while(0);
index c3589f3..43a7fbe 100644 (file)
@@ -30,6 +30,9 @@ HereBase::HereBase()
        m_nRestReqId = 0;
        m_bCanceled = 0;
        m_nReqId = 0;
+
+       m_pCbFunc = NULL;
+       m_pUserData = NULL;
 }
 
 HereBase::~HereBase()
index f7464d7..80f11b5 100644 (file)
@@ -41,7 +41,7 @@ here_error_e HereGeocode::PrepareQuery()
        if (m_pQuery)
                return HERE_ERROR_PERMISSION_DENIED;
 
-       m_pQuery = new GeoCoderQuery();
+       m_pQuery = new (std::nothrow) GeoCoderQuery();
 
        if (!m_pQuery)
                return HERE_ERROR_OUT_OF_MEMORY;
@@ -55,7 +55,7 @@ here_error_e HereGeocode::PreparePreference(maps_preference_h hPref)
                return HERE_ERROR_OUT_OF_MEMORY;
 
        if (!hPref)
-               return HERE_ERROR_INVALID_PARAMETER;
+               return HERE_ERROR_NONE;
 
        int ret;
        char *szLanguage = NULL;
@@ -218,7 +218,7 @@ here_error_e HereGeocode::StartGeocodeByStructuredAddress(const maps_address_h h
 
 void HereGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
 {
-       if (m_bCanceled) // ignore call back if it was cancelled.
+       if (m_bCanceled || !m_pCbFunc) // ignore call back
        {
                delete this;
                return;
@@ -232,7 +232,7 @@ void HereGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
        if (nResults == 0)
        {
                ((maps_service_geocode_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId,
-                       0, 1, NULL, m_pUserData);
+                       0, 0, NULL, m_pUserData);
                delete this;
                return;
        }
@@ -254,7 +254,7 @@ void HereGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
                maps_error_e error = (maps_error_e)maps_coordinates_create(
                                     hereCoord.GetLatitude(), hereCoord.GetLongitude(), &mapsCoord);
 
-               if (m_bCanceled)
+               if (m_bCanceled || !m_pCbFunc)
                {
                        if (mapsCoord) maps_coordinates_destroy(mapsCoord);
                        break;
@@ -275,8 +275,8 @@ void HereGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
 
 void HereGeocode::OnGeoCoderFailure(const GeoCoderReply& Reply)
 {
-       if (!m_bCanceled)
-               ((maps_service_geocode_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 1, NULL, m_pUserData);
+       if (!m_bCanceled && m_pCbFunc)
+               ((maps_service_geocode_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 0, NULL, m_pUserData);
        delete this;
 }
 
index 3840f5b..50c256d 100644 (file)
@@ -69,9 +69,7 @@ bool HereManager::Create()
        bool result = false;
 
        if (!m_pHereManager)
-       {
-               m_pHereManager = new HereManager();
-       }
+               m_pHereManager = new (std::nothrow) HereManager();
 
        pthread_mutex_lock(&g_mtxRef);
        if (m_pHereManager)
@@ -82,7 +80,8 @@ bool HereManager::Create()
        }
        pthread_mutex_unlock(&g_mtxRef);
 
-       m_pHereManager->SetCredentials();
+       if (m_pHereManager)
+               m_pHereManager->SetCredentials();
        return result;
 }
 
@@ -118,23 +117,23 @@ void* HereManager::CreateInstance(HereSvcType nHereSvc, void* pCbFunc,
        switch(nHereSvc)
        {
        case HERE_SVC_GEOCODE:
-               pHere = (HereBase*)new HereGeocode(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereGeocode(pCbFunc, pUserData, *nReqId);
                break;
 
        case HERE_SVC_REV_GEOCODE:
-               pHere = (HereBase*)new HereRevGeocode(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereRevGeocode(pCbFunc, pUserData, *nReqId);
                break;
 
        case HERE_SVC_PLACE:
-               pHere = (HereBase*)new HerePlace(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HerePlace(pCbFunc, pUserData, *nReqId);
                break;
 
        case HERE_SVC_ROUTE:
-               pHere = (HereBase*)new HereRoute(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereRoute(pCbFunc, pUserData, *nReqId);
                break;
 
        case HERE_SVC_MULTI_REV_GEOCODE:
-               pHere = (HereBase*)new HereMultiRevGeocode(pCbFunc, pUserData, *nReqId);
+               pHere = (HereBase*)new (std::nothrow) HereMultiRevGeocode(pCbFunc, pUserData, *nReqId);
                break;
 
        default:
@@ -142,7 +141,8 @@ void* HereManager::CreateInstance(HereSvcType nHereSvc, void* pCbFunc,
        }
 
        pthread_mutex_lock(&m_mtxHereList);
-       m_HereList.push_back(pHere);
+       if (pHere)
+               m_HereList.push_back(pHere);
        pthread_mutex_unlock(&m_mtxHereList);
 
        return pHere;
index 098163d..0159b88 100755 (executable)
@@ -98,7 +98,7 @@ here_error_e HereMultiRevGeocode::StartMultiReverse(maps_item_hashtable_h hPref)
 
 void HereMultiRevGeocode::OnMultiReverseReply(const MultiReverseReply& Reply)
 {
-       if (m_bCanceled) // ignore call back if it was cancelled.
+       if (m_bCanceled || !m_pCbFunc) // ignore call back
        {
                delete this;
                return;
@@ -110,6 +110,7 @@ void HereMultiRevGeocode::OnMultiReverseReply(const MultiReverseReply& Reply)
        maps_address_list_h address_list;
        maps_address_list_create(&address_list);
        maps_address_h pAddr = NULL;
+       String *additionalDataValue = NULL;
 
        for (size_t i = 0; i < (size_t)nResults; i++)
        {
@@ -135,17 +136,26 @@ void HereMultiRevGeocode::OnMultiReverseReply(const MultiReverseReply& Reply)
                                if(!tmpAddr.GetCity().empty())
                                        maps_address_set_city(pAddr, tmpAddr.GetCity().c_str());
 
-                               if(!tmpAddr.GetCounty().empty())
+                               additionalDataValue = (String*)tmpAddr.GetAdditionalDataValue("CountyName");
+                               if (additionalDataValue && !additionalDataValue->empty())
+                                       maps_address_set_county(pAddr, additionalDataValue->c_str());
+                               else if (!tmpAddr.GetCounty().empty())
                                        maps_address_set_county(pAddr, tmpAddr.GetCounty().c_str());
 
-                               if(!tmpAddr.GetState().empty())
+                               additionalDataValue = (String*)tmpAddr.GetAdditionalDataValue("StateName");
+                               if (additionalDataValue && !additionalDataValue->empty())
+                                       maps_address_set_state(pAddr, additionalDataValue->c_str());
+                               else if (!tmpAddr.GetState().empty())
                                        maps_address_set_state(pAddr, tmpAddr.GetState().c_str());
 
-                               if(!tmpAddr.GetCountry().empty())
+                               additionalDataValue = (String*)tmpAddr.GetAdditionalDataValue("CountryName");
+                               if (additionalDataValue && !additionalDataValue->empty())
+                                       maps_address_set_country(pAddr, additionalDataValue->c_str());
+                               else 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.GetCountry().empty())
+                                       maps_address_set_country_code(pAddr, tmpAddr.GetCountry().c_str());
 
                                if(!tmpAddr.GetPostalCode().empty())
                                        maps_address_set_postal_code(pAddr, tmpAddr.GetPostalCode().c_str());
@@ -157,10 +167,14 @@ void HereMultiRevGeocode::OnMultiReverseReply(const MultiReverseReply& Reply)
                maps_address_list_append(address_list, pAddr);
        }
 
-       if (m_bCanceled)
+       if (m_bCanceled || !m_pCbFunc)
        {
                maps_address_list_destroy(address_list);
        }
+       else if (nResults <= 0)
+       {
+               ((maps_service_multi_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId, 0, NULL, m_pUserData);
+       }
        else
        {
                ((maps_service_multi_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NONE, m_nReqId, nResults, address_list, m_pUserData);
@@ -171,7 +185,7 @@ void HereMultiRevGeocode::OnMultiReverseReply(const MultiReverseReply& Reply)
 
 void HereMultiRevGeocode::OnMultiReverseFailure(const MultiReverseReply& Reply)
 {
-       if (!m_bCanceled)
+       if (!m_bCanceled && m_pCbFunc)
                ((maps_service_multi_reverse_geocode_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, NULL, m_pUserData);
        delete this;
 }
index 8883347..51c1a06 100644 (file)
@@ -29,6 +29,7 @@ HerePlace::HerePlace(void *pCbFunc, void *pUserData, int nReqId)
 
        m_nReplyCnt = 0;
        m_nReplyIdx = 0;
+       m_bReplyFlushed = false;
        m_szSortBy = NULL;
        m_bPlaceDetailsInternal = false;
 }
@@ -59,7 +60,7 @@ here_error_e HerePlace::PrepareDiscoveryQuery()
        if (m_pDiscoveryQuery)
                return HERE_ERROR_PERMISSION_DENIED;
 
-        m_pDiscoveryQuery = new DiscoveryQuery();
+        m_pDiscoveryQuery = new (std::nothrow) DiscoveryQuery();
 
        if (!m_pDiscoveryQuery)
                return HERE_ERROR_OUT_OF_MEMORY;
@@ -73,7 +74,7 @@ here_error_e HerePlace::PrepareDiscoveryPreference(maps_preference_h hPref)
                return HERE_ERROR_OUT_OF_MEMORY;
 
        if (!hPref)
-               return HERE_ERROR_INVALID_PARAMETER;
+               return HERE_ERROR_NONE;
 
 
        int ret;
@@ -279,7 +280,7 @@ here_error_e HerePlace::PreparePlaceDetailsQuery()
        if (m_pPlaceDetailsQuery)
                return HERE_ERROR_PERMISSION_DENIED;
 
-       m_pPlaceDetailsQuery = new PlaceDetailsQuery();
+       m_pPlaceDetailsQuery = new (std::nothrow) PlaceDetailsQuery();
 
        if (!m_pPlaceDetailsQuery)
                return HERE_ERROR_OUT_OF_MEMORY;
@@ -293,7 +294,7 @@ here_error_e HerePlace::PreparePlaceDetailsPreference(maps_preference_h hPref)
                return HERE_ERROR_OUT_OF_MEMORY;
 
        if (!hPref)
-               return HERE_ERROR_INVALID_PARAMETER;
+               return HERE_ERROR_NONE;
 
        int ret;
        char *szLanguage = NULL;
@@ -330,6 +331,7 @@ here_error_e HerePlace::StartPlaceDetailsInternal(const char *szUrl)
 
        std::unique_ptr<PlaceDetailsQuery> pPlaceDetailsQuery (new (std::nothrow)PlaceDetailsQuery());
 
+       m_bPlaceDetailsInternal = true;
        bool bExcuted = (int)(pPlaceDetailsQuery->Execute(*this, NULL, szUrl) > 0);
 
        return (bExcuted ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION);
@@ -337,12 +339,6 @@ here_error_e HerePlace::StartPlaceDetailsInternal(const char *szUrl)
 
 void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
 {
-       if (m_bCanceled) /* ignore call back if it was cancelled. */
-       {
-               delete this;
-               return;
-       }
-
        maps_place_h mapsPlace;
        PlaceItemList herePlaceList = Reply.GetPlaceItems();
        PlaceItemList::iterator herePlaceIt;
@@ -357,26 +353,23 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
        int error = MAPS_ERROR_UNKNOWN, sub_error;
        bool is_valid, isPending;
 
-
-       m_nReplyIdx = 0;
-       m_nReplyCnt = herePlaceList.size() + hereSearchList.size();
-
-       if (m_nReplyCnt == 0)
+       if (m_bCanceled || !m_pCbFunc)
        {
-               ((maps_service_search_place_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId,
-                       0, 1, NULL, m_pUserData);
                delete this;
                return;
        }
 
+       m_nReplyIdx = 0;
+       m_nReplyCnt = herePlaceList.size() + hereSearchList.size();
+
        for (herePlaceIt = herePlaceList.begin();
-               herePlaceIt != herePlaceList.end() && !m_bCanceled;
+               herePlaceIt != herePlaceList.end();
                herePlaceIt++)
        {
-               isPending = false;
-
                if ((error = maps_place_create(&mapsPlace)) == MAPS_ERROR_NONE)
                {
+                       isPending = false;
+
                        /* title, uri, id */
                        hereLinkObj = herePlaceIt->GetLinkObject();
 
@@ -469,21 +462,24 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
                                        {
                                                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());
                                        }
                                }
                        }
-               }
 
-               if (!isPending) {
-                       m_nReplyIdx++;
-                       m_PlaceList.push_back(mapsPlace);
+                       if (!isPending) {
+                               m_nReplyIdx++;
+                               m_PlaceList.push_back(mapsPlace);
+                       }
+               }
+               else
+               {
+                       m_nReplyCnt--;
                }
        }
 
        for (hereSearchIt = hereSearchList.begin();
-               hereSearchIt != hereSearchList.end() && !m_bCanceled;
+               hereSearchIt != hereSearchList.end();
                hereSearchIt++)
        {
                error = maps_place_create(&mapsPlace);
@@ -519,16 +515,30 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
                        /* type */
 
                        if (!is_valid)
+                       {
+                               m_nReplyCnt--;
                                error = MAPS_ERROR_NOT_FOUND;
+                               maps_place_destroy(mapsPlace);
+                               mapsPlace = NULL;
+                       }
+                       else
+                       {
+                               m_PlaceList.push_back(mapsPlace);
+                               m_nReplyIdx++;
+                       }
+               }
+               else
+               {
+                       m_nReplyCnt--;
                }
-
-               m_PlaceList.push_back(mapsPlace);
-               m_nReplyIdx++;
        }
 
 
-       if (m_nReplyIdx == m_nReplyCnt)
+       if (!m_bReplyFlushed && (m_nReplyCnt == 0 || m_nReplyIdx == m_nReplyCnt))
        {
+               if (m_nReplyCnt == 0)
+                       error = MAPS_ERROR_NOT_FOUND;
+
                __flushReplies(error);
                delete this;
        }
@@ -536,8 +546,10 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply)
 
 void HerePlace::OnDiscoverFailure(const DiscoveryReply& Reply)
 {
-       if (++m_nReplyIdx == m_nReplyCnt)
+       if (!m_bReplyFlushed)
        {
+               m_nReplyIdx = 0;
+               m_nReplyCnt = 0;
                __flushReplies((maps_error_e)GetErrorCode(Reply));
                delete this;
        }
@@ -545,14 +557,15 @@ void HerePlace::OnDiscoverFailure(const DiscoveryReply& Reply)
 
 void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply)
 {
-       if (m_bCanceled) /* ignore call back if it was cancelled. */
-       {
-               delete this;
-               return;
-       }
-
        if (m_nReplyCnt == 0)
+       {
+               if (m_bCanceled || !m_pCbFunc)
+               {
+                       delete this;
+                       return;
+               }
                m_nReplyCnt = 1;
+       }
 
        PlaceDetails herePlace = Reply.GetPlaceDetails();
        maps_place_h mapsPlace = NULL;
@@ -633,19 +646,30 @@ void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply)
                        ProcessPlaceRatings(herePlace, mapsPlace);
 
                        ProcessPlaceRated(herePlace, mapsPlace);
+
+                       if (!isPending)
+                               m_PlaceList.push_back(mapsPlace);
+
+                       m_nReplyIdx++;
                }
                else
                {
+                       m_nReplyCnt--;
                        error = MAPS_ERROR_NOT_FOUND;
+                       maps_place_destroy(mapsPlace);
+                       mapsPlace = NULL;
                }
        }
+       else
+       {
+               m_nReplyCnt--;
+       }
 
-       if (!isPending)
-               m_PlaceList.push_back(mapsPlace);
-
-
-       if (++m_nReplyIdx == m_nReplyCnt)
+       if (!m_bReplyFlushed && (m_nReplyCnt == 0 || m_nReplyIdx == m_nReplyCnt))
        {
+               if (m_nReplyCnt == 0)
+                       error = MAPS_ERROR_NOT_FOUND;
+
                __flushReplies(error);
                delete this;
        }
@@ -653,10 +677,25 @@ void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply)
 
 void HerePlace::OnPlaceDetailsFailure(const PlaceDetailsReply& Reply)
 {
-       if (++m_nReplyIdx == m_nReplyCnt)
+       if (!m_bPlaceDetailsInternal)
        {
-               __flushReplies(m_bPlaceDetailsInternal ? MAPS_ERROR_NONE : GetErrorCode(Reply));
-               delete this;
+               if (!m_bReplyFlushed)
+               {
+                       m_nReplyIdx = 0;
+                       m_nReplyCnt = 0;
+                       __flushReplies(GetErrorCode(Reply));
+                       delete this;
+               }
+       }
+       else
+       {
+               m_nReplyIdx++;
+               MAPS_LOGD("Internal error during updating detailed information for the place. (%d/%d)", m_nReplyIdx, m_nReplyCnt);
+               if (!m_bReplyFlushed && (m_nReplyIdx == m_nReplyCnt))
+               {
+                       __flushReplies(MAPS_ERROR_NONE);
+                       delete this;
+               }
        }
 }
 
@@ -1175,21 +1214,35 @@ void HerePlace::ProcessPlaceRated(PlaceDetails herePlace, maps_place_h mapsPlace
 void HerePlace::__flushReplies(int error)
 {
        maps_place_h mapsPlace;
+       bool bCallbackCanceled = false;
+       int nReplyIdx = 0;
+
+       if (m_bReplyFlushed || m_bCanceled || !m_pCbFunc) return;
+       m_bReplyFlushed = true;
 
-       m_nReplyIdx = 0;
        __sortList(m_PlaceList);
 
-       while (m_nReplyIdx < m_nReplyCnt && !m_bCanceled && !m_PlaceList.empty())
+       while ((nReplyIdx < m_nReplyCnt) ||
+               (error != MAPS_ERROR_NONE && nReplyIdx == 0 && m_nReplyCnt == 0) /* reply with only error */
+       )
        {
-               mapsPlace = m_PlaceList.front();
-               m_PlaceList.pop_front();
+               mapsPlace = NULL;
+               if (!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)
+               if (m_bCanceled || bCallbackCanceled)
+               {
+                       maps_place_destroy(mapsPlace);
+               }
+               else if (((maps_service_search_place_cb)m_pCbFunc)((maps_error_e)error, m_nReqId,
+                       nReplyIdx, m_nReplyCnt, mapsPlace, m_pUserData) == FALSE)
                {
-                       break;
+                       bCallbackCanceled = true;
                }
+               nReplyIdx++;
        }
 }
 
index 4d1320c..55898a3 100644 (file)
@@ -27,9 +27,6 @@ extern "C"
 
 EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
 {
-       if (!plugin)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginInit(plugin);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -39,9 +36,6 @@ EXPORT_API int maps_plugin_init(maps_plugin_h *plugin)
 
 EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
 {
-       if (!plugin)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginShutdown(plugin);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -51,20 +45,16 @@ EXPORT_API int maps_plugin_shutdown(maps_plugin_h plugin)
 
 EXPORT_API int maps_plugin_get_info(maps_plugin_info_h* info)
 {
-       if (!info)
-               return MAPS_ERROR_INVALID_PARAMETER;
+       int ret = maps_plugin_info_create(info);
 
-       maps_plugin_info_create(info);
-       maps_plugin_info_set_provider_name(*info, "HERE");
+       if (ret == MAPS_ERROR_NONE)
+               ret = maps_plugin_info_set_provider_name(*info, "HERE");
 
-       return MAPS_ERROR_NONE;
+       return ret;
 }
 
 EXPORT_API int maps_plugin_set_provider_key(const char* provider_key)
 {
-       if (!provider_key)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSetProviderKey(provider_key);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -74,9 +64,6 @@ EXPORT_API int maps_plugin_set_provider_key(const char* provider_key)
 
 EXPORT_API int maps_plugin_get_provider_key(char** provider_key)
 {
-       if (!provider_key)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginGetProviderKey(provider_key);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -86,9 +73,6 @@ EXPORT_API int maps_plugin_get_provider_key(char** provider_key)
 
 EXPORT_API int maps_plugin_set_preference(maps_preference_h preference)
 {
-       if (!preference)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSetPreference(preference);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -98,9 +82,6 @@ EXPORT_API int maps_plugin_set_preference(maps_preference_h preference)
 
 EXPORT_API int maps_plugin_get_preference(maps_preference_h* preference)
 {
-       if (!preference)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginGetPreference(preference);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -165,9 +146,6 @@ EXPORT_API int maps_plugin_is_data_supported(maps_service_data_e service, bool *
 EXPORT_API int maps_plugin_geocode(const char* address, const maps_preference_h preference,
        maps_service_geocode_cb callback, void *user_data, int* request_id)
 {
-       if (!address || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginGeocode(address, preference, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -179,9 +157,6 @@ EXPORT_API int maps_plugin_geocode_inside_area(const char* address, const maps_a
        const maps_preference_h preference, maps_service_geocode_cb callback,
        void* user_data, int* request_id)
 {
-       if (!bounds || !address || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginGeocodeInsideArea(address, bounds, preference, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -193,9 +168,6 @@ EXPORT_API int maps_plugin_geocode_by_structured_address(const maps_address_h ad
        const maps_preference_h preference, maps_service_geocode_cb callback,
        void *user_data, int* request_id)
 {
-       if (!address || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginGeocodeByStructuredAddress(address, preference, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -207,9 +179,6 @@ EXPORT_API int maps_plugin_reverse_geocode(double latitude, double longitude,
        const maps_preference_h preference, maps_service_reverse_geocode_cb callback,
        void *user_data, int* request_id)
 {
-       if (!callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginReverseGeocode(latitude, longitude, preference, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -221,9 +190,6 @@ EXPORT_API int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h g
        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);
@@ -235,9 +201,6 @@ EXPORT_API int maps_plugin_search_place(const maps_coordinates_h position, int d
        const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
        void* user_data, int* request_id)
 {
-       if (!position || !filter || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSearchPlace(position, distance, preference, filter, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -249,9 +212,6 @@ EXPORT_API int maps_plugin_search_place_by_area(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)
 {
-       if (!boundary || !filter || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSearchPlaceByArea(boundary, preference, filter, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -263,9 +223,6 @@ EXPORT_API int maps_plugin_search_place_by_address(const char* address, const ma
        const maps_place_filter_h filter, maps_preference_h preference, maps_service_search_place_cb callback,
        void* user_data, int* request_id)
 {
-       if (!address || !boundary || !filter || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSearchPlaceByAddress(address, boundary, preference, filter, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -277,9 +234,6 @@ EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin, const m
        maps_preference_h preference, maps_service_search_route_cb callback,
        void* user_data, int* request_id)
 {
-       if (!origin || !destination || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSearchRoute(origin, destination, preference, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -291,9 +245,6 @@ EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h* wayp
        maps_preference_h preference, maps_service_search_route_cb callback,
        void* user_data, int* request_id)
 {
-       if (!waypoint_list || waypoint_num <= 0 || !callback || !request_id)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginSearchRouteWaypoints(waypoint_list, waypoint_num, preference, callback, user_data, request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
@@ -303,9 +254,6 @@ EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h* wayp
 
 EXPORT_API int maps_plugin_cancel_request(int request_id)
 {
-       if (request_id < 0)
-               return MAPS_ERROR_INVALID_PARAMETER;
-
        int ret = HerePluginCancelRequest(request_id);
 
        MAPS_LOGD("here_error_e = %d", ret);
index 914108e..b32dd59 100644 (file)
@@ -41,7 +41,7 @@ here_error_e HereRevGeocode::PrepareQuery()
        if (m_pQuery)
                return HERE_ERROR_PERMISSION_DENIED;
 
-       m_pQuery = new ReverseGeoCoderQuery();
+       m_pQuery = new (std::nothrow) ReverseGeoCoderQuery();
 
        if (!m_pQuery)
                return HERE_ERROR_OUT_OF_MEMORY;
@@ -55,7 +55,7 @@ here_error_e HereRevGeocode::PreparePreference(maps_preference_h hPref)
                return HERE_ERROR_OUT_OF_MEMORY;
 
        if (!hPref)
-               return HERE_ERROR_INVALID_PARAMETER;
+               return HERE_ERROR_NONE;
 
        int ret;
        char *szLanguage;
@@ -99,7 +99,7 @@ here_error_e HereRevGeocode::StartRevGeocode(maps_item_hashtable_h hPref)
 
 void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
 {
-       if (m_bCanceled) // ignore call back if it was cancelled.
+       if (m_bCanceled || !m_pCbFunc) // ignore call back
        {
                delete this;
                return;
@@ -131,13 +131,14 @@ void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
        if (nShortestIdx < 0)
        {
                ((maps_service_reverse_geocode_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND,
-                       m_nReqId, 0, 1, NULL, m_pUserData);
+                       m_nReqId, 0, 0, NULL, m_pUserData);
                delete this;
                return;
        }
 
        maps_address_h hAddr = NULL;
        maps_error_e error = (maps_error_e)maps_address_create(&hAddr);
+       String *additionalDataValue = NULL;
 
        if(error == MAPS_ERROR_NONE)
        {
@@ -147,34 +148,43 @@ void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
                {
                        Address tmpAddr = (pResult->GetLocation()).GetAddress();
 
-                       if(!tmpAddr.GetHouseNumber().empty())
+                       if (!tmpAddr.GetHouseNumber().empty())
                                maps_address_set_building_number(hAddr, tmpAddr.GetHouseNumber().c_str());
 
-                       if(!tmpAddr.GetStreet().empty())
+                       if (!tmpAddr.GetStreet().empty())
                                maps_address_set_street(hAddr, tmpAddr.GetStreet().c_str());
 
-                       if(!tmpAddr.GetDistrict().empty())
+                       if (!tmpAddr.GetDistrict().empty())
                                maps_address_set_district(hAddr, tmpAddr.GetDistrict().c_str());
 
-                       if(!tmpAddr.GetCity().empty())
+                       if (!tmpAddr.GetCity().empty())
                                maps_address_set_city(hAddr, tmpAddr.GetCity().c_str());
 
-                       if(!tmpAddr.GetCounty().empty())
+                       additionalDataValue = (String*)tmpAddr.GetAdditionalDataValue("CountyName");
+                       if (additionalDataValue && !additionalDataValue->empty())
+                               maps_address_set_county(hAddr, additionalDataValue->c_str());
+                       else if (!tmpAddr.GetCounty().empty())
                                maps_address_set_county(hAddr, tmpAddr.GetCounty().c_str());
 
-                       if(!tmpAddr.GetState().empty())
+                       additionalDataValue = (String*)tmpAddr.GetAdditionalDataValue("StateName");
+                       if (additionalDataValue && !additionalDataValue->empty())
+                               maps_address_set_state(hAddr, additionalDataValue->c_str());
+                       else if (!tmpAddr.GetState().empty())
                                maps_address_set_state(hAddr, tmpAddr.GetState().c_str());
 
-                       if(!tmpAddr.GetCountry().empty())
+                       additionalDataValue = (String*)tmpAddr.GetAdditionalDataValue("CountryName");
+                       if (additionalDataValue && !additionalDataValue->empty())
+                               maps_address_set_country(hAddr, additionalDataValue->c_str());
+                       else if (!tmpAddr.GetCountry().empty())
                                maps_address_set_country(hAddr, tmpAddr.GetCountry().c_str());
 
-                       if(!tmpAddr.GetCountryCode().empty())
-                               maps_address_set_country_code(hAddr, tmpAddr.GetCountryCode().c_str());
+                       if (!tmpAddr.GetCountry().empty())
+                               maps_address_set_country_code(hAddr, tmpAddr.GetCountry().c_str());
 
-                       if(!tmpAddr.GetPostalCode().empty())
+                       if (!tmpAddr.GetPostalCode().empty())
                                maps_address_set_postal_code(hAddr, tmpAddr.GetPostalCode().c_str());
 
-                       if(!tmpAddr.GetLabel().empty())
+                       if (!tmpAddr.GetLabel().empty())
                                maps_address_set_freetext(hAddr, tmpAddr.GetLabel().c_str());
                }
        }
@@ -185,7 +195,8 @@ void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
        }
        else
        {
-               ((maps_service_reverse_geocode_cb)m_pCbFunc)(error, m_nReqId, 0, 1, hAddr, m_pUserData);
+               int nResult = (error == MAPS_ERROR_NONE ? 1 : 0);
+               ((maps_service_reverse_geocode_cb)m_pCbFunc)(error, m_nReqId, 0, nResult, hAddr, m_pUserData);
        }
 
        delete this;
@@ -193,8 +204,8 @@ void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply)
 
 void HereRevGeocode::OnGeoCoderFailure(const GeoCoderReply& Reply)
 {
-       if (!m_bCanceled)
-               ((maps_service_reverse_geocode_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 1, NULL, m_pUserData);
+       if (!m_bCanceled && m_pCbFunc)
+               ((maps_service_reverse_geocode_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 0, NULL, m_pUserData);
        delete this;
 }
 
index a8eb95e..cdb2e0d 100644 (file)
@@ -42,7 +42,7 @@ here_error_e HereRoute::PrepareQuery()
                return HERE_ERROR_PERMISSION_DENIED;
 
        GeoCoordinates origCoord, destCoord;
-       m_pQuery = new GeoRouteQuery(origCoord, destCoord);
+       m_pQuery = new (std::nothrow) GeoRouteQuery(origCoord, destCoord);
 
        if (!m_pQuery)
                return HERE_ERROR_OUT_OF_MEMORY;
@@ -107,7 +107,7 @@ here_error_e HereRoute::PreparePreference(maps_preference_h hPref)
                return HERE_ERROR_OUT_OF_MEMORY;
 
        if (!hPref)
-               return HERE_ERROR_INVALID_PARAMETER;
+               return HERE_ERROR_NONE;
 
 /*
        SegmentDetail aSegmentDetail;
@@ -196,7 +196,7 @@ here_error_e HereRoute::StartRoute(void)
 
 void HereRoute::OnRouteReply(const GeoRouteReply& Reply)
 {
-       if (m_bCanceled) // ignore call back if it was cancelled.
+       if (m_bCanceled || !m_pCbFunc) // ignore call back if it was cancelled.
        {
                delete this;
                return;
@@ -211,7 +211,7 @@ void HereRoute::OnRouteReply(const GeoRouteReply& Reply)
        if (nReplyNum == 0)
        {
                ((maps_service_search_route_cb)m_pCbFunc)(MAPS_ERROR_NOT_FOUND, m_nReqId,
-                       0, 1, NULL, m_pUserData);
+                       0, 0, NULL, m_pUserData);
                delete this;
                return;
        }
@@ -307,8 +307,8 @@ void HereRoute::OnRouteReply(const GeoRouteReply& Reply)
 
 void HereRoute::OnRouteFailure(const GeoRouteReply& Reply)
 {
-       if (!m_bCanceled)
-               ((maps_service_search_route_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 1, NULL, m_pUserData);
+       if (!m_bCanceled && m_pCbFunc)
+               ((maps_service_search_route_cb)m_pCbFunc)((maps_error_e)GetErrorCode(Reply), m_nReqId, 0, 0, NULL, m_pUserData);
        delete this;
 }