Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sip files for gps connection. Patch from Marcel Huber, ticket #4826
- Loading branch information
Showing
7 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
struct QgsSatelliteInfo { | ||
%TypeHeaderCode | ||
#include <qgsgpsconnection.h> | ||
%End | ||
int id; | ||
bool inUse; | ||
int elevation; | ||
int azimuth; | ||
int signal; | ||
}; | ||
|
||
struct QgsGPSInformation { | ||
%TypeHeaderCode | ||
#include <qgsgpsconnection.h> | ||
%End | ||
double latitude; | ||
double longitude; | ||
double elevation; | ||
double speed; //in km/h | ||
double direction; | ||
QList<QgsSatelliteInfo> satellitesInView; | ||
double pdop; | ||
double hdop; | ||
double vdop; | ||
QDateTime utcDateTime; | ||
QChar fixMode; | ||
int fixType; | ||
int quality; // from GPGGA | ||
int satellitesUsed; // from GPGGA | ||
QChar status; // from GPRMC A,V | ||
QList<int> satPrn; // list of SVs in use; needed for QgsSatelliteInfo.inUse and other uses | ||
bool satInfoComplete; // based on GPGSV sentences - to be used to determine when to graph signal and satellite position | ||
}; | ||
|
||
/**Abstract base class for connection to a GPS device*/ | ||
class QgsGPSConnection: QObject { | ||
%TypeHeaderCode | ||
#include <qgsgpsconnection.h> | ||
%End | ||
public: | ||
enum Status { | ||
NotConnected, Connected, DataReceived, GPSDataReceived | ||
}; | ||
|
||
/**Constructor | ||
@param dev input device for the connection (e.g. serial device). The class takes ownership of the object | ||
@param pollIntervall update intervall in milliseconds*/ | ||
QgsGPSConnection(QIODevice* dev); | ||
virtual ~QgsGPSConnection(); | ||
/**Opens connection to device*/ | ||
bool connect(); | ||
/**Closes connection to device*/ | ||
bool close(); | ||
|
||
/**Sets the GPS source. The class takes ownership of the device class*/ | ||
void setSource(QIODevice* source); | ||
|
||
/**Returns the status. Possible state are not connected, connected, data received*/ | ||
Status status() const; | ||
|
||
/**Returns the current gps information (lat, lon, etc.)*/ | ||
QgsGPSInformation currentGPSInformation() const; | ||
|
||
signals: | ||
void stateChanged( const QgsGPSInformation& info ); | ||
void nmeaSentenceReceived(const QString& substring); // added to capture 'raw' data | ||
|
||
protected slots: | ||
/**Parse available data source content*/ | ||
virtual void parseData() = 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/**A singleton class to register / unregister existing GPS connections such that the information | ||
is available to all classes and plugins*/ | ||
class QgsGPSConnectionRegistry { | ||
%TypeHeaderCode | ||
#include <qgsgpsconnectionregistry.h> | ||
%End | ||
public: | ||
static QgsGPSConnectionRegistry* instance(); | ||
~QgsGPSConnectionRegistry(); | ||
|
||
/**Inserts a connection into the registry. The connection is owned by the registry class until it is unregistered again*/ | ||
void registerConnection(QgsGPSConnection* c); | ||
/**Unregisters connection. The registry does no longer own the connection*/ | ||
void unregisterConnection(QgsGPSConnection* c); | ||
|
||
QList<const QgsGPSConnection*> connectionList() const; | ||
|
||
protected: | ||
QgsGPSConnectionRegistry(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/**Evaluates NMEA sentences coming from gpsd*/ | ||
class QgsGpsdConnection: QgsNMEAConnection { | ||
%TypeHeaderCode | ||
#include "qgsgpsdconnection.h" | ||
%End | ||
public: | ||
QgsGpsdConnection(QString host, qint16 port, QString device); | ||
~QgsGpsdConnection(); | ||
|
||
private slots: | ||
void connected(); | ||
void error(QAbstractSocket::SocketError); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Class to detect the GPS port | ||
class QgsGPSDetector: QObject { | ||
%TypeHeaderCode | ||
#include "qgsgpsdetector.h" | ||
%End | ||
public: | ||
QgsGPSDetector(QString portName); | ||
~QgsGPSDetector(); | ||
|
||
static QList<QPair<QString, QString> > availablePorts(); | ||
|
||
public slots: | ||
void advance(); | ||
void detected(const QgsGPSInformation&); | ||
void connDestroyed(QObject *); | ||
|
||
signals: | ||
void detected( QgsGPSConnection * ); | ||
void detectionFailed(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/**Evaluates NMEA sentences coming from a GPS device*/ | ||
class QgsNMEAConnection: QgsGPSConnection { | ||
%TypeHeaderCode | ||
#include "qgsnmeaconnection.h" | ||
%End | ||
public: | ||
QgsNMEAConnection(QIODevice *dev); | ||
~QgsNMEAConnection(); | ||
|
||
//bool poll( QgsGPSInformation& info, int maxTime ); | ||
|
||
protected slots: | ||
/**Parse available data source content*/ | ||
void parseData(); | ||
|
||
protected: | ||
/**Splits mStringBuffer into sentences and calls libnmea*/ | ||
void processStringBuffer(); | ||
//handle the different sentence type | ||
void processGGASentence(const char* data, int len); | ||
void processRMCSentence(const char* data, int len); | ||
void processGSVSentence(const char* data, int len); | ||
void processVTGSentence(const char* data, int len); | ||
void processGSASentence(const char* data, int len); | ||
}; |