Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
14class QDBusObjectPath;
15class QTimer;
16
18{
20
21public:
22 explicit QGeoPositionInfoSourceGeoclue2(const QVariantMap &parameters,
23 QObject *parent = nullptr);
25
26 // From QGeoPositionInfoSource
27 void setUpdateInterval(int msec) override;
28 QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
29 PositioningMethods supportedPositioningMethods() const override;
30 void setPreferredPositioningMethods(PositioningMethods methods) override;
31 int minimumUpdateInterval() const override;
32
33 Error error() const override;
34
35 void startUpdates() override;
36 void stopUpdates() override;
37 void requestUpdate(int timeout = 5000) override;
38
39private:
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;
58 QGeoPositionInfo m_lastPosition;
59 QString m_desktopId;
60};
61
63
64#endif // QGEOPOSITIONINFOSOURCE_GEOCLUE2_P_H
static JNINativeMethod methods[]
\inmodule QtDBus
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
QGeoPositionInfoSourceGeoclue2(const QVariantMap &parameters, QObject *parent=nullptr)
\inmodule QtPositioning
Error
The Error enumeration represents the errors which can occur.
\inmodule QtPositioning
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qtimer.h:20
Combined button and popup list for selecting options.
GLbitfield GLuint64 timeout
[4]
#define Q_OBJECT