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
4#ifndef QNMESATELLITEINFOSOURCE_P_H
5#define QNMESATELLITEINFOSOURCE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19#include <QtPositioning/qgeosatelliteinfo.h>
20
21#include <QObject>
22#include <QQueue>
23#include <QPointer>
24#include <QMap>
25#include <QtCore/qiodevice.h>
26#include <QtCore/qtimer.h>
27#include <QtCore/private/qglobal_p.h>
28
29#include <memory>
30
31QT_BEGIN_NAMESPACE
32
33#define USE_SATELLITE_NMEA_PIMPL 1
34
35struct SatelliteInfo
36{
37 QList<QGeoSatelliteInfo> satellitesInView;
38 QList<QGeoSatelliteInfo> satellitesInUse;
39 QList<int> inUseIds; // temp buffer for GSA received before GSV
40 bool satellitesInUseReceived = false;
41 bool updatingGSV = false;
42 bool validInView = false;
43 bool validInUse = false;
44};
45
47{
50 bool m_validInView = false; // global state for all satellite systems
51 bool m_validInUse = false; // global state for all satellite systems
52 bool m_fresh = false;
56#endif
59 void setSatellitesInView(QGeoSatelliteInfo::SatelliteSystem system,
60 const QList<QGeoSatelliteInfo> &inView);
61 bool setSatellitesInUse(QGeoSatelliteInfo::SatelliteSystem system, const QList<int> &inUse);
62 void consume();
63 bool isFresh() const;
64 void clear();
65 bool isValid() const;
66 bool calculateValidInUse() const;
67 bool calculateValidInView() const;
68};
69
72{
74public:
77
78 void startUpdates();
79 void stopUpdates();
80 void requestUpdate(int msec);
81 void notifyNewUpdate();
83
84public slots:
85 void readyRead();
86 void emitPendingUpdate();
87 void sourceDataClosed();
89
90public:
96 bool m_invokedStart = false;
98 bool m_updateTimeoutSent = false;
100 QBasicTimer *m_updateTimer = nullptr; // the timer used in startUpdates()
101 QTimer *m_requestTimer = nullptr; // the timer used in requestUpdate()
105
106protected:
107 bool openSourceDevice();
108 bool initialize();
109 void prepareSourceDevice();
110 bool emitUpdated(QNmeaSatelliteInfoUpdate &update, bool fromRequestUpdate);
111 void timerEvent(QTimerEvent *event) override;
112};
113
115{
116public:
118 virtual ~QNmeaSatelliteReader();
119
120 virtual void readAvailableData() = 0;
121
122protected:
124};
125
132
134{
135public:
137 void readAvailableData() override;
138 void setUpdateInterval(int msec);
139 int updateInterval() const;
140
141private:
142 std::unique_ptr<QTimer> m_timer;
143 int m_updateInterval;
144};
145
146QT_END_NAMESPACE
147
148#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)