forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqt_location_service.hpp
28 lines (23 loc) · 949 Bytes
/
qt_location_service.hpp
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
#pragma once
#include "platform/location_service.hpp"
#include <QGeoPositionInfoSource>
class QtLocationService : public QObject, public location::LocationService
{
Q_OBJECT
QGeoPositionInfoSource *m_positionSource;
// Unfortunately when the source is `geoclue2`
// we would need access to the `Active` D-Bus property
// https://www.freedesktop.org/software/geoclue/docs
// /gdbus-org.freedesktop.GeoClue2.Client.html#gdbus-property-org-freedesktop-GeoClue2-Client.Active
// But `QGeoPositionInfoSource` doesn't expose that so we have to deduce its state.
bool m_clientIsActive = false;
public:
explicit QtLocationService(location::LocationObserver &, std::string const &);
virtual ~QtLocationService() {};
virtual void Start();
virtual void Stop();
public slots:
void OnLocationUpdate(QGeoPositionInfo const &);
void OnErrorOccurred(QGeoPositionInfoSource::Error);
void OnSupportedPositioningMethodsChanged();
};