Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-11-15 13:31:04 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-11-16 12:54:09 +0300
commit1f88f71a0551503e9434c9f78f39e2a3543c083e (patch)
tree723c4a5e039633a2ff5dd7bf56e29ca95732947e /traffic
parent71e7508675311ba3c2f3ea6b52e68d5e499f1dc2 (diff)
Added requesting in traffic manager
Diffstat (limited to 'traffic')
-rw-r--r--traffic/traffic_info.cpp5
-rw-r--r--traffic/traffic_info.hpp8
-rw-r--r--traffic/traffic_tests/traffic_info_test.cpp4
3 files changed, 11 insertions, 6 deletions
diff --git a/traffic/traffic_info.cpp b/traffic/traffic_info.cpp
index ef233b6538..a77dd9297a 100644
--- a/traffic/traffic_info.cpp
+++ b/traffic/traffic_info.cpp
@@ -20,7 +20,6 @@ namespace traffic
{
namespace
{
-char const kTestFileName[] = "traffic_data";
bool ReadRemoteFile(string const & url, vector<uint8_t> & result)
{
@@ -46,12 +45,12 @@ TrafficInfo::RoadSegmentId::RoadSegmentId(uint32_t fid, uint16_t idx, uint8_t di
// TrafficInfo --------------------------------------------------------------------------------
TrafficInfo::TrafficInfo(MwmSet::MwmId const & mwmId) : m_mwmId(mwmId) {}
-bool TrafficInfo::ReceiveTrafficData()
+bool TrafficInfo::ReceiveTrafficData(string const & fileName)
{
if (strlen(TRAFFIC_DATA_BASE_URL) == 0)
return false;
- string const url = string(TRAFFIC_DATA_BASE_URL) + string(kTestFileName);
+ string const url = string(TRAFFIC_DATA_BASE_URL) + string(fileName);
vector<uint8_t> contents;
if (!ReadRemoteFile(url, contents))
return false;
diff --git a/traffic/traffic_info.hpp b/traffic/traffic_info.hpp
index 23309cd8ca..1db69d7493 100644
--- a/traffic/traffic_info.hpp
+++ b/traffic/traffic_info.hpp
@@ -12,11 +12,16 @@ namespace traffic
{
// This class is responsible for providing the real-time
// information about road traffic for one mwm file.
+
class TrafficInfo
{
public:
struct RoadSegmentId
{
+ // m_dir can be kForwardDirection or kReverseDirection.
+ static int constexpr kForwardDirection = 0;
+ static int constexpr kReverseDirection = 1;
+
RoadSegmentId();
RoadSegmentId(uint32_t fid, uint16_t idx, uint8_t dir);
@@ -43,7 +48,6 @@ public:
uint16_t m_idx : 15;
// The direction of the segment.
- // todo(@m) Write up what the values 0 and 1 mean specifically.
uint8_t m_dir : 1;
};
@@ -58,7 +62,7 @@ public:
// todo(@m, @syershov) Currently a hardcoded path is used.
// Construct the url by passing an MwmId.
// *NOTE* This method must not be called on the UI thread.
- bool ReceiveTrafficData();
+ bool ReceiveTrafficData(string const & fileName);
// Returns the latest known speed group by a feature segment's id.
SpeedGroup GetSpeedGroup(RoadSegmentId const & id) const;
diff --git a/traffic/traffic_tests/traffic_info_test.cpp b/traffic/traffic_tests/traffic_info_test.cpp
index 3efbcd7e35..3c9af855ea 100644
--- a/traffic/traffic_tests/traffic_info_test.cpp
+++ b/traffic/traffic_tests/traffic_info_test.cpp
@@ -21,8 +21,10 @@ SpeedGroup GetSpeedGroup(TrafficInfo::Coloring const & coloring,
UNIT_TEST(TrafficInfo_RemoteFile)
{
+ string const kTestFileName = "traffic_data";
+
TrafficInfo r;
- TEST(r.ReceiveTrafficData(), ());
+ TEST(r.ReceiveTrafficData(kTestFileName), ());
}
UNIT_TEST(TrafficInfo_Serialization)