QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Static Public Attributes | Protected Slots | Protected Attributes | List of all members
QgsGpsConnection Class Referenceabstract

Abstract base class for connection to a GPS device. More...

#include <qgsgpsconnection.h>

Inheritance diagram for QgsGpsConnection:
Inheritance graph
[legend]

Public Types

enum  Status { NotConnected , Connected , DataReceived , GPSDataReceived }
 

Signals

void fixStatusChanged (Qgis::GpsFixStatus status)
 Emitted when the GPS device fix status is changed.
 
void nmeaSentenceReceived (const QString &substring)
 Emitted whenever the GPS device receives a raw NMEA sentence.
 
void positionChanged (const QgsPoint &point)
 Emitted when the GPS position changes.
 
void stateChanged (const QgsGpsInformation &info)
 Emitted whenever the GPS state is changed.
 

Public Member Functions

 QgsGpsConnection (QIODevice *dev)
 Constructor.
 
 ~QgsGpsConnection () override
 
bool close ()
 Closes connection to device.
 
bool connect ()
 Opens connection to device.
 
QgsGpsInformation currentGPSInformation () const
 Returns the current gps information (lat, lon, etc.)
 
QgsPoint lastValidLocation () const
 Returns the last valid location obtained by the device.
 
void setSource (QIODevice *source)
 Sets the GPS source. The class takes ownership of the device class.
 
Status status () const
 Returns the status. Possible state are not connected, connected, data received.
 

Static Public Attributes

static const QgsSettingsEntryIntegersettingGpsAcquisitionInterval = new QgsSettingsEntryInteger( QStringLiteral( "acquisition-interval" ), QgsSettingsTree::sTreeGps, 0, QStringLiteral( "GPS track point acquisition interval" ) )
 Settings entry GPS track point acquisition interval.
 
static const QgsSettingsEntryBoolsettingGpsApplyLeapSecondsCorrection = new QgsSettingsEntryBool( QStringLiteral( "apply-leap-seconds-correction" ), QgsSettingsTree::sTreeGps, true, QStringLiteral( "Whether leap seconds corrections should be applied to GPS timestamps" ) )
 Settings entry GPS apply leap seconds correction.
 
static const QgsSettingsEntryBoolsettingGpsBearingFromTravelDirection = new QgsSettingsEntryBool( QStringLiteral( "calculate-bearing-from-travel" ), QgsSettingsTree::sTreeGps, false, QStringLiteral( "Calculate GPS bearing from travel direction" ) )
 Settings entry GPS calculate bearing from travel direction.
 
static const QgsSettingsEntryDoublesettingGpsDistanceThreshold = new QgsSettingsEntryDouble( QStringLiteral( "distance-threshold" ), QgsSettingsTree::sTreeGps, 0, QStringLiteral( "GPS track point distance threshold" ) )
 Settings entry GPS track point distance threshold.
 
static const QgsSettingsEntryIntegersettingGpsLeapSeconds = new QgsSettingsEntryInteger( QStringLiteral( "leap-seconds" ), QgsSettingsTree::sTreeGps, 18, QStringLiteral( "Leap seconds correction amount (in seconds)" ) )
 Settings entry GPS leap seconds correction amount (in seconds)
 
static const QgsSettingsEntryEnumFlag< Qgis::GpsConnectionType > * settingsGpsConnectionType = new QgsSettingsEntryEnumFlag<Qgis::GpsConnectionType>( QStringLiteral( "gps-connection-type" ), QgsSettingsTree::sTreeGps, Qgis::GpsConnectionType::Automatic, QStringLiteral( "GPS connection type" ) )
 Settings entry GPS connection type.
 
static const QgsSettingsEntryStringsettingsGpsdDeviceName = new QgsSettingsEntryString( QStringLiteral( "gpsd-device-name" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPSD connection device name" ) )
 Settings entry GPSD device name.
 
static const QgsSettingsEntryStringsettingsGpsdHostName = new QgsSettingsEntryString( QStringLiteral( "gpsd-host-name" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPSD connection host name" ) )
 Settings entry GPSD host name.
 
static const QgsSettingsEntryIntegersettingsGpsdPortNumber = new QgsSettingsEntryInteger( QStringLiteral( "gpsd-port" ), QgsSettingsTree::sTreeGps, 2947, QStringLiteral( "GPSD port number" ) )
 Settings entry GPSD port number.
 
static const QgsSettingsEntryStringsettingsGpsSerialDevice = new QgsSettingsEntryString( QStringLiteral( "gpsd-serial-device" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPS serial device name" ) )
 Settings entry GPS serial device name.
 
static const QgsSettingsEntryIntegersettingsGpsTimeStampOffsetFromUtc = new QgsSettingsEntryInteger( QStringLiteral( "timestamp-offset-from-utc" ), QgsSettingsTree::sTreeGps, 0, QStringLiteral( "GPS time stamp offset from UTC (in seconds)" ) )
 Settings entry GPS time offset from UTC in seconds.
 
static const QgsSettingsEntryEnumFlag< Qt::TimeSpec > * settingsGpsTimeStampSpecification = new QgsSettingsEntryEnumFlag<Qt::TimeSpec>( QStringLiteral( "timestamp-time-spec" ), QgsSettingsTree::sTreeGps, Qt::TimeSpec::LocalTime, QStringLiteral( "GPS time stamp specification" ) )
 Settings entry time specification for GPS time stamps.
 
static const QgsSettingsEntryStringsettingsGpsTimeStampTimeZone = new QgsSettingsEntryString( QStringLiteral( "timestamp-time-zone" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPS time stamp time zone" ) )
 Settings entry GPS time stamp time zone.
 

Protected Slots

virtual void parseData ()=0
 Parse available data source content.
 

Protected Attributes

QgsGpsInformation mLastGPSInformation
 Last state of the gps related variables (e.g. position, time, ...)
 
std::unique_ptr< QIODevice > mSource
 Data source (e.g. serial device, socket, file,...)
 
Status mStatus = NotConnected
 Connection status.
 

Detailed Description

Abstract base class for connection to a GPS device.

Definition at line 49 of file qgsgpsconnection.h.

Member Enumeration Documentation

◆ Status

Enumerator
NotConnected 
Connected 
DataReceived 
GPSDataReceived 

Definition at line 69 of file qgsgpsconnection.h.

Constructor & Destructor Documentation

◆ QgsGpsConnection()

QgsGpsConnection::QgsGpsConnection ( QIODevice *  dev)

Constructor.

Parameters
devinput device for the connection (e.g. serial device). The class takes ownership of the object

Definition at line 54 of file qgsgpsconnection.cpp.

◆ ~QgsGpsConnection()

QgsGpsConnection::~QgsGpsConnection ( )
override

Definition at line 64 of file qgsgpsconnection.cpp.

Member Function Documentation

◆ close()

bool QgsGpsConnection::close ( )

Closes connection to device.

Definition at line 84 of file qgsgpsconnection.cpp.

◆ connect()

bool QgsGpsConnection::connect ( )

Opens connection to device.

Definition at line 69 of file qgsgpsconnection.cpp.

◆ currentGPSInformation()

QgsGpsInformation QgsGpsConnection::currentGPSInformation ( ) const
inline

Returns the current gps information (lat, lon, etc.)

Definition at line 136 of file qgsgpsconnection.h.

◆ fixStatusChanged

void QgsGpsConnection::fixStatusChanged ( Qgis::GpsFixStatus  status)
signal

Emitted when the GPS device fix status is changed.

Since
QGIS 3.30

◆ lastValidLocation()

QgsPoint QgsGpsConnection::lastValidLocation ( ) const
inline

Returns the last valid location obtained by the device.

Since
QGIS 3.30

Definition at line 143 of file qgsgpsconnection.h.

◆ nmeaSentenceReceived

void QgsGpsConnection::nmeaSentenceReceived ( const QString &  substring)
signal

Emitted whenever the GPS device receives a raw NMEA sentence.

◆ parseData

virtual void QgsGpsConnection::parseData ( )
protectedpure virtualslot

Parse available data source content.

◆ positionChanged

void QgsGpsConnection::positionChanged ( const QgsPoint point)
signal

Emitted when the GPS position changes.

This signal is only emitted when the new GPS location is considered valid (see QgsGpsInformation::isValid()).

Since
QGIS 3.30

◆ setSource()

void QgsGpsConnection::setSource ( QIODevice *  source)

Sets the GPS source. The class takes ownership of the device class.

Definition at line 117 of file qgsgpsconnection.cpp.

◆ stateChanged

void QgsGpsConnection::stateChanged ( const QgsGpsInformation info)
signal

Emitted whenever the GPS state is changed.

◆ status()

Status QgsGpsConnection::status ( ) const
inline

Returns the status. Possible state are not connected, connected, data received.

Definition at line 133 of file qgsgpsconnection.h.

Member Data Documentation

◆ mLastGPSInformation

QgsGpsInformation QgsGpsConnection::mLastGPSInformation
protected

Last state of the gps related variables (e.g. position, time, ...)

Definition at line 179 of file qgsgpsconnection.h.

◆ mSource

std::unique_ptr< QIODevice > QgsGpsConnection::mSource
protected

Data source (e.g. serial device, socket, file,...)

Definition at line 177 of file qgsgpsconnection.h.

◆ mStatus

Status QgsGpsConnection::mStatus = NotConnected
protected

Connection status.

Definition at line 181 of file qgsgpsconnection.h.

◆ settingGpsAcquisitionInterval

const QgsSettingsEntryInteger * QgsGpsConnection::settingGpsAcquisitionInterval = new QgsSettingsEntryInteger( QStringLiteral( "acquisition-interval" ), QgsSettingsTree::sTreeGps, 0, QStringLiteral( "GPS track point acquisition interval" ) )
static

Settings entry GPS track point acquisition interval.

Definition at line 94 of file qgsgpsconnection.h.

◆ settingGpsApplyLeapSecondsCorrection

const QgsSettingsEntryBool * QgsGpsConnection::settingGpsApplyLeapSecondsCorrection = new QgsSettingsEntryBool( QStringLiteral( "apply-leap-seconds-correction" ), QgsSettingsTree::sTreeGps, true, QStringLiteral( "Whether leap seconds corrections should be applied to GPS timestamps" ) )
static

Settings entry GPS apply leap seconds correction.

Definition at line 103 of file qgsgpsconnection.h.

◆ settingGpsBearingFromTravelDirection

const QgsSettingsEntryBool * QgsGpsConnection::settingGpsBearingFromTravelDirection = new QgsSettingsEntryBool( QStringLiteral( "calculate-bearing-from-travel" ), QgsSettingsTree::sTreeGps, false, QStringLiteral( "Calculate GPS bearing from travel direction" ) )
static

Settings entry GPS calculate bearing from travel direction.

Definition at line 100 of file qgsgpsconnection.h.

◆ settingGpsDistanceThreshold

const QgsSettingsEntryDouble * QgsGpsConnection::settingGpsDistanceThreshold = new QgsSettingsEntryDouble( QStringLiteral( "distance-threshold" ), QgsSettingsTree::sTreeGps, 0, QStringLiteral( "GPS track point distance threshold" ) )
static

Settings entry GPS track point distance threshold.

Definition at line 97 of file qgsgpsconnection.h.

◆ settingGpsLeapSeconds

const QgsSettingsEntryInteger * QgsGpsConnection::settingGpsLeapSeconds = new QgsSettingsEntryInteger( QStringLiteral( "leap-seconds" ), QgsSettingsTree::sTreeGps, 18, QStringLiteral( "Leap seconds correction amount (in seconds)" ) )
static

Settings entry GPS leap seconds correction amount (in seconds)

Definition at line 106 of file qgsgpsconnection.h.

◆ settingsGpsConnectionType

const QgsSettingsEntryEnumFlag< Qgis::GpsConnectionType > * QgsGpsConnection::settingsGpsConnectionType = new QgsSettingsEntryEnumFlag<Qgis::GpsConnectionType>( QStringLiteral( "gps-connection-type" ), QgsSettingsTree::sTreeGps, Qgis::GpsConnectionType::Automatic, QStringLiteral( "GPS connection type" ) )
static

Settings entry GPS connection type.

Definition at line 79 of file qgsgpsconnection.h.

◆ settingsGpsdDeviceName

const QgsSettingsEntryString * QgsGpsConnection::settingsGpsdDeviceName = new QgsSettingsEntryString( QStringLiteral( "gpsd-device-name" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPSD connection device name" ) )
static

Settings entry GPSD device name.

Definition at line 88 of file qgsgpsconnection.h.

◆ settingsGpsdHostName

const QgsSettingsEntryString * QgsGpsConnection::settingsGpsdHostName = new QgsSettingsEntryString( QStringLiteral( "gpsd-host-name" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPSD connection host name" ) )
static

Settings entry GPSD host name.

Definition at line 82 of file qgsgpsconnection.h.

◆ settingsGpsdPortNumber

const QgsSettingsEntryInteger * QgsGpsConnection::settingsGpsdPortNumber = new QgsSettingsEntryInteger( QStringLiteral( "gpsd-port" ), QgsSettingsTree::sTreeGps, 2947, QStringLiteral( "GPSD port number" ) )
static

Settings entry GPSD port number.

Definition at line 85 of file qgsgpsconnection.h.

◆ settingsGpsSerialDevice

const QgsSettingsEntryString * QgsGpsConnection::settingsGpsSerialDevice = new QgsSettingsEntryString( QStringLiteral( "gpsd-serial-device" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPS serial device name" ) )
static

Settings entry GPS serial device name.

Definition at line 91 of file qgsgpsconnection.h.

◆ settingsGpsTimeStampOffsetFromUtc

const QgsSettingsEntryInteger * QgsGpsConnection::settingsGpsTimeStampOffsetFromUtc = new QgsSettingsEntryInteger( QStringLiteral( "timestamp-offset-from-utc" ), QgsSettingsTree::sTreeGps, 0, QStringLiteral( "GPS time stamp offset from UTC (in seconds)" ) )
static

Settings entry GPS time offset from UTC in seconds.

Definition at line 115 of file qgsgpsconnection.h.

◆ settingsGpsTimeStampSpecification

const QgsSettingsEntryEnumFlag< Qt::TimeSpec > * QgsGpsConnection::settingsGpsTimeStampSpecification = new QgsSettingsEntryEnumFlag<Qt::TimeSpec>( QStringLiteral( "timestamp-time-spec" ), QgsSettingsTree::sTreeGps, Qt::TimeSpec::LocalTime, QStringLiteral( "GPS time stamp specification" ) )
static

Settings entry time specification for GPS time stamps.

Definition at line 109 of file qgsgpsconnection.h.

◆ settingsGpsTimeStampTimeZone

const QgsSettingsEntryString * QgsGpsConnection::settingsGpsTimeStampTimeZone = new QgsSettingsEntryString( QStringLiteral( "timestamp-time-zone" ), QgsSettingsTree::sTreeGps, QString(), QStringLiteral( "GPS time stamp time zone" ) )
static

Settings entry GPS time stamp time zone.

Definition at line 112 of file qgsgpsconnection.h.


The documentation for this class was generated from the following files: