Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeopositioninfosource_geoclue2_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGEOPOSITIONINFOSOURCE_GEOCLUE2_P_H
5#define QGEOPOSITIONINFOSOURCE_GEOCLUE2_P_H
6
7#include <QtPositioning/QGeoPositionInfoSource>
8#include <QtCore/QPointer>
9#include <manager_interface.h>
10
11class OrgFreedesktopGeoClue2ClientInterface;
12
13QT_BEGIN_NAMESPACE
14class QDBusObjectPath;
15class QTimer;
16
18{
20
21public:
23 QObject *parent = nullptr);
25
26 // From QGeoPositionInfoSource
27 void setUpdateInterval(int msec) override;
28 QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
30 void setPreferredPositioningMethods(PositioningMethods methods) override;
32
33 Error error() const override;
34
36 void stopUpdates() override;
37 void requestUpdate(int timeout = 5000) override;
38
39private:
40 void setError(QGeoPositionInfoSource::Error error);
41 void restoreLastPosition();
42 void saveLastPosition();
43 void createClient();
44 bool configureClient();
45 void startClient();
46 void stopClient();
47 void requestUpdateTimeout();
48 void handleNewLocation(const QDBusObjectPath &oldLocation,
49 const QDBusObjectPath &newLocation);
50 void parseParameters(const QVariantMap &parameters);
51
52 QTimer *m_requestTimer = nullptr;
53 OrgFreedesktopGeoClue2ManagerInterface m_manager;
54 QPointer<OrgFreedesktopGeoClue2ClientInterface> m_client;
55 bool m_running = false;
56 bool m_lastPositionFromSatellite = false;
57 QGeoPositionInfoSource::Error m_error = NoError;
58 QGeoPositionInfo m_lastPosition;
59 QString m_desktopId;
60};
61
62QT_END_NAMESPACE
63
64#endif // QGEOPOSITIONINFOSOURCE_GEOCLUE2_P_H
void startUpdates() override
Starts emitting updates at regular intervals as specified by setUpdateInterval().
PositioningMethods supportedPositioningMethods() const override
Returns the positioning methods available to this source.
Error error() const override
Returns the type of error that last occurred.
void requestUpdate(int timeout=5000) override
Attempts to get the current position and emit positionUpdated() with this information.
QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly=false) const override
Returns an update containing the last known position, or a null update if none is available.
void stopUpdates() override
Stops emitting updates at regular intervals.
void setPreferredPositioningMethods(PositioningMethods methods) override