diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2016-10-21 19:54:02 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-10-25 17:33:35 +0300 |
commit | 1f1d0a58713f4f4817827aa108f75e0657014813 (patch) | |
tree | eff7e58b59addf80982788177617215f4f840622 /tracking/reporter.hpp | |
parent | 8314310c0e8a63bed40abf95b7741b10c24521eb (diff) |
[tracking] Made tracking work
Diffstat (limited to 'tracking/reporter.hpp')
-rw-r--r-- | tracking/reporter.hpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tracking/reporter.hpp b/tracking/reporter.hpp index 2c85b69969..380a3cd460 100644 --- a/tracking/reporter.hpp +++ b/tracking/reporter.hpp @@ -7,6 +7,7 @@ #include "std/chrono.hpp" #include "std/condition_variable.hpp" #include "std/mutex.hpp" +#include "std/string.hpp" #include "std/unique_ptr.hpp" #include "std/vector.hpp" @@ -28,13 +29,16 @@ class Reporter final { public: static milliseconds const kPushDelayMs; - static const char kEnabledSettingsKey[]; + static const char kEnableTrackingKey[]; - Reporter(unique_ptr<platform::Socket> socket, milliseconds pushDelay); + Reporter(unique_ptr<platform::Socket> socket, string const & host, uint16_t port, + milliseconds pushDelay); ~Reporter(); void AddLocation(location::GpsInfo const & info); + inline void SetIdleFunc(function<void()> fn) { m_idleFn = fn; } + private: void Run(); bool SendPoints(); @@ -43,6 +47,9 @@ private: milliseconds m_pushDelay; bool m_wasConnected = false; double m_lastConnectionAttempt = 0.0; + // Function to be called every |kPushDelayMs| in + // case no points were sent. + function<void()> m_idleFn; // Input buffer for incoming points. Worker thread steals it contents. vector<DataPoint> m_input; // Last collected points, sends periodically to server. |