QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsgpsdetector.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgpsdetector.h - description
3 -------------------
4 begin : January 13th, 2009
5 copyright : (C) 2009 by Juergen E. Fischer
6 email : jef at norbit dot de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSGPSDETECTOR_H
19#define QGSGPSDETECTOR_H
20
21#include "qgsconfig.h"
22
23#include <QObject>
24#include <QList>
25#include <QPair>
26#if defined( HAVE_QTSERIALPORT )
27#include <QSerialPort>
28#endif
29#include <memory>
30
31#include "qgis_core.h"
32#include "qgis_sip.h"
33
34#ifndef SIP_RUN
35template<class T>
37#endif
38
41class QTimer;
42
47class CORE_EXPORT QgsGpsDetector : public QObject
48{
49 Q_OBJECT
50 public:
51
52 // TODO QGIS 4.0 -- remove useUnsafeSignals option
53
66 QgsGpsDetector( const QString &portName = QString(), bool useUnsafeSignals = true );
67
68#if defined( HAVE_QTSERIALPORT )
69 static const QgsSettingsEntryEnumFlag<QSerialPort::StopBits> *settingsGpsStopBits SIP_SKIP;
70 static const QgsSettingsEntryEnumFlag<QSerialPort::DataBits> *settingsGpsDataBits SIP_SKIP;
71 static const QgsSettingsEntryEnumFlag<QSerialPort::Parity> *settingsGpsParity SIP_SKIP;
72 static const QgsSettingsEntryEnumFlag<QSerialPort::FlowControl> *settingsGpsFlowControl SIP_SKIP;
73#endif
74
75 ~QgsGpsDetector() override;
76
89 QgsGpsConnection *takeConnection() SIP_TRANSFERBACK;
90
91 static QList< QPair<QString, QString> > availablePorts();
92
93 public slots:
94 void advance();
95 void detected( const QgsGpsInformation & );
96 void connDestroyed( QObject * );
97
98 signals:
99
108
115 Q_DECL_DEPRECATED void detected( QgsGpsConnection *connection ) SIP_DEPRECATED;
116
121
122 private slots:
123
124 void connectionTimeout();
125
126 private:
127 bool mUseUnsafeSignals = true;
128 int mPortIndex = 0;
129 int mBaudIndex = -1;
130 QList< QPair< QString, QString > > mPortList;
131 QList<qint32> mBaudList;
132
133 std::unique_ptr< QgsGpsConnection > mConn;
134 QTimer *mTimeoutTimer = nullptr;
135};
136
137#endif // QGSGPSDETECTOR_H
Abstract base class for connection to a GPS device.
Class to detect the GPS port.
void connectionDetected()
Emitted when a GPS connection is successfully detected.
void detectionFailed()
Emitted when the detector could not find a valid GPS connection.
Q_DECL_DEPRECATED void detected(QgsGpsConnection *connection)
Emitted when the GPS connection has been detected.
Encapsulates information relating to a GPS position fix.
A template class for enum and flag settings entry.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48