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

gps_tracker.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 11a6efd48c8500545c0a619242215e74f133581a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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;
  GpsTrack m_track;
};