2.Fixed to get the result data correctly from reverse geocoder replier.
Change-Id: I9e7b3e49bb12f2340685ba719069e4b0815512cf
#include "geocoder/GeoCoderQueryBase.h"
-HERE_MAPS_BEGIN_NAMESPACE
+TIZEN_MAPS_BEGIN_NAMESPACE
class MultiReverseReply;
-class GeoCoordinates;
class MultiReverseQueryListener;
/**
*
* @ingroup geocoding
*/
-class EXPORT_API MultiReverseQuery : public GeoCoderQueryBase
+class EXPORT_API MultiReverseQuery : public Here::Maps::GeoCoderQueryBase
{
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
* @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.
*
* @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
*/
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
*
* @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
*/
String CreateUri() const;
-#ifdef TIZEN_MIGRATION_TO_SUPPORT_POST_METHOD
+#ifdef TIZEN_SUPPORT_POST_METHOD
/**
* This method creates the URI for the request.
*
MultiReverseQueryImpl* m_pImpl;
};
-HERE_MAPS_END_NAMESPACE
+TIZEN_MAPS_END_NAMESPACE
#endif
#define MULTIREVERSEQUERYLISTENER_H
#include "common/HereMaps_global.h"
-
#include "common/QueryListener.h"
-HERE_MAPS_BEGIN_NAMESPACE
+TIZEN_MAPS_BEGIN_NAMESPACE
class MultiReverseReply;
*
* @ingroup geocoding
*/
-class EXPORT_API MultiReverseQueryListener : public QueryListener
+class EXPORT_API MultiReverseQueryListener : public Here::Maps::QueryListener
{
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
#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.
*
* @ingroup geocoding
*/
-class EXPORT_API MultiReverseReply : public BaseReply
+class EXPORT_API MultiReverseReply : public Here::Maps::BaseReply
{
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);
MultiReverseReplyImpl* m_pImpl;
};
-HERE_MAPS_END_NAMESPACE
+TIZEN_MAPS_END_NAMESPACE
#endif /* MULTIREVERSEREPLY_H_ */
, 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()
HERE_PLUGIN_BEGIN_NAMESPACE
using namespace HERE_MAPS_NAMESPACE_PREFIX;
+using namespace TIZEN_MAPS_NAMESPACE_PREFIX;
class HereMultiRevGeocode
: public HereBase
PlaceDetailsQuery* m_pPlaceDetailsQuery;
int m_nReplyCnt;
int m_nReplyIdx;
+ bool m_bReplyFlushed;
char *m_szSortBy;
bool m_bPlaceDetailsInternal;
+[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
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
%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
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
#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;
int HerePluginShutdown(maps_plugin_h hPlugin)
{
- if (!hPlugin)
- return HERE_ERROR_INVALID_PARAMETER;
-
if (HereManager::GetHandler())
HereManager::GetHandler()->Close();
if (error != HERE_ERROR_NONE) break;
error = pGeocode->PreparePreference(hPref);
+ if (error != HERE_ERROR_NONE) break;
error = pGeocode->StartGeocode(szAddr);
} while(0);
if (error != HERE_ERROR_NONE) break;
error = pGeocode->PreparePreference(hPref);
+ if (error != HERE_ERROR_NONE) break;
error = pGeocode->StartGeocodeByStructuredAddress(hAddr);
} while(0);
if (error != HERE_ERROR_NONE) break;
error = pGeocode->PreparePreference(hPref);
+ if (error != HERE_ERROR_NONE) break;
error = pGeocode->StartGeocodeInsideArea(szAddr, hArea);
} while(0);
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;
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;
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;
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;
if (error != HERE_ERROR_NONE) break;
error = pPlace->PreparePlaceDetailsPreference(hPref);
+ if (error != HERE_ERROR_NONE) break;
error = pPlace->StartPlaceDetails(szUrl);
} while(0);
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;
if (error != HERE_ERROR_NONE) break;
error = pRoute->PreparePreference(hPref);
+ if (error != HERE_ERROR_NONE) break;
error = pRoute->StartRoute();
} while(0);
m_nRestReqId = 0;
m_bCanceled = 0;
m_nReqId = 0;
+
+ m_pCbFunc = NULL;
+ m_pUserData = NULL;
}
HereBase::~HereBase()
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;
return HERE_ERROR_OUT_OF_MEMORY;
if (!hPref)
- return HERE_ERROR_INVALID_PARAMETER;
+ return HERE_ERROR_NONE;
int ret;
char *szLanguage = NULL;
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;
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;
}
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;
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;
}
bool result = false;
if (!m_pHereManager)
- {
- m_pHereManager = new HereManager();
- }
+ m_pHereManager = new (std::nothrow) HereManager();
pthread_mutex_lock(&g_mtxRef);
if (m_pHereManager)
}
pthread_mutex_unlock(&g_mtxRef);
- m_pHereManager->SetCredentials();
+ if (m_pHereManager)
+ m_pHereManager->SetCredentials();
return result;
}
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:
}
pthread_mutex_lock(&m_mtxHereList);
- m_HereList.push_back(pHere);
+ if (pHere)
+ m_HereList.push_back(pHere);
pthread_mutex_unlock(&m_mtxHereList);
return pHere;
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;
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++)
{
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());
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);
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;
}
m_nReplyCnt = 0;
m_nReplyIdx = 0;
+ m_bReplyFlushed = false;
m_szSortBy = NULL;
m_bPlaceDetailsInternal = false;
}
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;
return HERE_ERROR_OUT_OF_MEMORY;
if (!hPref)
- return HERE_ERROR_INVALID_PARAMETER;
+ return HERE_ERROR_NONE;
int ret;
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;
return HERE_ERROR_OUT_OF_MEMORY;
if (!hPref)
- return HERE_ERROR_INVALID_PARAMETER;
+ return HERE_ERROR_NONE;
int ret;
char *szLanguage = NULL;
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);
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;
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();
{
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);
/* 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;
}
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;
}
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;
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;
}
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;
+ }
}
}
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++;
}
}
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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;
return HERE_ERROR_OUT_OF_MEMORY;
if (!hPref)
- return HERE_ERROR_INVALID_PARAMETER;
+ return HERE_ERROR_NONE;
int ret;
char *szLanguage;
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;
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)
{
{
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());
}
}
}
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;
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;
}
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;
return HERE_ERROR_OUT_OF_MEMORY;
if (!hPref)
- return HERE_ERROR_INVALID_PARAMETER;
+ return HERE_ERROR_NONE;
/*
SegmentDetail aSegmentDetail;
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;
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;
}
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;
}