QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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> class QgsSettingsEntryEnumFlag;
37#endif
38
41class QTimer;
42
47class CORE_EXPORT QgsGpsDetector : public QObject
48{
49 Q_OBJECT
50 public:
51 // TODO QGIS 5.0 -- remove useUnsafeSignals option
52
65 QgsGpsDetector( const QString &portName = QString(), bool useUnsafeSignals = true );
66
67#if defined( HAVE_QTSERIALPORT )
68 static const QgsSettingsEntryEnumFlag<QSerialPort::StopBits> *settingsGpsStopBits SIP_SKIP;
69 static const QgsSettingsEntryEnumFlag<QSerialPort::DataBits> *settingsGpsDataBits SIP_SKIP;
70 static const QgsSettingsEntryEnumFlag<QSerialPort::Parity> *settingsGpsParity SIP_SKIP;
71 static const QgsSettingsEntryEnumFlag<QSerialPort::FlowControl> *settingsGpsFlowControl SIP_SKIP;
72#endif
73
74 ~QgsGpsDetector() override;
75
89
90 static QList< QPair<QString, QString> > availablePorts();
91
92 public slots:
93 void advance();
94 void detected( const QgsGpsInformation & );
95 void connDestroyed( QObject * );
96
97 signals:
98
107
114 Q_DECL_DEPRECATED void detected( QgsGpsConnection *connection ) SIP_DEPRECATED;
115
120
121 private slots:
122
123 void connectionTimeout();
124
125 private:
126 bool mUseUnsafeSignals = true;
127 int mPortIndex = 0;
128 int mBaudIndex = -1;
129 QList< QPair< QString, QString > > mPortList;
130 QList<qint32> mBaudList;
131
132 std::unique_ptr< QgsGpsConnection > mConn;
133 QTimer *mTimeoutTimer = nullptr;
134};
135
136#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:113
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_TRANSFERBACK
Definition qgis_sip.h:47