Class: QgsSensorManager¶
- class qgis.core.QgsSensorManager¶
Bases:
PyQt5.QtCore.QObject
Manages sensors.
QgsSensorManager
handles the storage, serializing and deserializing of sensors. Usually this class is not constructed directly, but rather accessed through aQgsProject
viaQgsProject.sensorManager()
.New in version 3.32.
QgsSensorManager(parent: QObject = None) Constructor for
QgsSensorManager
, with the specifiedparent
object.Methods
Registers a new
sensor
.Deregisters and removes all sensors from the manager.
Reads the manager's state from a DOM element, restoring all sensors present in the XML document.
Removes a registered sensor matching a given
id
.Returns a registered sensor pointer matching a given
id
.Returns the last captured data from a registered sensor matching a given
name
.Returns a list of registered sensor names.
Returns a list of pointers to all registered sensors.
Returns the last captured data of all registered sensors.
Returns a DOM element representing the state of the manager.
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
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
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- addSensor(self, sensor: QgsAbstractSensor)¶
Registers a new
sensor
. The sensor name does not require uniqueness; sensors will the same name will store their data in the same sensor name key, allowing for registration of sensors to cover multiple devices (e.g. two serial port sensors with alternative port name to cover two machines).Note
Takes ownership of the sensor.
- Parameters:
sensor (QgsAbstractSensor) –
- childEvent(self, QChildEvent)¶
- clear(self)¶
Deregisters and removes all sensors from the manager.
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- readXml(self, element: QDomElement, document: QDomDocument) bool ¶
Reads the manager’s state from a DOM element, restoring all sensors present in the XML document.
See also
- Parameters:
element (QDomElement) –
document (QDomDocument) –
- Return type:
bool
- receivers(self, PYQT_SIGNAL) int ¶
- removeSensor(self, id: str) bool ¶
Removes a registered sensor matching a given
id
.- Return type:
bool
- Returns:
True
if a sensor was removed.- Parameters:
id (str) –
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- sensor(self, id: str) QgsAbstractSensor ¶
Returns a registered sensor pointer matching a given
id
. If not matching sensor is found, aNone
will be returned.- Parameters:
id (str) –
- Return type:
- sensorAboutToBeRemoved¶
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
- sensorAdded¶
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
- sensorData(self, name: str) QgsAbstractSensor.SensorData ¶
Returns the last captured data from a registered sensor matching a given
name
.- Parameters:
name (str) –
- Return type:
- sensorDataCaptured¶
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
- sensorErrorOccurred¶
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
- sensorNameChanged¶
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
- sensorNames(self) List[str] ¶
Returns a list of registered sensor names.
- Return type:
List[str]
- sensorRemoved¶
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
- sensorStatusChanged¶
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
- sensors(self) List[QgsAbstractSensor] ¶
Returns a list of pointers to all registered sensors.
- Return type:
List[QgsAbstractSensor]
- sensorsData(self) Dict[str, QgsAbstractSensor.SensorData] ¶
Returns the last captured data of all registered sensors.
- Return type:
Dict[str, QgsAbstractSensor.SensorData]
- timerEvent(self, QTimerEvent)¶