diff options
author | kshalnev <k.shalnev@gmail.com> | 2015-12-10 22:51:00 +0300 |
---|---|---|
committer | Constantin Shalnev <c.shalnev@corp.mail.ru> | 2016-01-13 15:54:30 +0300 |
commit | 95479a6d682bbfe37720e795b45cf1b206303de8 (patch) | |
tree | b95a552ebae0b6076e298954a1883b03216b025c /map/gps_tracker.hpp | |
parent | c1398cf2910f216f70fe2b62b7518c1ed344a10f (diff) |
Implemented GpsTracker
Diffstat (limited to 'map/gps_tracker.hpp')
-rw-r--r-- | map/gps_tracker.hpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/map/gps_tracker.hpp b/map/gps_tracker.hpp new file mode 100644 index 0000000000..6832e57d89 --- /dev/null +++ b/map/gps_tracker.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include "map/gps_track.hpp" + +#include "std/atomic.hpp" + +class GpsTracker +{ +public: + static GpsTracker & Instance(); + + bool IsEnabled() const; + void SetEnabled(bool enabled); + + hours GetDuration() const; + void SetDuration(hours duration); + + using TGpsTrackDiffCallback = std::function<void(vector<pair<size_t, location::GpsTrackInfo>> && toAdd, + pair<size_t, size_t> const & toRemove)>; + + void Connect(TGpsTrackDiffCallback const & fn); + void Disconnect(); + + void OnLocationUpdated(location::GpsInfo const & info); + +private: + GpsTracker(); + + atomic<bool> m_enabled; + hours m_duration; + GpsTrack m_track; +}; |