QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsgpsconnection.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgpsconnection.h - description
3  -------------------
4  begin : November 30th, 2009
5  copyright : (C) 2009 by Marco Hugentobler
6  email : marco at hugis dot net
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 QGSGPSCONNECTION_H
19 #define QGSGPSCONNECTION_H
20 
21 #include <QDateTime>
22 #include <QObject>
23 #include <QString>
24 
25 class QIODevice;
26 
27 struct CORE_EXPORT QgsSatelliteInfo
28 {
29  int id;
30  bool inUse;
31  int elevation;
32  int azimuth;
33  int signal;
34 };
35 
36 struct CORE_EXPORT QgsGPSInformation
37 {
38  double latitude;
39  double longitude;
40  double elevation;
41  double speed; //in km/h
42  double direction;
44  double pdop;
45  double hdop;
46  double vdop;
47  double hacc; //horizontal accurancy in meters
48  double vacc; //vertical accurancy in meters
51  int fixType;
52  int quality; // from GPGGA
53  int satellitesUsed; // from GPGGA
54  QChar status; // from GPRMC A,V
55  QList<int> satPrn; // list of SVs in use; needed for QgsSatelliteInfo.inUse and other uses
56  bool satInfoComplete; // based on GPGSV sentences - to be used to determine when to graph signal and satellite position
57 };
58 
61 class CORE_EXPORT QgsGPSConnection : public QObject
62 {
63  Q_OBJECT
64  public:
65 
66  enum Status
67  {
71  GPSDataReceived
72  };
73 
78  virtual ~QgsGPSConnection();
80  bool connect();
82  bool close();
83 
85  void setSource( QIODevice* source );
86 
88  Status status() const { return mStatus; }
89 
91  QgsGPSInformation currentGPSInformation() const { return mLastGPSInformation; }
92 
93  signals:
94  void stateChanged( const QgsGPSInformation& info );
95  void nmeaSentenceReceived( const QString& substring ); // added to capture 'raw' data
96 
97  protected:
104 
105  private:
107  void cleanupSource();
108  void clearLastGPSInformation();
109 
110  protected slots:
112  virtual void parseData() = 0;
113 };
114 
115 #endif // QGSGPSCONNECTION_H
Status mStatus
Connection status.
QList< QgsSatelliteInfo > satellitesInView
QList< int > satPrn
Abstract base class for connection to a GPS device.
QgsGPSInformation mLastGPSInformation
Last state of the gps related variables (e.g.
QgsGPSInformation currentGPSInformation() const
Returns the current gps information (lat, lon, etc.)
QIODevice * mSource
Data source (e.g.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Status status() const
Returns the status.