QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 <QObject>
22 #include <QList>
23 #include <QPair>
24 #include <memory>
25 
26 #include "qgis_core.h"
27 
28 class QgsGpsConnection;
29 class QgsGpsInformation;
30 
35 class CORE_EXPORT QgsGpsDetector : public QObject
36 {
37  Q_OBJECT
38  public:
39  QgsGpsDetector( const QString &portName );
40  ~QgsGpsDetector() override;
41 
42  static QList< QPair<QString, QString> > availablePorts();
43 
44  public slots:
45  void advance();
46  void detected( const QgsGpsInformation & );
47  void connDestroyed( QObject * );
48 
49  signals:
50 
51  // TODO QGIS 4.0 - this is horrible, fragile, leaky and crash prone API.
52  // don't transfer ownership with this signal, and add an explicit takeConnection member!
53 
58  void detected( QgsGpsConnection *connection );
59 
61 
62  private:
63  int mPortIndex = 0;
64  int mBaudIndex = -1;
65  QList< QPair< QString, QString > > mPortList;
66  QList<qint32> mBaudList;
67 
68  std::unique_ptr< QgsGpsConnection > mConn;
69 };
70 
71 #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.