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
qnmeapositioninfosource_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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#ifndef QNMEAPOSITIONINFOSOURCE_P_H
4#define QNMEAPOSITIONINFOSOURCE_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
18#include "qgeopositioninfo.h"
19
20#include <QObject>
21#include <QQueue>
22#include <QPointer>
23#include <QtCore/qtimer.h>
24#include <QtCore/private/qglobal_p.h>
25
27
28class QBasicTimer;
29class QTimerEvent;
30class QTimer;
31
32class QNmeaReader;
38
39
41{
43public:
46
47 void startUpdates();
48 void stopUpdates();
49 void requestUpdate(int msec);
50
52 QGeoPositionInfo *posInfo,
53 bool *hasFix);
54
55 void notifyNewUpdate(QGeoPositionInfo *update, bool fixStatus);
56
58 QPointer<QIODevice> m_device;
63
64public Q_SLOTS:
65 void readyRead();
66
67protected:
68 void timerEvent(QTimerEvent *event) override;
69
70private Q_SLOTS:
71 void emitPendingUpdate();
72 void sourceDataClosed();
73 void updateRequestTimeout();
74
75private:
76 bool openSourceDevice();
77 bool initialize();
78 void prepareSourceDevice();
79 void emitUpdated(const QGeoPositionInfo &update);
80
82 QNmeaReader *m_nmeaReader;
83 QGeoPositionInfo m_pendingUpdate;
84 QDate m_currentDate;
85 QBasicTimer *m_updateTimer; // the timer used in startUpdates()
86 QTimer *m_requestTimer; // the timer used in requestUpdate()
87 qreal m_horizontalAccuracy;
88 qreal m_verticalAccuracy;
89 bool m_noUpdateLastInterval;
90 bool m_updateTimeoutSent;
91 bool m_connectedReadyRead;
92};
93
94
96{
97public:
99 : m_proxy(sourcePrivate) {}
100 virtual ~QNmeaReader();
101
102 virtual void readAvailableData() = 0;
103
104protected:
106};
107
108
110{
111public:
114
115 void readAvailableData() override;
116 void notifyNewUpdate();
117
118 // Data members
121 bool m_updateParsed = false;
122 bool m_hasFix = false;
124 int m_pushDelay = -1;
125};
126
127
129{
131public:
134 void readAvailableData() override;
135
136protected:
137 void timerEvent(QTimerEvent *event) override;
138
139private Q_SLOTS:
140 void simulatePendingUpdate();
141
142private:
143 bool setFirstDateTime();
144 void processNextSentence();
145
146 QQueue<QPendingGeoPositionInfo> m_pendingUpdates;
147 QByteArray m_nextLine;
148 int m_currTimerId;
149 bool m_hasValidDateTime;
150};
151
153
154#endif
\inmodule QtCore
Definition qbasictimer.h:18
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore\reentrant
Definition qdatetime.h:283
\inmodule QtCore \reentrant
Definition qdatetime.h:29
Error
The Error enumeration represents the errors which can occur.
\inmodule QtPositioning
void notifyNewUpdate(QGeoPositionInfo *update, bool fixStatus)
bool parsePosInfoFromNmeaData(QByteArrayView data, QGeoPositionInfo *posInfo, bool *hasFix)
QNmeaPositionInfoSource::UpdateMode m_updateMode
QNmeaPositionInfoSourcePrivate(QNmeaPositionInfoSource *parent, QNmeaPositionInfoSource::UpdateMode updateMode)
QGeoPositionInfoSource::Error m_positionError
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
\inmodule QtPositioning
UpdateMode
Defines the available update modes.
QNmeaReader(QNmeaPositionInfoSourcePrivate *sourcePrivate)
QNmeaPositionInfoSourcePrivate * m_proxy
virtual void readAvailableData()=0
virtual ~QNmeaReader()
~QNmeaRealTimeReader() override
QNmeaRealTimeReader(QNmeaPositionInfoSourcePrivate *sourcePrivate)
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
QNmeaSimulatedReader(QNmeaPositionInfoSourcePrivate *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.
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
struct _cl_event * event
#define Q_OBJECT
#define Q_SLOTS
double qreal
Definition qtypes.h:187