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
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
30
31#define USE_SATELLITE_NMEA_PIMPL 1
32
34{
35 QList<QGeoSatelliteInfo> satellitesInView;
36 QList<QGeoSatelliteInfo> satellitesInUse;
37 QList<int> inUseIds; // temp buffer for GSA received before GSV
39 bool updatingGSV = false;
40 bool validInView = false;
41 bool validInUse = false;
42};
43
45{
46 QMap<QGeoSatelliteInfo::SatelliteSystem, SatelliteInfo> m_satellites;
47 QList<QGeoSatelliteInfo> m_satellitesInViewParsed;
48 bool m_validInView = false; // global state for all satellite systems
49 bool m_validInUse = false; // global state for all satellite systems
50 bool m_fresh = false;
51#if USE_SATELLITE_NMEA_PIMPL
53 QList<QByteArray> gsv;
54#endif
55 QList<QGeoSatelliteInfo> allSatellitesInUse() const;
56 QList<QGeoSatelliteInfo> allSatellitesInView() const;
58 const QList<QGeoSatelliteInfo> &inView);
59 bool setSatellitesInUse(QGeoSatelliteInfo::SatelliteSystem system, const QList<int> &inUse);
60 void consume();
61 bool isFresh() const;
62 void clear();
63 bool isValid() const;
64 bool calculateValidInUse() const;
65 bool calculateValidInView() const;
66};
67
70{
72public:
75
76 void startUpdates();
77 void stopUpdates();
78 void requestUpdate(int msec);
79 void notifyNewUpdate();
81
82public slots:
83 void readyRead();
84 void emitPendingUpdate();
85 void sourceDataClosed();
87
88public:
91 QPointer<QIODevice> m_device;
94 bool m_invokedStart = false;
96 bool m_updateTimeoutSent = false;
98 QBasicTimer *m_updateTimer = nullptr; // the timer used in startUpdates()
99 QTimer *m_requestTimer = nullptr; // the timer used in requestUpdate()
100 QScopedPointer<QNmeaSatelliteReader> m_nmeaReader;
103
104protected:
105 bool openSourceDevice();
106 bool initialize();
107 void prepareSourceDevice();
108 bool emitUpdated(QNmeaSatelliteInfoUpdate &update, bool fromRequestUpdate);
109 void timerEvent(QTimerEvent *event) override;
110};
111
113{
114public:
116 virtual ~QNmeaSatelliteReader();
117
118 virtual void readAvailableData() = 0;
119
120protected:
122};
123
130
132{
133public:
135 void readAvailableData() override;
136 void setUpdateInterval(int msec);
137 int updateInterval() const;
138
139private:
140 QScopedPointer<QTimer> m_timer;
141 int m_updateInterval;
142};
143
145
146#endif
\inmodule QtCore
Definition qbasictimer.h:18
\inmodule QtCore
Definition qbytearray.h:57
Error
The Error enumeration represents the errors which can occur.
SatelliteSystem
Defines the GNSS system of the satellite.
bool emitUpdated(QNmeaSatelliteInfoUpdate &update, bool fromRequestUpdate)
QScopedPointer< QNmeaSatelliteReader > m_nmeaReader
void processNmeaData(QNmeaSatelliteInfoUpdate &updateInfo)
QNmeaSatelliteInfoSourcePrivate(QNmeaSatelliteInfoSource *parent, QNmeaSatelliteInfoSource::UpdateMode updateMode)
QNmeaSatelliteInfoSource::UpdateMode m_updateMode
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
UpdateMode
Defines the available update modes.
virtual void readAvailableData()=0
QNmeaSatelliteInfoSourcePrivate * m_proxy
QNmeaSatelliteReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
QNmeaSatelliteRealTimeReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
QNmeaSatelliteSimulationReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
Definition qcoreevent.h:366
\inmodule QtCore
Definition qtimer.h:20
Combined button and popup list for selecting options.
struct _cl_event * event
#define Q_OBJECT
#define slots
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)
QList< QGeoSatelliteInfo > satellitesInView
QList< QGeoSatelliteInfo > satellitesInUse