GPSBindingsHeadChanges.patch

Marcel Huber, 2012-01-16 09:20 AM

Download (6.89 KB)

View differences:

python/CMakeLists.txt
29 29

  
30 30
    ../src/core
31 31
    ../src/core/composer
32
    ../src/core/gps
33
    ../src/core/gps/qextserialport
32 34
    ../src/core/raster
33 35
    ../src/core/renderer
34 36
    ../src/core/spatialindex
python/core/core.sip
91 91
%Include qgsnetworkaccessmanager.sip
92 92

  
93 93
%Include symbology-ng-core.sip
94

  
95
%Include qgsgpsconnection.sip
96
%Include qgsgpsconnectionregistry.sip
97
%Include qgsgpsdconnection.sip
98
%Include qgsnmeaconnection.sip
99
%Include qgsgpsdetector.sip
python/core/qgsgpsconnection.sip
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
};
python/core/qgsgpsconnectionregistry.sip
1
/**A singleton class to register / unregister existing GPS connections such that the information
2
 is available to all classes and plugins*/
3
class QgsGPSConnectionRegistry {
4
%TypeHeaderCode
5
#include <qgsgpsconnectionregistry.h>
6
%End
7
public:
8
	static QgsGPSConnectionRegistry* instance();
9
	~QgsGPSConnectionRegistry();
10

  
11
	/**Inserts a connection into the registry. The connection is owned by the registry class until it is unregistered again*/
12
	void registerConnection(QgsGPSConnection* c);
13
	/**Unregisters connection. The registry does no longer own the connection*/
14
	void unregisterConnection(QgsGPSConnection* c);
15

  
16
	QList<const QgsGPSConnection*> connectionList() const;
17

  
18
protected:
19
	QgsGPSConnectionRegistry();
20
};
python/core/qgsgpsdconnection.sip
1
/**Evaluates NMEA sentences coming from gpsd*/
2
class QgsGpsdConnection: QgsNMEAConnection {
3
%TypeHeaderCode
4
#include "qgsgpsdconnection.h"
5
%End
6
public:
7
	QgsGpsdConnection(QString host, qint16 port, QString device);
8
	~QgsGpsdConnection();
9

  
10
private slots:
11
	void connected();
12
	void error(QAbstractSocket::SocketError);
13
};
python/core/qgsgpsdetector.sip
1
// Class to detect the GPS port
2
class QgsGPSDetector: QObject {
3
%TypeHeaderCode
4
#include "qgsgpsdetector.h"
5
%End
6
public:
7
	QgsGPSDetector(QString portName);
8
	~QgsGPSDetector();
9

  
10
	static QList<QPair<QString, QString> > availablePorts();
11

  
12
public slots:
13
	void advance();
14
	void detected(const QgsGPSInformation&);
15
	void connDestroyed(QObject *);
16

  
17
signals:
18
	void detected( QgsGPSConnection * );
19
	void detectionFailed();
20
};
python/core/qgsnmeaconnection.sip
1
/**Evaluates NMEA sentences coming from a GPS device*/
2
class QgsNMEAConnection: QgsGPSConnection {
3
%TypeHeaderCode
4
#include "qgsnmeaconnection.h"
5
%End
6
public:
7
	QgsNMEAConnection(QIODevice *dev);
8
	~QgsNMEAConnection();
9

  
10
	//bool poll( QgsGPSInformation& info, int maxTime );
11

  
12
protected slots:
13
	/**Parse available data source content*/
14
	void parseData();
15

  
16
protected:
17
	/**Splits mStringBuffer into sentences and calls libnmea*/
18
	void processStringBuffer();
19
	//handle the different sentence type
20
	void processGGASentence(const char* data, int len);
21
	void processRMCSentence(const char* data, int len);
22
	void processGSVSentence(const char* data, int len);
23
	void processVTGSentence(const char* data, int len);
24
	void processGSASentence(const char* data, int len);
25
};
0
-