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
qnmeasatelliteinfosource_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QNMESATELLITEINFOSOURCE_P_H
6#define QNMESATELLITEINFOSOURCE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20#include <QtPositioning/qgeosatelliteinfo.h>
21
22#include <QObject>
23#include <QQueue>
24#include <QPointer>
25#include <QMap>
26#include <QtCore/qiodevice.h>
27#include <QtCore/qtimer.h>
28#include <QtCore/private/qglobal_p.h>
29
30#include <memory>
31
32QT_BEGIN_NAMESPACE
33
34#define USE_SATELLITE_NMEA_PIMPL 1
35
36struct SatelliteInfo
37{
38 QList<QGeoSatelliteInfo> satellitesInView;
39 QList<QGeoSatelliteInfo> satellitesInUse;
40 QList<int> inUseIds; // temp buffer for GSA received before GSV
41 bool satellitesInUseReceived = false;
42 bool updatingGSV = false;
43 bool validInView = false;
44 bool validInUse = false;
45};
46
48{
51 bool m_validInView = false; // global state for all satellite systems
52 bool m_validInUse = false; // global state for all satellite systems
53 bool m_fresh = false;
57#endif
60 void setSatellitesInView(QGeoSatelliteInfo::SatelliteSystem system,
61 const QList<QGeoSatelliteInfo> &inView);
62 bool setSatellitesInUse(QGeoSatelliteInfo::SatelliteSystem system, const QList<int> &inUse);
63 void consume();
64 bool isFresh() const;
65 void clear();
66 bool isValid() const;
67 bool calculateValidInUse() const;
68 bool calculateValidInView() const;
69};
70
73{
75public:
78
79 void startUpdates();
80 void stopUpdates();
81 void requestUpdate(int msec);
82 void notifyNewUpdate();
84
85public slots:
86 void readyRead();
87 void emitPendingUpdate();
88 void sourceDataClosed();
90
91public:
97 bool m_invokedStart = false;
99 bool m_updateTimeoutSent = false;
101 QBasicTimer *m_updateTimer = nullptr; // the timer used in startUpdates()
102 QTimer *m_requestTimer = nullptr; // the timer used in requestUpdate()
106
107protected:
108 bool openSourceDevice();
109 bool initialize();
110 void prepareSourceDevice();
111 bool emitUpdated(QNmeaSatelliteInfoUpdate &update, bool fromRequestUpdate);
112 void timerEvent(QTimerEvent *event) override;
113};
114
116{
117public:
119 virtual ~QNmeaSatelliteReader();
120
121 virtual void readAvailableData() = 0;
122
123protected:
125};
126
133
135{
136public:
138 void readAvailableData() override;
139 void setUpdateInterval(int msec);
140 int updateInterval() const;
141
142private:
143 std::unique_ptr<QTimer> m_timer;
144 int m_updateInterval;
145};
146
147QT_END_NAMESPACE
148
149#endif
bool emitUpdated(QNmeaSatelliteInfoUpdate &update, bool fromRequestUpdate)
void processNmeaData(QNmeaSatelliteInfoUpdate &updateInfo)
std::unique_ptr< QNmeaSatelliteReader > m_nmeaReader
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
QGeoSatelliteInfoSource::Error m_satelliteError
virtual void readAvailableData()=0
QNmeaSatelliteInfoSourcePrivate * m_proxy
QNmeaSatelliteReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
QNmeaSatelliteRealTimeReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
QNmeaSatelliteSimulationReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
#define USE_SATELLITE_NMEA_PIMPL
QMap< QGeoSatelliteInfo::SatelliteSystem, SatelliteInfo > m_satellites
bool setSatellitesInUse(QGeoSatelliteInfo::SatelliteSystem system, const QList< int > &inUse)
QList< QGeoSatelliteInfo > allSatellitesInView() const
QList< QGeoSatelliteInfo > allSatellitesInUse() const
QList< QGeoSatelliteInfo > m_satellitesInViewParsed
void setSatellitesInView(QGeoSatelliteInfo::SatelliteSystem system, const QList< QGeoSatelliteInfo > &inView)