Class: QgsGpsDetector¶
- class qgis.core.QgsGpsDetector¶
Bases:
PyQt5.QtCore.QObject
Class to detect the GPS port
QgsGpsDetector(portName: str = ‘’, useUnsafeSignals: bool = 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 toFalse
to avoid emitting the dangerous and fragiledetected()
signal. This is highly recommended, but is opt-in to avoid breaking stable QGIS 3.x API. IfuseUnsafeSignals
is set toFalse
, only the safeconnectionDetected()
signal will be emitted and clients must manually take ownership of the detected connection via a call totakeConnection()
.Methods
- rtype:
List[Tuple[str, str]]
Returns the detected GPS connection, and removes it from the detector.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- advance(self)¶
- availablePorts() List[Tuple[str, str]] ¶
- Return type:
List[Tuple[str, str]]
- childEvent(self, QChildEvent)¶
- connDestroyed(self, QObject)¶
- connectNotify(self, QMetaMethod)¶
- connectionDetected¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...)
revision (int = ...)
arguments (Sequence = ...)
- Return type:
PYQT_SIGNAL
- customEvent(self, QEvent)¶
- detected¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...)
revision (int = ...)
arguments (Sequence = ...)
- Return type:
PYQT_SIGNAL
- detectionFailed¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...)
revision (int = ...)
arguments (Sequence = ...)
- Return type:
PYQT_SIGNAL
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- takeConnection(self) QgsGpsConnection ¶
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 returnNone
.Warning
Do not call this method if the useUnsafeSignals option in the
QgsGpsDetector
constructor was set toTrue
.Added in version 3.38.
- Return type:
- timerEvent(self, QTimerEvent)¶