diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-05-19 05:47:51 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:17:42 +0300 |
commit | fb496023e71e47f5d957078396f70260fee521da (patch) | |
tree | 0547e1726a411dfe0a4dfec691de2baa72bc5f09 /platform/wifi_location_service.cpp | |
parent | 942ab03f920b0fcaac28d21f1ab06d1da12fdc67 (diff) |
[win] My Position works using wifi or local router gateway
Diffstat (limited to 'platform/wifi_location_service.cpp')
-rw-r--r-- | platform/wifi_location_service.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/platform/wifi_location_service.cpp b/platform/wifi_location_service.cpp index 700d33d62d..eba5f5d6eb 100644 --- a/platform/wifi_location_service.cpp +++ b/platform/wifi_location_service.cpp @@ -20,6 +20,13 @@ namespace location void OnHttpPostFinished(HttpFinishedParams const & result) { + if (result.m_error != EHttpDownloadOk) + { + LOG(LWARNING, ("Location server is not available")); + return; + } + // stop requesting wifi updates if reply from server is received + m_wifiInfo.Stop(); // here we should receive json reply with coordinates and accuracy try { @@ -40,9 +47,10 @@ namespace location info.m_horizontalAccuracy = json_real_value(acc); // @TODO introduce flags to mark valid values info.m_status = EAccurateMode; - info.m_timestamp = time(NULL); + info.m_timestamp = static_cast<double>(time(NULL)); info.m_source = location::EGoogle; NotifyGpsObserver(info); + return; } } } @@ -90,11 +98,14 @@ namespace location virtual void StopUpdate() { + m_wifiInfo.Stop(); } }; } location::LocationService * CreateWiFiLocationService() { + // small hack - create and initialize downloader in main thread + GetDownloadManager(); return new location::WiFiLocationService(); } |