Class: QgsGpsConnection

Abstract base class for connection to a GPS device

Class Hierarchy

Inheritance diagram of qgis.core.QgsGpsConnection

Base classes

QObject

Subclasses

QgsNmeaConnection

Evaluates NMEA sentences coming from a GPS device

QgsQtLocationConnection

A GPS connection subclass based on the Qt Location libraries.

Methods

close

Closes connection to device

connect

Opens connection to device

currentGPSInformation

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

lastValidLocation

Returns the last valid location obtained by the device.

parseData

Parse available data source content

setSource

Sets the GPS source.

status

Returns the status.

Signals

fixStatusChanged

Emitted when the GPS device fix status is changed.

nmeaSentenceReceived

Emitted whenever the GPS device receives a raw NMEA sentence.

positionChanged

Emitted when the GPS position changes.

stateChanged

Emitted whenever the GPS state is changed.

Attributes

Connected

DataReceived

GPSDataReceived

NotConnected

class qgis.core.QgsGpsConnection[source]

Bases: QObject

__init__(dev: QIODevice | None)

Constructor

Parameters:

dev (Optional[QIODevice]) – input device for the connection (e.g. serial device). The class takes ownership of the object

Connected = 1
DataReceived = 2
GPSDataReceived = 3
NotConnected = 0
class Status

Bases: int

close(self) bool[source]

Closes connection to device

Return type:

bool

connect(self) bool[source]

Opens connection to device

Return type:

bool

currentGPSInformation(self) QgsGpsInformation[source]

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

Return type:

QgsGpsInformation

signal fixStatusChanged(status: Qgis.GpsFixStatus)[source]

Emitted when the GPS device fix status is changed.

Added in version 3.30.

Parameters:

status (Qgis.GpsFixStatus)

lastValidLocation(self) QgsPoint[source]

Returns the last valid location obtained by the device.

Added in version 3.30.

Return type:

QgsPoint

signal nmeaSentenceReceived(substring: str)[source]

Emitted whenever the GPS device receives a raw NMEA sentence.

Parameters:

substring (str)

parseData(self)[source]

Parse available data source content

signal positionChanged(point: QgsPoint)[source]

Emitted when the GPS position changes.

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

Added in version 3.30.

Parameters:

point (QgsPoint)

setSource(self, source: QIODevice | None)[source]

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

Parameters:

source (Optional[QIODevice])

signal stateChanged(info: QgsGpsInformation)[source]

Emitted whenever the GPS state is changed.

Parameters:

info (QgsGpsInformation)

status(self) QgsGpsConnection.Status[source]

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

Return type:

QgsGpsConnection.Status