QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
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
41
46class CORE_EXPORT QgsGpsDetector : public QObject
47{
48 Q_OBJECT
49 public:
50 QgsGpsDetector( const QString &portName );
51
52#if defined( HAVE_QTSERIALPORT )
53 static const QgsSettingsEntryEnumFlag<QSerialPort::StopBits> *settingsGpsStopBits SIP_SKIP;
54 static const QgsSettingsEntryEnumFlag<QSerialPort::DataBits> *settingsGpsDataBits SIP_SKIP;
55 static const QgsSettingsEntryEnumFlag<QSerialPort::Parity> *settingsGpsParity SIP_SKIP;
56 static const QgsSettingsEntryEnumFlag<QSerialPort::FlowControl> *settingsGpsFlowControl SIP_SKIP;
57#endif
58
59 ~QgsGpsDetector() override;
60
61 static QList< QPair<QString, QString> > availablePorts();
62
63 public slots:
64 void advance();
65 void detected( const QgsGpsInformation & );
66 void connDestroyed( QObject * );
67
68 signals:
69
70 // TODO QGIS 4.0 - this is horrible, fragile, leaky and crash prone API.
71 // don't transfer ownership with this signal, and add an explicit takeConnection member!
72
77 void detected( QgsGpsConnection *connection );
78
80
81 private:
82 int mPortIndex = 0;
83 int mBaudIndex = -1;
84 QList< QPair< QString, QString > > mPortList;
85 QList<qint32> mBaudList;
86
87 std::unique_ptr< QgsGpsConnection > mConn;
88};
89
90#endif // QGSGPSDETECTOR_H
Abstract base class for connection to a GPS device.
Class to detect the GPS port.
~QgsGpsDetector() override
void detected(QgsGpsConnection *connection)
Emitted when the GPS connection has been detected.
void detectionFailed()
Encapsulates information relating to a GPS position fix.
A template class for enum and flag settings entry.
#define SIP_SKIP
Definition: qgis_sip.h:126