diff options
author | Sergey Yershov <syershov@maps.me> | 2016-12-09 15:35:49 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2016-12-09 16:19:09 +0300 |
commit | 10885c6713a52d6abd8f104ddb26027deb382a7c (patch) | |
tree | 31ec17dd60a607037fd44f6bde5a230b07638e41 /traffic/traffic_info.hpp | |
parent | 12e04098d153418bd3c95b076007ab3b0f5da78e (diff) |
Fix traffic processing
Diffstat (limited to 'traffic/traffic_info.hpp')
-rw-r--r-- | traffic/traffic_info.hpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/traffic/traffic_info.hpp b/traffic/traffic_info.hpp index 23cbb268f0..b687ab2a6e 100644 --- a/traffic/traffic_info.hpp +++ b/traffic/traffic_info.hpp @@ -117,22 +117,29 @@ public: static void DeserializeTrafficValues(vector<uint8_t> const & data, vector<SpeedGroup> & result); private: + enum class ServerDataStatus + { + New, + NotChanged, + NotFound, + Error, + }; + friend void UnitTest_TrafficInfo_UpdateTrafficData(); // todo(@m) A temporary method. Remove it once the keys are added // to the generator and the data is regenerated. bool ReceiveTrafficKeys(); - // Tries to read the values of the Coloring map from server. - // Returns true and updates m_coloring if the values are read successfully and - // their number is equal to the number of keys. + // Tries to read the values of the Coloring map from server into |values|. + // Returns result of communicating with server as ServerDataStatus. // Otherwise, returns false and does not change m_coloring. - bool ReceiveTrafficValues(string & etag, vector<SpeedGroup> & values); + ServerDataStatus ReceiveTrafficValues(string & etag, vector<SpeedGroup> & values); // Updates the coloring and changes the availability status if needed. bool UpdateTrafficData(vector<SpeedGroup> const & values); - bool ProcessFailure(platform::HttpClient const & request, uint64_t const mwmVersion); + ServerDataStatus ProcessFailure(platform::HttpClient const & request, uint64_t const mwmVersion); // The mapping from feature segments to speed groups (see speed_groups.hpp). Coloring m_coloring; |