Class to detect the GPS port.
More...
#include <qgsgpsdetector.h>
|
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.
|
|
Class to detect the GPS port.
Definition at line 47 of file qgsgpsdetector.h.
◆ 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 67 of file qgsgpsdetector.cpp.
◆ ~QgsGpsDetector()
QgsGpsDetector::~QgsGpsDetector |
( |
| ) |
|
|
override |
◆ advance
void QgsGpsDetector::advance |
( |
| ) |
|
|
slot |
◆ availablePorts()
QList< QPair< QString, QString > > QgsGpsDetector::availablePorts |
( |
| ) |
|
|
static |
◆ connDestroyed
void QgsGpsDetector::connDestroyed |
( |
QObject * |
obj | ) |
|
|
slot |
◆ 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]
◆ 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()
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 95 of file qgsgpsdetector.cpp.
The documentation for this class was generated from the following files: