|
| 1 | +struct QgsSatelliteInfo { |
| 2 | +%TypeHeaderCode |
| 3 | +#include <qgsgpsconnection.h> |
| 4 | +%End |
| 5 | + int id; |
| 6 | + bool inUse; |
| 7 | + int elevation; |
| 8 | + int azimuth; |
| 9 | + int signal; |
| 10 | +}; |
| 11 | + |
| 12 | +struct QgsGPSInformation { |
| 13 | +%TypeHeaderCode |
| 14 | +#include <qgsgpsconnection.h> |
| 15 | +%End |
| 16 | + double latitude; |
| 17 | + double longitude; |
| 18 | + double elevation; |
| 19 | + double speed; //in km/h |
| 20 | + double direction; |
| 21 | + QList<QgsSatelliteInfo> satellitesInView; |
| 22 | + double pdop; |
| 23 | + double hdop; |
| 24 | + double vdop; |
| 25 | + QDateTime utcDateTime; |
| 26 | + QChar fixMode; |
| 27 | + int fixType; |
| 28 | + int quality; // from GPGGA |
| 29 | + int satellitesUsed; // from GPGGA |
| 30 | + QChar status; // from GPRMC A,V |
| 31 | + QList<int> satPrn; // list of SVs in use; needed for QgsSatelliteInfo.inUse and other uses |
| 32 | + bool satInfoComplete; // based on GPGSV sentences - to be used to determine when to graph signal and satellite position |
| 33 | +}; |
| 34 | + |
| 35 | +/**Abstract base class for connection to a GPS device*/ |
| 36 | +class QgsGPSConnection: QObject { |
| 37 | +%TypeHeaderCode |
| 38 | +#include <qgsgpsconnection.h> |
| 39 | +%End |
| 40 | +public: |
| 41 | + enum Status { |
| 42 | + NotConnected, Connected, DataReceived, GPSDataReceived |
| 43 | + }; |
| 44 | + |
| 45 | + /**Constructor |
| 46 | + @param dev input device for the connection (e.g. serial device). The class takes ownership of the object |
| 47 | + @param pollIntervall update intervall in milliseconds*/ |
| 48 | + QgsGPSConnection(QIODevice* dev); |
| 49 | + virtual ~QgsGPSConnection(); |
| 50 | + /**Opens connection to device*/ |
| 51 | + bool connect(); |
| 52 | + /**Closes connection to device*/ |
| 53 | + bool close(); |
| 54 | + |
| 55 | + /**Sets the GPS source. The class takes ownership of the device class*/ |
| 56 | + void setSource(QIODevice* source); |
| 57 | + |
| 58 | + /**Returns the status. Possible state are not connected, connected, data received*/ |
| 59 | + Status status() const; |
| 60 | + |
| 61 | + /**Returns the current gps information (lat, lon, etc.)*/ |
| 62 | + QgsGPSInformation currentGPSInformation() const; |
| 63 | + |
| 64 | +signals: |
| 65 | + void stateChanged( const QgsGPSInformation& info ); |
| 66 | + void nmeaSentenceReceived(const QString& substring); // added to capture 'raw' data |
| 67 | + |
| 68 | +protected slots: |
| 69 | + /**Parse available data source content*/ |
| 70 | + virtual void parseData() = 0; |
| 71 | +}; |
0 commit comments