diff options
author | Jaekyu Park <jk7744.park@samsung.com> | 2016-05-27 16:51:44 +0900 |
---|---|---|
committer | Jaekyu Park <jk7744.park@samsung.com> | 2016-05-27 16:51:44 +0900 |
commit | e178c66efb6aa96b509a921e72940ed011af0a0c (patch) | |
tree | 093d904cdd340a17687507a1d14b5264ad167665 | |
parent | 648a8bfa60cb93feb9941fde159f58ab5594b64d (diff) | |
download | maps-plugin-here-accepted/tizen_2.4_mobile.tar.gz maps-plugin-here-accepted/tizen_2.4_mobile.tar.bz2 maps-plugin-here-accepted/tizen_2.4_mobile.zip |
Tizen 2.4 SDK Rev6 Releasesubmit/tizen_2.4/20160530.023247accepted/tizen/2.4/mobile/20160530.220547tizen_2.4accepted/tizen_2.4_mobile
-rw-r--r-- | heremaps-uc/src/heremaps-uc.c | 9 | ||||
-rw-r--r-- | maps-plugin-here.changes | 15 | ||||
-rwxr-xr-x | packaging/maps-plugin-here.spec | 8 | ||||
-rwxr-xr-x | src/here/here_api.cpp | 36 | ||||
-rwxr-xr-x | src/here/here_geocode.cpp | 8 | ||||
-rwxr-xr-x | src/here/here_manager.cpp | 13 | ||||
-rwxr-xr-x | src/here/here_manager.h | 2 | ||||
-rwxr-xr-x | src/here/here_place.cpp | 237 | ||||
-rwxr-xr-x | src/here/here_place.h | 10 | ||||
-rwxr-xr-x | src/here/here_revgeocode.cpp | 41 | ||||
-rwxr-xr-x | src/here/here_route.cpp | 44 | ||||
-rwxr-xr-x | src/here/here_route.h | 2 | ||||
-rwxr-xr-x | src/here/here_utils.cpp | 24 | ||||
-rwxr-xr-x | src/here/here_utils.h | 5 | ||||
-rwxr-xr-x | src/here_plugin.cpp | 57 |
15 files changed, 292 insertions, 219 deletions
diff --git a/heremaps-uc/src/heremaps-uc.c b/heremaps-uc/src/heremaps-uc.c index c40accf..2621092 100644 --- a/heremaps-uc/src/heremaps-uc.c +++ b/heremaps-uc/src/heremaps-uc.c @@ -75,8 +75,13 @@ static void read_file(heremaps_uc_app_data *ad) ret = fread(buf, 15, 1, fp); fclose(fp); - data = strtok_r(buf, "=", &save_token); - data = strtok_r(NULL, "=", &save_token); + if (ret > 0) + { + data = strtok_r(buf, "=", &save_token); + data = strtok_r(NULL, "=", &save_token); + } + else + LS_LOGE("UC_FILE read fail"); } app_control_create(&reply); diff --git a/maps-plugin-here.changes b/maps-plugin-here.changes index 3890871..d3f81fb 100644 --- a/maps-plugin-here.changes +++ b/maps-plugin-here.changes @@ -1,3 +1,18 @@ +[Version] maps-plugin-here_0.1.9 +[Date] 19 Apr 2016 +[Title] Support realtime traffic preference. +[Developer] Seechan Kim <cbible.kim@samsung.com> + +[Version] maps-plugin-here_0.1.8 +[Date] 12 Jan 2016 +[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.7 +[Date] 18 Dec 2015 +[Title] Support HERE User consent +[Developer] Jongmun Woo <jongmun.woo@samsung.com> + [Version] maps-plugin-here_0.1.6 [Date] 10 Nov 2015 [Title] Fixed to manage dropped requests of PlaceDetails diff --git a/packaging/maps-plugin-here.spec b/packaging/maps-plugin-here.spec index 3da1b69..5efb22d 100755 --- a/packaging/maps-plugin-here.spec +++ b/packaging/maps-plugin-here.spec @@ -1,7 +1,7 @@ Name: maps-plugin-here Summary: Tizen HERE Maps Plug-in Library -Version: 0.1.7 -Release: 2 +Version: 0.1.9 +Release: 1 Group: Location/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz @@ -30,7 +30,7 @@ Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig %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 @@ -70,7 +70,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 diff --git a/src/here/here_api.cpp b/src/here/here_api.cpp index 9de2ef9..df5591a 100755 --- a/src/here/here_api.cpp +++ b/src/here/here_api.cpp @@ -26,9 +26,6 @@ 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; @@ -45,9 +42,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(); @@ -62,9 +56,7 @@ int HerePluginSetProviderKey(const char* szKey) if (!HereManager::GetHandler()) return HERE_ERROR_INVALID_OPERATION; - here_error_e error = HereManager::GetHandler()->SetCredentials(szKey); - - return error; + return HereManager::GetHandler()->SetCredentials(szKey); } int HerePluginGetProviderKey(char** szKey) @@ -75,9 +67,7 @@ int HerePluginGetProviderKey(char** szKey) if (!HereManager::GetHandler()) return HERE_ERROR_INVALID_OPERATION; - here_error_e error = HereManager::GetHandler()->GetCredentials(szKey); - - return error; + return HereManager::GetHandler()->GetCredentials(szKey); } int HerePluginSetPreference(maps_preference_h hPref) @@ -88,9 +78,7 @@ int HerePluginSetPreference(maps_preference_h hPref) if (!HereManager::GetHandler()) return HERE_ERROR_INVALID_OPERATION; - here_error_e error = HereManager::GetHandler()->SetPreference(hPref); - - return error; + return HereManager::GetHandler()->SetPreference(hPref); } int HerePluginGetPreference(maps_preference_h *hPref) @@ -101,9 +89,7 @@ int HerePluginGetPreference(maps_preference_h *hPref) if (!HereManager::GetHandler()) return HERE_ERROR_INVALID_OPERATION; - here_error_e error = HereManager::GetHandler()->GetPreference(hPref); - - return error; + return HereManager::GetHandler()->GetPreference(hPref); } int HerePluginGeocode(const char* szAddr, @@ -133,6 +119,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); @@ -171,6 +158,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); @@ -212,6 +200,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); @@ -253,6 +242,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; @@ -297,6 +287,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; @@ -341,11 +332,12 @@ 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; - error = pPlace->StartDiscoveryPlaceByArea(hArea); + error = pPlace->StartDiscoveryPlace(hArea); } while(0); /* finishing task */ @@ -385,11 +377,12 @@ 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; - error = pPlace->StartDiscoveryPlaceByAddress(szAddr, hArea); + error = pPlace->StartDiscoveryPlace(hArea, szAddr); } while(0); /* finishing task */ @@ -426,6 +419,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); @@ -468,6 +462,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; @@ -518,6 +513,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); diff --git a/src/here/here_geocode.cpp b/src/here/here_geocode.cpp index 22f7c65..80f11b5 100755 --- a/src/here/here_geocode.cpp +++ b/src/here/here_geocode.cpp @@ -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; @@ -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,7 +275,7 @@ void HereGeocode::OnGeoCoderReply(const GeoCoderReply& Reply) void HereGeocode::OnGeoCoderFailure(const GeoCoderReply& Reply) { - if (!m_bCanceled) + 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; } diff --git a/src/here/here_manager.cpp b/src/here/here_manager.cpp index 28178ce..913150c 100755 --- a/src/here/here_manager.cpp +++ b/src/here/here_manager.cpp @@ -111,24 +111,25 @@ void* HereManager::CreateInstance(HereSvcType nHereSvc, void* pCbFunc, { HereBase *pHere = NULL; - *nReqId = m_nNextReqId++; + int reqId = m_nNextReqId++; + if (nReqId) *nReqId = reqId; switch(nHereSvc) { case HERE_SVC_GEOCODE: - pHere = (HereBase*)new (std::nothrow) HereGeocode(pCbFunc, pUserData, *nReqId); + pHere = (HereBase*)new (std::nothrow) HereGeocode(pCbFunc, pUserData, reqId); break; case HERE_SVC_REV_GEOCODE: - pHere = (HereBase*)new (std::nothrow) HereRevGeocode(pCbFunc, pUserData, *nReqId); + pHere = (HereBase*)new (std::nothrow) HereRevGeocode(pCbFunc, pUserData, reqId); break; case HERE_SVC_PLACE: - pHere = (HereBase*)new (std::nothrow) HerePlace(pCbFunc, pUserData, *nReqId); - break; + pHere = (HereBase*)new (std::nothrow) HerePlace(pCbFunc, pUserData, reqId); + break; case HERE_SVC_ROUTE: - pHere = (HereBase*)new (std::nothrow) HereRoute(pCbFunc, pUserData, *nReqId); + pHere = (HereBase*)new (std::nothrow) HereRoute(pCbFunc, pUserData, reqId); break; default: diff --git a/src/here/here_manager.h b/src/here/here_manager.h index c73cdfd..8891dfa 100755 --- a/src/here/here_manager.h +++ b/src/here/here_manager.h @@ -69,7 +69,7 @@ public: HERE_SVC_ROUTE }; - void* CreateInstance(HereSvcType nHereSvc, void* pCbFunc, void* pUserData, int *nReqId); + void* CreateInstance(HereSvcType nHereSvc, void* pCbFunc = NULL, void* pUserData = NULL, int *nReqId = NULL); here_error_e CloseInstance(int nReqId); here_error_e CancelInstance(int nReqId); here_error_e SetCredentials(const char* provider_key); diff --git a/src/here/here_place.cpp b/src/here/here_place.cpp index b42cb5f..e0b859f 100755 --- a/src/here/here_place.cpp +++ b/src/here/here_place.cpp @@ -32,6 +32,7 @@ HerePlace::HerePlace(void *pCbFunc, void *pUserData, int nReqId) m_bReplyFlushed = false; m_szSortBy = NULL; m_bPlaceDetailsInternal = false; + m_eDistanceUnit = MAPS_DISTANCE_UNIT_M; } HerePlace::~HerePlace() @@ -74,7 +75,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; @@ -89,6 +90,11 @@ here_error_e HerePlace::PrepareDiscoveryPreference(maps_preference_h hPref) if (ret == MAPS_ERROR_NONE) m_pDiscoveryQuery->SetMaxResults((size_t)nMaxResults); + maps_distance_unit_e eUnit; + ret = maps_preference_get_distance_unit(hPref, &eUnit); + if (ret == MAPS_ERROR_NONE) + m_eDistanceUnit = eUnit; + char *szSortBy; ret = maps_preference_get(hPref, MAPS_PLACE_FILTER_SORT_BY, &szSortBy); if (ret == MAPS_ERROR_NONE) @@ -125,13 +131,16 @@ here_error_e HerePlace::PrepareDiscoveryFilter(maps_place_filter_h hFilter) ret = maps_place_category_get_id(mapsCate, &szId); if (ret == MAPS_ERROR_NONE && szId && *szId) - { hereCate.SetCategoryId(CategoryId(szId)); - hereCateList.push_back(hereCate); - m_pDiscoveryQuery->SetCategoriesFilter(hereCateList); + else if (hereCate.GetTitle().size() > 0) + { + hereCate.SetCategoryId(CategoryId(hereCate.GetTitle())); + hereCate.SetTitle(""); } g_free(szId); + hereCateList.push_back(hereCate); + m_pDiscoveryQuery->SetCategoriesFilter(hereCateList); maps_place_category_destroy(mapsCate); } @@ -141,135 +150,144 @@ here_error_e HerePlace::PrepareDiscoveryFilter(maps_place_filter_h hFilter) m_pDiscoveryQuery->SetSearchText(szName); g_free(szName); + char *szKeyword = NULL; + ret = maps_place_filter_get_keyword(hFilter, &szKeyword); + if (ret == MAPS_ERROR_NONE && szKeyword && *szKeyword) + { + String szSearchText = m_pDiscoveryQuery->GetSearchText(); + if (szSearchText.size() > 0) szSearchText += " "; + szSearchText += szKeyword; + m_pDiscoveryQuery->SetSearchText(szSearchText); + } + g_free(szKeyword); + return HERE_ERROR_NONE; } here_error_e HerePlace::StartDiscoveryPlace(maps_coordinates_h hCoord, int nDistance) { + if (!hCoord || nDistance < 0) + return HERE_ERROR_INVALID_PARAMETER; + + int meters = (int)(HereUtils::ConvertDistance(nDistance, m_eDistanceUnit, MAPS_DISTANCE_UNIT_M) + 0.5); + maps_area_h area = NULL; + maps_area_create_circle(hCoord, meters, &area); + here_error_e error = StartDiscoveryPlace(area); + maps_area_destroy(area); + return error; +} + +here_error_e HerePlace::StartDiscoveryPlace(maps_area_h hArea, const char *szAddr) +{ + if (!hArea) + return HERE_ERROR_INVALID_PARAMETER; + if (!m_pDiscoveryQuery) return HERE_ERROR_OUT_OF_MEMORY; - if (!hCoord) - return HERE_ERROR_INVALID_PARAMETER; - if (m_pDiscoveryQuery->GetSearchText().empty()) - { - m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_EXPLORE); + typedef enum { + PLACE_CMD_TEXT, + PLACE_CMD_CENTER, + PLACE_CMD_AREA, + } PlaceCmdType; - double dLat, dLon; - maps_coordinates_get_latitude(hCoord, &dLat); - maps_coordinates_get_longitude(hCoord, &dLon); - GeoCoordinates geoCoord(dLat, dLon); + PlaceCmdType cmdType; + maps_area_s *pArea = (maps_area_s*)hArea; + GeoCoordinates geoCoord; + GeoBoundingArea *geoArea = NULL; + GeoBoundingBox geoBox; + GeoBoundingCircle geoCircle; - if (nDistance > 0) - { - GeoBoundingCircle geoCircle(geoCoord, nDistance); - m_pDiscoveryQuery->SetArea(geoCircle); - } - else if (nDistance == 0) - { - m_pDiscoveryQuery->SetProximity(geoCoord); - } - else - return HERE_ERROR_INVALID_PARAMETER; - m_nRestReqId = m_pDiscoveryQuery->Execute(*this, NULL); + /* Merge search text with other search text being in preference */ + String szSearchText = (szAddr ? szAddr : ""); + if (m_pDiscoveryQuery->GetSearchText().size() > 0) + { + if (szSearchText.size() > 0) szSearchText += " "; + szSearchText += m_pDiscoveryQuery->GetSearchText(); + } + m_pDiscoveryQuery->SetSearchText(szSearchText); + - return (m_nRestReqId > 0 ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION); + /* Decide command type */ + if (!szSearchText.empty()) + { + cmdType = PLACE_CMD_TEXT; + } + else if (pArea->type == MAPS_AREA_CIRCLE && pArea->circle.radius == 0) + { + cmdType = PLACE_CMD_CENTER; } else { - here_error_e error; - maps_area_h hArea = NULL; - maps_area_create_circle(hCoord, nDistance, &hArea); - error = StartDiscoveryPlaceByAddress(m_pDiscoveryQuery->GetSearchText().data(), hArea); - maps_area_destroy(hArea); - return error; + cmdType = PLACE_CMD_AREA; } -} -here_error_e HerePlace::StartDiscoveryPlaceByArea(maps_area_h hArea) -{ - if (!m_pDiscoveryQuery) - return HERE_ERROR_OUT_OF_MEMORY; - - if (!hArea) - return HERE_ERROR_INVALID_PARAMETER; - - if (m_pDiscoveryQuery->GetSearchText().empty()) + /* Get proximity with area */ + if (cmdType == PLACE_CMD_TEXT || cmdType == PLACE_CMD_CENTER) { - m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_EXPLORE); - - maps_area_s *pArea = (maps_area_s*)hArea; if (pArea->type == MAPS_AREA_RECTANGLE) { - GeoBoundingBox box(pArea->rect.top_left.longitude, pArea->rect.bottom_right.longitude, - pArea->rect.bottom_right.latitude, pArea->rect.top_left.latitude); - m_pDiscoveryQuery->SetArea(box); + double dLat1 = pArea->rect.top_left.latitude; + double dLng1 = pArea->rect.top_left.longitude; + double dLat2 = pArea->rect.bottom_right.latitude; + double dLng2 = pArea->rect.bottom_right.longitude; + double dLat = (dLat1 + dLat2) / 2; + double dLng = (dLng1 + dLng2) / 2; + + geoCoord.SetLatitude(dLat); + geoCoord.SetLongitude(dLng); } - else if (pArea->type == MAPS_AREA_CIRCLE) + else if(pArea->type == MAPS_AREA_CIRCLE) { - GeoCoordinates coord(pArea->circle.center.latitude, pArea->circle.center.longitude); - GeoBoundingCircle circle(coord, pArea->circle.radius); - m_pDiscoveryQuery->SetArea(circle); + double dLat = pArea->circle.center.latitude; + double dLng = pArea->circle.center.longitude; + + geoCoord.SetLatitude(dLat); + geoCoord.SetLongitude(dLng); } else return HERE_ERROR_INVALID_PARAMETER; - - - m_nRestReqId = m_pDiscoveryQuery->Execute(*this, NULL); - - return (m_nRestReqId > 0 ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION); } - else + else if (cmdType == PLACE_CMD_AREA) { - return StartDiscoveryPlaceByAddress(m_pDiscoveryQuery->GetSearchText().data(), hArea); + if (pArea->type == MAPS_AREA_RECTANGLE) + { + HereUtils::Convert(hArea, geoBox); + geoArea = &geoBox; + } + else if (pArea->type == MAPS_AREA_CIRCLE) + { + HereUtils::Convert(hArea, geoCircle); + geoArea = &geoCircle; + } + else + return HERE_ERROR_INVALID_PARAMETER; } -} - -here_error_e HerePlace::StartDiscoveryPlaceByAddress(const char *szAddr, maps_area_h hArea) -{ - if (!m_pDiscoveryQuery) - return HERE_ERROR_OUT_OF_MEMORY; - if (!szAddr || (szAddr && strlen(szAddr) <= 0) || !hArea) - return HERE_ERROR_INVALID_PARAMETER; - - m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_SEARCH); - - String szSearchText = szAddr; - if (m_pDiscoveryQuery->GetSearchText().size() > 0 && - szSearchText != m_pDiscoveryQuery->GetSearchText()) + /* Set properties */ + if (cmdType == PLACE_CMD_TEXT) { - szSearchText += " " + m_pDiscoveryQuery->GetSearchText(); + m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_SEARCH); + m_pDiscoveryQuery->SetProximity(geoCoord); } - m_pDiscoveryQuery->SetSearchText(szSearchText); - - maps_area_s *pArea = (maps_area_s*)hArea; - if (pArea->type == MAPS_AREA_RECTANGLE) + else if (cmdType == PLACE_CMD_CENTER) { - double dLat1 = pArea->rect.top_left.latitude; - double dLng1 = pArea->rect.top_left.longitude; - double dLat2 = pArea->rect.bottom_right.latitude; - double dLng2 = pArea->rect.bottom_right.longitude; - double dLat = (dLat1 + dLat2) / 2; - double dLng = (dLng1 + dLng2) / 2; - - GeoCoordinates geoCoord(dLat, dLng); + m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_EXPLORE); m_pDiscoveryQuery->SetProximity(geoCoord); } - else if(pArea->type == MAPS_AREA_CIRCLE) + else { - double dLat = pArea->circle.center.latitude; - double dLng = pArea->circle.center.longitude; - GeoCoordinates geoCoord(dLat, dLng); - m_pDiscoveryQuery->SetProximity(geoCoord); + m_pDiscoveryQuery->SetType(DiscoveryQuery::QT_EXPLORE); + if (geoArea) + m_pDiscoveryQuery->SetArea(*geoArea); } - + /* Execute query */ m_nRestReqId = m_pDiscoveryQuery->Execute(*this, NULL); return (m_nRestReqId > 0 ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION); @@ -294,7 +312,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; @@ -303,22 +321,24 @@ here_error_e HerePlace::PreparePlaceDetailsPreference(maps_preference_h hPref) m_pPlaceDetailsQuery->SetLanguage(szLanguage); g_free(szLanguage); + maps_distance_unit_e eUnit; + ret = maps_preference_get_distance_unit(hPref, &eUnit); + if (ret == MAPS_ERROR_NONE) + m_eDistanceUnit = eUnit; + return HERE_ERROR_NONE; } -here_error_e HerePlace::StartPlaceDetails(const char *szPlaceId) +here_error_e HerePlace::StartPlaceDetails(const char *szUrl) { if (!m_pPlaceDetailsQuery) return HERE_ERROR_OUT_OF_MEMORY; - if (!szPlaceId || (szPlaceId && strlen(szPlaceId) <= 0)) + if (!szUrl || (szUrl && strlen(szUrl) <= 0)) return HERE_ERROR_INVALID_PARAMETER; - m_pPlaceDetailsQuery->SetPlaceId(szPlaceId); - - - m_nRestReqId = m_pPlaceDetailsQuery->Execute(*this, NULL); + m_nRestReqId = m_pPlaceDetailsQuery->Execute(*this, NULL, szUrl); return (m_nRestReqId > 0 ? HERE_ERROR_NONE : HERE_ERROR_INVALID_OPERATION); } @@ -353,6 +373,11 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply) int error = MAPS_ERROR_UNKNOWN, sub_error; bool is_valid, isPending; + if (m_bCanceled || !m_pCbFunc) + { + delete this; + return; + } m_nReplyIdx = 0; m_nReplyCnt = herePlaceList.size() + hereSearchList.size(); @@ -440,7 +465,8 @@ void HerePlace::OnDiscoverReply (const DiscoveryReply &Reply) } /* distance */ - maps_place_set_distance(mapsPlace, (int)herePlaceIt->GetDistance()); + maps_place_set_distance(mapsPlace, + HereUtils::ConvertDistance((int)herePlaceIt->GetDistance(), m_eDistanceUnit) + 0.5); /* sponser */ /* herePlaceList.GetIsSponsored() */ @@ -553,7 +579,14 @@ void HerePlace::OnDiscoverFailure(const DiscoveryReply& Reply) void HerePlace::OnPlaceDetailsReply (const PlaceDetailsReply &Reply) { if (m_nReplyCnt == 0) + { + if (m_bCanceled || !m_pCbFunc) + { + delete this; + return; + } m_nReplyCnt = 1; + } PlaceDetails herePlace = Reply.GetPlaceDetails(); maps_place_h mapsPlace = NULL; @@ -893,7 +926,7 @@ void HerePlace::ProcessPlaceCategory(PlaceDetails herePlace, maps_place_h mapsPl } void HerePlace::ProcessPlaceImage(PlaceDetails herePlace, maps_place_h mapsPlace) -{ +{ ImageContentList hereImageList = herePlace.GetImageContent(); ImageContentList::iterator hereImage; maps_item_list_h mapsImageList; @@ -1205,7 +1238,7 @@ void HerePlace::__flushReplies(int error) bool bCallbackCanceled = false; int nReplyIdx = 0; - if (m_bReplyFlushed) return; + if (m_bReplyFlushed || m_bCanceled || !m_pCbFunc) return; m_bReplyFlushed = true; __sortList(m_PlaceList); diff --git a/src/here/here_place.h b/src/here/here_place.h index 0cc4338..ce2488a 100755 --- a/src/here/here_place.h +++ b/src/here/here_place.h @@ -73,14 +73,13 @@ public: here_error_e PrepareDiscoveryPreference(maps_preference_h hPref); here_error_e PrepareDiscoveryFilter(maps_place_filter_h hFilter); - here_error_e StartDiscoveryPlace(maps_coordinates_h hCoord, int nDistance); - here_error_e StartDiscoveryPlaceByArea(maps_area_h hArea); - here_error_e StartDiscoveryPlaceByAddress(const char *szAddr, maps_area_h hArea); + here_error_e StartDiscoveryPlace(maps_coordinates_h hCoord, const int nDistance); + here_error_e StartDiscoveryPlace(maps_area_h hArea, const char *szAddr = ""); here_error_e PreparePlaceDetailsQuery(); here_error_e PreparePlaceDetailsPreference(maps_preference_h hPref); - - here_error_e StartPlaceDetails(const char* szPlaceId); + + here_error_e StartPlaceDetails(const char* szUrl); here_error_e StartPlaceDetailsInternal(const char* szUrl); virtual void OnDiscoverReply(const DiscoveryReply &Reply); @@ -117,6 +116,7 @@ private: bool m_bReplyFlushed; char *m_szSortBy; bool m_bPlaceDetailsInternal; + maps_distance_unit_e m_eDistanceUnit; PlaceList m_PlaceList; diff --git a/src/here/here_revgeocode.cpp b/src/here/here_revgeocode.cpp index e4f8bce..b32dd59 100755 --- a/src/here/here_revgeocode.cpp +++ b/src/here/here_revgeocode.cpp @@ -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; @@ -138,6 +138,7 @@ void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply) 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,7 +204,7 @@ void HereRevGeocode::OnGeoCoderReply(const GeoCoderReply& Reply) void HereRevGeocode::OnGeoCoderFailure(const GeoCoderReply& Reply) { - if (!m_bCanceled) + 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; } diff --git a/src/here/here_route.cpp b/src/here/here_route.cpp index aa1abfb..8710619 100755 --- a/src/here/here_route.cpp +++ b/src/here/here_route.cpp @@ -25,6 +25,8 @@ HereRoute::HereRoute(void *pCbFunc, void *pUserData, int nReqId) m_pCbFunc = pCbFunc; m_pUserData = pUserData; m_nReqId = nReqId; + + m_eDistanceUnit = MAPS_DISTANCE_UNIT_M; } HereRoute::~HereRoute() @@ -107,7 +109,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; @@ -169,6 +171,7 @@ here_error_e HereRoute::PreparePreference(maps_preference_h hPref) case MAPS_DISTANCE_UNIT_KM: eMetric = GeoRouteQuery::DIST_metric; break; default: eMetric = GeoRouteQuery::DIST_imperial; break; } + m_eDistanceUnit = eUnit; m_pQuery->SetMetricSystem(eMetric); } @@ -181,6 +184,24 @@ here_error_e HereRoute::PreparePreference(maps_preference_h hPref) g_free(szViewBounds); } + char *szRealtimeTraffic; + if (maps_preference_get(hPref, MAPS_ROUTE_REALTIME_TRAFFIC, &szRealtimeTraffic) == MAPS_ERROR_NONE) + { + if (!strcmp(szRealtimeTraffic, "true") || !strcmp(szRealtimeTraffic, "enabled")) + { + m_pQuery->SetRealtimeTraffic(1); + } + else if (!strcmp(szRealtimeTraffic, "false") || !strcmp(szRealtimeTraffic, "disabled")) + { + m_pQuery->SetRealtimeTraffic(2); + } + else + { + m_pQuery->SetRealtimeTraffic(0); + } + g_free(szRealtimeTraffic); + } + return HERE_ERROR_NONE; } @@ -196,7 +217,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 || !m_pQuery) // ignore call back if it was cancelled. { delete this; return; @@ -227,10 +248,18 @@ void HereRoute::OnRouteReply(const GeoRouteReply& Reply) maps_route_set_route_id(mapsRoute, (char*)hereRoute->GetRouteId().c_str()); /* distance */ - maps_route_set_total_distance(mapsRoute, hereRoute->GetDistance()); + maps_route_set_total_distance(mapsRoute, + HereUtils::ConvertDistance(hereRoute->GetDistance(), m_eDistanceUnit)); + + /* distance unit */ + maps_route_set_distance_unit(mapsRoute, m_eDistanceUnit); /* duration */ - maps_route_set_total_duration(mapsRoute, hereRoute->GetTravelTime()); + if (m_pQuery->GetRealtimeTraffic() == 1) + maps_route_set_total_duration(mapsRoute, hereRoute->GetTrafficTime()); + else + maps_route_set_total_duration(mapsRoute, hereRoute->GetTravelTime()); + /* travel mode */ maps_route_transport_mode_e eTransportMode; @@ -307,7 +336,7 @@ void HereRoute::OnRouteReply(const GeoRouteReply& Reply) void HereRoute::OnRouteFailure(const GeoRouteReply& Reply) { - if (!m_bCanceled) + 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; } @@ -329,7 +358,8 @@ maps_error_e HereRoute::ProcessSegments(maps_route_h mapsRoute, const RouteSegme if (maps_route_segment_create(&mapsSegm) != MAPS_ERROR_NONE) continue; /* distance */ - maps_route_segment_set_distance(mapsSegm, hereSegm->GetDistance()); + maps_route_segment_set_distance(mapsSegm, + HereUtils::ConvertDistance(hereSegm->GetDistance(), m_eDistanceUnit)); /* tranvel time */ maps_route_segment_set_duration(mapsSegm, hereSegm->GetTravelTime()); @@ -403,7 +433,7 @@ maps_error_e HereRoute::ProcessManeuver(maps_route_segment_h mapsSegm, const Man /* length */ maps_route_maneuver_set_distance_to_next_instruction(mapsManeuver, - hereMane->GetDistanceToNextInstruction()); + HereUtils::ConvertDistance(hereMane->GetDistanceToNextInstruction(), m_eDistanceUnit)); /* travel time */ maps_route_maneuver_set_time_to_next_instruction(mapsManeuver, diff --git a/src/here/here_route.h b/src/here/here_route.h index 0aab609..8c352e1 100755 --- a/src/here/here_route.h +++ b/src/here/here_route.h @@ -64,7 +64,9 @@ public: private: maps_error_e ProcessSegments(maps_route_h mapsRoute, const RouteSegmentList& hereSegmList); maps_error_e ProcessManeuver(maps_route_segment_h mapsSegm, const ManeuverList& hereManeList); + const double __convertDistanceUnit(const double dValue); + maps_distance_unit_e m_eDistanceUnit; GeoRouteQuery* m_pQuery; }; diff --git a/src/here/here_utils.cpp b/src/here/here_utils.cpp index 60f1fb9..07680b8 100755 --- a/src/here/here_utils.cpp +++ b/src/here/here_utils.cpp @@ -297,6 +297,20 @@ maps_area_h& HereUtils::Convert(GeoBoundingBox Box, maps_area_h& hArea) return hArea; } +GeoBoundingCircle& HereUtils::Convert(maps_area_h hArea, GeoBoundingCircle& circle) +{ + maps_area_s* area_s = (maps_area_s*)hArea; + + if (!area_s || area_s->type != MAPS_AREA_CIRCLE) return circle; + + GeoCoordinates hereCoord(area_s->circle.center.latitude, area_s->circle.center.longitude); + + circle.SetCenter(hereCoord); + circle.SetRadius(area_s->circle.radius); + + return circle; +} + void HereUtils::Convert(String strUtf8, WString& strUtf16) { strUtf16.assign(strUtf8.begin(), strUtf8.end()); @@ -355,5 +369,15 @@ bool HereUtils::IsValid(maps_area_s hArea) return false; } +const double HereUtils::ConvertDistance(const double originValue, maps_distance_unit_e destUnit) +{ + return ConvertDistance(originValue, MAPS_DISTANCE_UNIT_M, destUnit); +} + +const double HereUtils::ConvertDistance(const double originValue, maps_distance_unit_e originUnit, maps_distance_unit_e destUnit) +{ + double meterConstant[MAPS_DISTANCE_UNIT_YD+1] = { 1.0, 0.001, 3.2808399, 1.0936133 }; + return originValue / meterConstant[originUnit] * meterConstant[destUnit]; +} HERE_PLUGIN_END_NAMESPACE diff --git a/src/here/here_utils.h b/src/here/here_utils.h index 3a54031..c46e64d 100755 --- a/src/here/here_utils.h +++ b/src/here/here_utils.h @@ -40,6 +40,8 @@ #include <routes/GeoRouteQuery.h> #include <routes/Maneuver.h> #include <common/GeoCoordinates.h> +#include <common/GeoBoundingBox.h> +#include <common/GeoBoundingCircle.h> #define HERE_PLUGIN_BEGIN_NAMESPACE namespace Here { namespace PlugIn { #define HERE_PLUGIN_END_NAMESPACE }} @@ -128,10 +130,13 @@ public: static maps_route_turn_type_e Convert(Maneuver::InstructionDirection nVal); static GeoBoundingBox& Convert(maps_area_h hArea, GeoBoundingBox& Box); static maps_area_h& Convert(GeoBoundingBox Box, maps_area_h& hArea); + static GeoBoundingCircle& Convert(maps_area_h hArea, GeoBoundingCircle& circle); static void Convert(String strUtf8, WString& strUtf16); static void Convert(WString strUtf16, String& strUtf8); static GeoBoundingBox& Convert(const char *src, GeoBoundingBox &box); static maps_error_e ConvertHttpCodeToMapsError(int nVal); + static const double ConvertDistance(const double originValue, maps_distance_unit_e destUnit); + static const double ConvertDistance(const double originValue, maps_distance_unit_e originUnit, maps_distance_unit_e destUnit); static bool IsValid(GeoCoordinates geoCoord); static bool IsValid(maps_coordinates_s geoCoord); diff --git a/src/here_plugin.cpp b/src/here_plugin.cpp index 43e3c77..3164ff7 100755 --- a/src/here_plugin.cpp +++ b/src/here_plugin.cpp @@ -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); @@ -164,9 +145,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); @@ -178,9 +156,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); @@ -192,9 +167,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); @@ -206,9 +178,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); @@ -220,9 +189,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); @@ -234,9 +200,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); @@ -248,9 +211,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); @@ -262,9 +222,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); @@ -276,9 +233,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); @@ -288,9 +242,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); |