QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsGpsDetector Class Reference

Class to detect the GPS port. More...

#include <qgsgpsdetector.h>

Inheritance diagram for QgsGpsDetector:
Inheritance graph
[legend]

Public Slots

void advance ()
 
void connDestroyed (QObject *)
 
void detected (const QgsGpsInformation &)
 

Signals

void connectionDetected ()
 Emitted when a GPS connection is successfully detected.
 
Q_DECL_DEPRECATED void detected (QgsGpsConnection *connection)
 Emitted when the GPS connection has been detected.
 
void detectionFailed ()
 Emitted when the detector could not find a valid GPS connection.
 

Public Member Functions

 QgsGpsDetector (const QString &portName=QString(), bool useUnsafeSignals=true)
 Constructor for QgsGpsDetector.
 
 ~QgsGpsDetector () override
 
QgsGpsConnectiontakeConnection ()
 Returns the detected GPS connection, and removes it from the detector.
 

Static Public Member Functions

static QList< QPair< QString, QString > > availablePorts ()
 

Detailed Description

Class to detect the GPS port.

Definition at line 47 of file qgsgpsdetector.h.

Constructor & Destructor Documentation

◆ QgsGpsDetector()

QgsGpsDetector::QgsGpsDetector ( const QString &  portName = QString(),
bool  useUnsafeSignals = true 
)

Constructor for QgsGpsDetector.

If portName is specified, then only devices from the given port will be scanned. Otherwise all connection types will be attempted (including internal GPS devices).

Since QGIS 3.38, the useUnsafeSignals parameter can be set to false to avoid emitting the dangerous and fragile detected() signal. This is highly recommended, but is opt-in to avoid breaking stable QGIS 3.x API. If useUnsafeSignals is set to false, only the safe connectionDetected() signal will be emitted and clients must manually take ownership of the detected connection via a call to takeConnection().

Definition at line 68 of file qgsgpsdetector.cpp.

◆ ~QgsGpsDetector()

QgsGpsDetector::~QgsGpsDetector ( )
override

Definition at line 91 of file qgsgpsdetector.cpp.

Member Function Documentation

◆ advance

void QgsGpsDetector::advance ( )
slot

Definition at line 125 of file qgsgpsdetector.cpp.

◆ availablePorts()

QList< QPair< QString, QString > > QgsGpsDetector::availablePorts ( )
static

Definition at line 45 of file qgsgpsdetector.cpp.

◆ connDestroyed

void QgsGpsDetector::connDestroyed ( QObject *  obj)
slot

Definition at line 271 of file qgsgpsdetector.cpp.

◆ connectionDetected

void QgsGpsDetector::connectionDetected ( )
signal

Emitted when a GPS connection is successfully detected.

Call takeConnection() to take ownership of the detected connection.

Since
QGIS 3.38

◆ detected [1/2]

void QgsGpsDetector::detected ( const QgsGpsInformation )
slot

Definition at line 222 of file qgsgpsdetector.cpp.

◆ detected [2/2]

Q_DECL_DEPRECATED void QgsGpsDetector::detected ( QgsGpsConnection connection)
signal

Emitted when the GPS connection has been detected.

A single connection must listen for this signal and immediately take ownership of the connection object.

Deprecated:
QGIS 3.40. This signal is dangerous and extremely unsafe! It is recommended to instead set the useUnsafeSignals parameter to false in the QgsGpsDetector constructor and use the safe connectionDetected() signal instead.

◆ detectionFailed

void QgsGpsDetector::detectionFailed ( )
signal

Emitted when the detector could not find a valid GPS connection.

◆ takeConnection()

QgsGpsConnection * QgsGpsDetector::takeConnection ( )

Returns the detected GPS connection, and removes it from the detector.

The caller takes ownership of the connection. Only the first call to this method following a connectionDetected() signal will be able to retrieve the detected connection – subsequent calls will return nullptr.

Warning
Do not call this method if the useUnsafeSignals option in the QgsGpsDetector constructor was set to true.
Since
QGIS 3.38

Definition at line 96 of file qgsgpsdetector.cpp.


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