QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 <QList>
24#include <QObject>
25#include <QPair>
26
27#if defined( HAVE_QTSERIALPORT )
28#include <QSerialPort>
29#endif
30#include <memory>
31
32#include "qgis_core.h"
33#include "qgis_sip.h"
34
35#ifndef SIP_RUN
36template<class T>
38#endif
39
42class QTimer;
43
48class CORE_EXPORT QgsGpsDetector : public QObject
49{
50 Q_OBJECT
51 public:
52
53 // TODO QGIS 4.0 -- remove useUnsafeSignals option
54
67 QgsGpsDetector( const QString &portName = QString(), bool useUnsafeSignals = true );
68
69#if defined( HAVE_QTSERIALPORT )
70 static const QgsSettingsEntryEnumFlag<QSerialPort::StopBits> *settingsGpsStopBits SIP_SKIP;
71 static const QgsSettingsEntryEnumFlag<QSerialPort::DataBits> *settingsGpsDataBits SIP_SKIP;
72 static const QgsSettingsEntryEnumFlag<QSerialPort::Parity> *settingsGpsParity SIP_SKIP;
73 static const QgsSettingsEntryEnumFlag<QSerialPort::FlowControl> *settingsGpsFlowControl SIP_SKIP;
74#endif
75
76 ~QgsGpsDetector() override;
77
91
92 static QList< QPair<QString, QString> > availablePorts();
93
94 public slots:
95 void advance();
96 void detected( const QgsGpsInformation & );
97 void connDestroyed( QObject * );
98
99 signals:
100
109
116 Q_DECL_DEPRECATED void detected( QgsGpsConnection *connection ) SIP_DEPRECATED;
117
122
123 private slots:
124
125 void connectionTimeout();
126
127 private:
128 bool mUseUnsafeSignals = true;
129 int mPortIndex = 0;
130 int mBaudIndex = -1;
131 QList< QPair< QString, QString > > mPortList;
132 QList<qint32> mBaudList;
133
134 std::unique_ptr< QgsGpsConnection > mConn;
135 QTimer *mTimeoutTimer = nullptr;
136};
137
138#endif // QGSGPSDETECTOR_H
Abstract base class for connections to a GPS device.
void connDestroyed(QObject *)
void detected(const QgsGpsInformation &)
static QList< QPair< QString, QString > > availablePorts()
QgsGpsConnection * takeConnection()
Returns the detected GPS connection, and removes it from the detector.
void connectionDetected()
Emitted when a GPS connection is successfully detected.
QgsGpsDetector(const QString &portName=QString(), bool useUnsafeSignals=true)
Constructor for QgsGpsDetector.
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:114
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48