QGIS API Documentation 3.29.0-Master (006c3c0232)
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. More...
 
void nmeaSentenceReceived (const QString &substring)
 Emitted whenever the GPS device receives a raw NMEA sentence. More...
 
void positionChanged (const QgsPoint &point)
 Emitted when the GPS position changes. More...
 
void stateChanged (const QgsGpsInformation &info)
 Emitted whenever the GPS state is changed. More...
 

Public Member Functions

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

Static Public Attributes

static const QgsSettingsEntryInteger settingGpsAcquisitionInterval = QgsSettingsEntryInteger( QStringLiteral( "acquisition-interval" ), QgsSettings::Prefix::GPS, 0, QStringLiteral( "GPS track point acquisition interval" ) )
 Settings entry GPS track point acquisition interval. More...
 
static const QgsSettingsEntryBool settingGpsApplyLeapSecondsCorrection = QgsSettingsEntryBool( QStringLiteral( "apply-leap-seconds-correction" ), QgsSettings::Prefix::GPS, true, QStringLiteral( "Whether leap seconds corrections should be applied to GPS timestamps" ) )
 Settings entry GPS apply leap seconds correction. More...
 
static const QgsSettingsEntryBool settingGpsBearingFromTravelDirection = QgsSettingsEntryBool( QStringLiteral( "calculate-bearing-from-travel" ), QgsSettings::Prefix::GPS, false, QStringLiteral( "Calculate GPS bearing from travel direction" ) )
 Settings entry GPS calculate bearing from travel direction. More...
 
static const QgsSettingsEntryDouble settingGpsDistanceThreshold = QgsSettingsEntryDouble( QStringLiteral( "distance-threshold" ), QgsSettings::Prefix::GPS, 0, QStringLiteral( "GPS track point distance threshold" ) )
 Settings entry GPS track point distance threshold. More...
 
static const QgsSettingsEntryInteger settingGpsLeapSeconds = QgsSettingsEntryInteger( QStringLiteral( "leap-seconds" ), QgsSettings::Prefix::GPS, 18, QStringLiteral( "Leap seconds correction amount (in seconds)" ) )
 Settings entry GPS leap seconds correction amount (in seconds) More...
 
static const QgsSettingsEntryEnumFlag< Qgis::GpsConnectionTypesettingsGpsConnectionType = QgsSettingsEntryEnumFlag<Qgis::GpsConnectionType>( QStringLiteral( "gps-connection-type" ), QgsSettings::Prefix::GPS, Qgis::GpsConnectionType::Automatic, QStringLiteral( "GPS connection type" ) )
 Settings entry GPS connection type. More...
 
static const QgsSettingsEntryString settingsGpsdDeviceName = QgsSettingsEntryString( QStringLiteral( "gpsd-device-name" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPSD connection device name" ) )
 Settings entry GPSD device name. More...
 
static const QgsSettingsEntryString settingsGpsdHostName = QgsSettingsEntryString( QStringLiteral( "gpsd-host-name" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPSD connection host name" ) )
 Settings entry GPSD host name. More...
 
static const QgsSettingsEntryInteger settingsGpsdPortNumber = QgsSettingsEntryInteger( QStringLiteral( "gpsd-port" ), QgsSettings::Prefix::GPS, 2947, QStringLiteral( "GPSD port number" ) )
 Settings entry GPSD port number. More...
 
static const QgsSettingsEntryString settingsGpsSerialDevice = QgsSettingsEntryString( QStringLiteral( "gpsd-serial-device" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPS serial device name" ) )
 Settings entry GPS serial device name. More...
 
static const QgsSettingsEntryInteger settingsGpsTimeStampOffsetFromUtc = QgsSettingsEntryInteger( QStringLiteral( "timestamp-offset-from-utc" ), QgsSettings::Prefix::GPS, 0, QStringLiteral( "GPS time stamp offset from UTC (in seconds)" ) )
 Settings entry GPS time offset from UTC in seconds. More...
 
static const QgsSettingsEntryEnumFlag< Qt::TimeSpec > settingsGpsTimeStampSpecification = QgsSettingsEntryEnumFlag<Qt::TimeSpec>( QStringLiteral( "timestamp-time-spec" ), QgsSettings::Prefix::GPS, Qt::TimeSpec::LocalTime, QStringLiteral( "GPS time stamp specification" ) )
 Settings entry time specification for GPS time stamps. More...
 
static const QgsSettingsEntryString settingsGpsTimeStampTimeZone = QgsSettingsEntryString( QStringLiteral( "timestamp-time-zone" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPS time stamp time zone" ) )
 Settings entry GPS time stamp time zone. More...
 

Protected Slots

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

Protected Attributes

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

Detailed Description

Abstract base class for connection to a GPS device.

Definition at line 44 of file qgsgpsconnection.h.

Member Enumeration Documentation

◆ Status

Enumerator
NotConnected 
Connected 
DataReceived 
GPSDataReceived 

Definition at line 66 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 22 of file qgsgpsconnection.cpp.

◆ ~QgsGpsConnection()

QgsGpsConnection::~QgsGpsConnection ( )
override

Definition at line 32 of file qgsgpsconnection.cpp.

Member Function Documentation

◆ close()

bool QgsGpsConnection::close ( )

Closes connection to device.

Definition at line 52 of file qgsgpsconnection.cpp.

◆ connect()

bool QgsGpsConnection::connect ( )

Opens connection to device.

Definition at line 37 of file qgsgpsconnection.cpp.

◆ currentGPSInformation()

QgsGpsInformation QgsGpsConnection::currentGPSInformation ( ) const
inline

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

Definition at line 131 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 138 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 85 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 128 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 174 of file qgsgpsconnection.h.

◆ mSource

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

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

Definition at line 172 of file qgsgpsconnection.h.

◆ mStatus

Status QgsGpsConnection::mStatus = NotConnected
protected

Connection status.

Definition at line 176 of file qgsgpsconnection.h.

◆ settingGpsAcquisitionInterval

const QgsSettingsEntryInteger QgsGpsConnection::settingGpsAcquisitionInterval = QgsSettingsEntryInteger( QStringLiteral( "acquisition-interval" ), QgsSettings::Prefix::GPS, 0, QStringLiteral( "GPS track point acquisition interval" ) )
inlinestatic

Settings entry GPS track point acquisition interval.

Definition at line 90 of file qgsgpsconnection.h.

◆ settingGpsApplyLeapSecondsCorrection

const QgsSettingsEntryBool QgsGpsConnection::settingGpsApplyLeapSecondsCorrection = QgsSettingsEntryBool( QStringLiteral( "apply-leap-seconds-correction" ), QgsSettings::Prefix::GPS, true, QStringLiteral( "Whether leap seconds corrections should be applied to GPS timestamps" ) )
inlinestatic

Settings entry GPS apply leap seconds correction.

Definition at line 99 of file qgsgpsconnection.h.

◆ settingGpsBearingFromTravelDirection

const QgsSettingsEntryBool QgsGpsConnection::settingGpsBearingFromTravelDirection = QgsSettingsEntryBool( QStringLiteral( "calculate-bearing-from-travel" ), QgsSettings::Prefix::GPS, false, QStringLiteral( "Calculate GPS bearing from travel direction" ) )
inlinestatic

Settings entry GPS calculate bearing from travel direction.

Definition at line 96 of file qgsgpsconnection.h.

◆ settingGpsDistanceThreshold

const QgsSettingsEntryDouble QgsGpsConnection::settingGpsDistanceThreshold = QgsSettingsEntryDouble( QStringLiteral( "distance-threshold" ), QgsSettings::Prefix::GPS, 0, QStringLiteral( "GPS track point distance threshold" ) )
inlinestatic

Settings entry GPS track point distance threshold.

Definition at line 93 of file qgsgpsconnection.h.

◆ settingGpsLeapSeconds

const QgsSettingsEntryInteger QgsGpsConnection::settingGpsLeapSeconds = QgsSettingsEntryInteger( QStringLiteral( "leap-seconds" ), QgsSettings::Prefix::GPS, 18, QStringLiteral( "Leap seconds correction amount (in seconds)" ) )
inlinestatic

Settings entry GPS leap seconds correction amount (in seconds)

Definition at line 102 of file qgsgpsconnection.h.

◆ settingsGpsConnectionType

const QgsSettingsEntryEnumFlag<Qgis::GpsConnectionType> QgsGpsConnection::settingsGpsConnectionType = QgsSettingsEntryEnumFlag<Qgis::GpsConnectionType>( QStringLiteral( "gps-connection-type" ), QgsSettings::Prefix::GPS, Qgis::GpsConnectionType::Automatic, QStringLiteral( "GPS connection type" ) )
inlinestatic

Settings entry GPS connection type.

Definition at line 75 of file qgsgpsconnection.h.

◆ settingsGpsdDeviceName

const QgsSettingsEntryString QgsGpsConnection::settingsGpsdDeviceName = QgsSettingsEntryString( QStringLiteral( "gpsd-device-name" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPSD connection device name" ) )
inlinestatic

Settings entry GPSD device name.

Definition at line 84 of file qgsgpsconnection.h.

◆ settingsGpsdHostName

const QgsSettingsEntryString QgsGpsConnection::settingsGpsdHostName = QgsSettingsEntryString( QStringLiteral( "gpsd-host-name" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPSD connection host name" ) )
inlinestatic

Settings entry GPSD host name.

Definition at line 78 of file qgsgpsconnection.h.

◆ settingsGpsdPortNumber

const QgsSettingsEntryInteger QgsGpsConnection::settingsGpsdPortNumber = QgsSettingsEntryInteger( QStringLiteral( "gpsd-port" ), QgsSettings::Prefix::GPS, 2947, QStringLiteral( "GPSD port number" ) )
inlinestatic

Settings entry GPSD port number.

Definition at line 81 of file qgsgpsconnection.h.

◆ settingsGpsSerialDevice

const QgsSettingsEntryString QgsGpsConnection::settingsGpsSerialDevice = QgsSettingsEntryString( QStringLiteral( "gpsd-serial-device" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPS serial device name" ) )
inlinestatic

Settings entry GPS serial device name.

Definition at line 87 of file qgsgpsconnection.h.

◆ settingsGpsTimeStampOffsetFromUtc

const QgsSettingsEntryInteger QgsGpsConnection::settingsGpsTimeStampOffsetFromUtc = QgsSettingsEntryInteger( QStringLiteral( "timestamp-offset-from-utc" ), QgsSettings::Prefix::GPS, 0, QStringLiteral( "GPS time stamp offset from UTC (in seconds)" ) )
inlinestatic

Settings entry GPS time offset from UTC in seconds.

Definition at line 111 of file qgsgpsconnection.h.

◆ settingsGpsTimeStampSpecification

const QgsSettingsEntryEnumFlag<Qt::TimeSpec> QgsGpsConnection::settingsGpsTimeStampSpecification = QgsSettingsEntryEnumFlag<Qt::TimeSpec>( QStringLiteral( "timestamp-time-spec" ), QgsSettings::Prefix::GPS, Qt::TimeSpec::LocalTime, QStringLiteral( "GPS time stamp specification" ) )
inlinestatic

Settings entry time specification for GPS time stamps.

Definition at line 105 of file qgsgpsconnection.h.

◆ settingsGpsTimeStampTimeZone

const QgsSettingsEntryString QgsGpsConnection::settingsGpsTimeStampTimeZone = QgsSettingsEntryString( QStringLiteral( "timestamp-time-zone" ), QgsSettings::Prefix::GPS, QString(), QStringLiteral( "GPS time stamp time zone" ) )
inlinestatic

Settings entry GPS time stamp time zone.

Definition at line 108 of file qgsgpsconnection.h.


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