Skip to content

Commit

Permalink
sipify core gps
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jun 8, 2017
1 parent e052933 commit e545d44
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 81 deletions.
6 changes: 0 additions & 6 deletions python/auto_sip.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ core/composer/qgspaperitem.sip
core/composer/qgsscalebarstyle.sip
core/composer/qgssingleboxscalebarstyle.sip
core/composer/qgsticksscalebarstyle.sip
core/gps/qgsgpsconnection.sip
core/gps/qgsgpsconnectionregistry.sip
core/gps/qgsgpsdconnection.sip
core/gps/qgsgpsdetector.sip
core/gps/qgsnmeaconnection.sip
core/gps/qgsqtlocationconnection.sip
core/symbology-ng/qgsrulebasedrenderer.sip
core/symbology-ng/qgssinglesymbolrenderer.sip
core/symbology-ng/qgsgeometrygeneratorsymbollayer.sip
Expand Down
85 changes: 54 additions & 31 deletions python/core/gps/qgsgpsconnection.sip
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsconnection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






struct QgsSatelliteInfo
{
%TypeHeaderCode
#include <qgsgpsconnection.h>
%End

int id;
bool inUse;
int elevation;
Expand All @@ -13,10 +22,6 @@ struct QgsSatelliteInfo

struct QgsGPSInformation
{
%TypeHeaderCode
#include <qgsgpsconnection.h>
%End

double latitude;
double longitude;
double elevation;
Expand All @@ -38,24 +43,15 @@ struct QgsGPSInformation
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>
#include <qgsgpsdconnection.h>
#include <qgsnmeaconnection.h>
%Docstring
Abstract base class for connection to a GPS device*
%End

%ConvertToSubClassCode
if (sipCpp->inherits("QgsGpsdConnection"))
sipType = sipType_QgsGpsdConnection;
else if (sipCpp->inherits("QgsNMEAConnection"))
sipType = sipType_QgsNMEAConnection;
else
sipType = NULL;
%TypeHeaderCode
#include "qgsgpsconnection.h"
%End

public:

enum Status
Expand All @@ -66,30 +62,57 @@ class QgsGPSConnection : QObject
GPSDataReceived
};

/** Constructor
@param dev input device for the connection (e.g. serial device). The class takes ownership of the object
*/
QgsGPSConnection( QIODevice *dev /Transfer/ );
%Docstring
Constructor
\param dev input device for the connection (e.g. serial device). The class takes ownership of the object
%End
virtual ~QgsGPSConnection();
/** Opens connection to device*/
bool connect();
/** Closes connection to device*/
%Docstring
Opens connection to device
:rtype: bool
%End
bool close();
%Docstring
Closes connection to device
:rtype: bool
%End

/** Sets the GPS source. The class takes ownership of the device class*/
void setSource( QIODevice *source /Transfer/ );
%Docstring
Sets the GPS source. The class takes ownership of the device class
%End

/** Returns the status. Possible state are not connected, connected, data received*/
Status status() const;
%Docstring
Returns the status. Possible state are not connected, connected, data received
:rtype: Status
%End

/** Returns the current gps information (lat, lon, etc.)*/
QgsGPSInformation currentGPSInformation() const;
%Docstring
Returns the current gps information (lat, lon, etc.)
:rtype: QgsGPSInformation
%End

signals:
void stateChanged( const QgsGPSInformation &info );
void nmeaSentenceReceived( const QString &substring );
void nmeaSentenceReceived( const QString &substring ); // added to capture 'raw' data

protected:

protected slots:
/** Parse available data source content*/
virtual void parseData() = 0;
%Docstring
Parse available data source content
%End
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsconnection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
48 changes: 40 additions & 8 deletions python/core/gps/qgsgpsconnectionregistry.sip
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
/** A singleton class to register / unregister existing GPS connections such that the information
is available to all classes and plugins*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsconnectionregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsGPSConnectionRegistry
{
%Docstring
A class to register / unregister existing GPS connections such that the information
is available to all classes and plugins.

QgsGPSConnectionRegistry is not usually directly created, but rather accessed through
QgsApplication.gpsConnectionRegistry().
%End

%TypeHeaderCode
#include <qgsgpsconnectionregistry.h>
#include "qgsgpsconnectionregistry.h"
%End
public:
QgsGPSConnectionRegistry();
~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*/
%Docstring
Inserts a connection into the registry. The connection is owned by the registry class until it is unregistered again
%End
void unregisterConnection( QgsGPSConnection *c );
%Docstring
Unregisters connection. The registry does no longer own the connection
%End

QList< QgsGPSConnection *> connectionList() const;
%Docstring
:rtype: list of QgsGPSConnection
%End

private:

QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry &rh );
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsconnectionregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
26 changes: 25 additions & 1 deletion python/core/gps/qgsgpsdconnection.sip
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
/** Evaluates NMEA sentences coming from gpsd*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsdconnection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsGpsdConnection: QgsNMEAConnection
{
%Docstring
Evaluates NMEA sentences coming from gpsd*
%End

%TypeHeaderCode
#include "qgsgpsdconnection.h"
%End
public:
QgsGpsdConnection( const QString &host, qint16 port, const QString &device );
~QgsGpsdConnection();

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsdconnection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
35 changes: 31 additions & 4 deletions python/core/gps/qgsgpsdetector.sip
Original file line number Diff line number Diff line change
@@ -1,22 +1,49 @@
// Class to detect the GPS port
class QgsGPSDetector: QObject
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsdetector.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsGPSDetector : QObject
{
%Docstring
Class to detect the GPS port
%End

%TypeHeaderCode
#include "qgsgpsdetector.h"
%End

public:
QgsGPSDetector( const QString &portName );
~QgsGPSDetector();

static QList< QPair<QString, QString> > availablePorts();
%Docstring
:rtype: list of QPair<str, QString>
%End

public slots:
void advance();
void detected( const QgsGPSInformation& );
void detected( const QgsGPSInformation & );
void connDestroyed( QObject * );

signals:
void detected( QgsGPSConnection * );
void detectionFailed();

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsgpsdetector.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
39 changes: 33 additions & 6 deletions python/core/gps/qgsnmeaconnection.sip
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
/** Evaluates NMEA sentences coming from a GPS device*/
class QgsNMEAConnection: QgsGPSConnection {
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsnmeaconnection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsNMEAConnection: QgsGPSConnection
{
%Docstring
Evaluates NMEA sentences coming from a GPS device
%End

%TypeHeaderCode
#include "qgsnmeaconnection.h"
%End
Expand All @@ -8,16 +23,28 @@ class QgsNMEAConnection: QgsGPSConnection {
~QgsNMEAConnection();

protected slots:
/** Parse available data source content*/
void parseData();
virtual void parseData();

%Docstring
Parse available data source content
%End

protected:
/** Splits mStringBuffer into sentences and calls libnmea*/
void processStringBuffer();
//handle the different sentence type
%Docstring
Splits mStringBuffer into sentences and calls libnmea
%End
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 );
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/gps/qgsnmeaconnection.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Loading

0 comments on commit e545d44

Please sign in to comment.