Class: QgsAbstractSensor¶
An abstract base class for sensors.
Added in version 3.32.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: handleConnect(), handleDisconnect()
Class Hierarchy¶
Base classes¶
Subclasses¶
An abstract class for QIODevice-based sensors. |
- class qgis.core.QgsAbstractSensor[source]¶
Bases:
QObject- __init__(parent: QObject | None = None)
Constructor for an abstract sensor, bound to the specified
parent.- Parameters:
parent (Optional[QObject] = None)
- class SensorData¶
Bases:
objectContains details of a sensor data capture
- lastTimestamp: QDateTime¶
- lastValue: object¶
- data(self) QgsAbstractSensor.SensorData[source]¶
Returns the latest captured data from the sensor.
- Return type:
- signal dataChanged[source]¶
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.
- signal errorOccurred[source]¶
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.
- abstract handleConnect(self)[source]¶
Handles the connection to the sensor.
Note
Triggered by calling
connectSensor()
- abstract handleDisconnect(self)[source]¶
Handles the disconnection from the sensor.
Note
Triggered by calling
disconnectSensor()
- id(self) str[source]¶
Returns the sensor ID.
Note
This is a autogenerated unique string identifying an individual sensor.
- Return type:
str
- signal nameChanged[source]¶
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.
- virtual readPropertiesFromElement(self, element: QDomElement, document: QDomDocument) bool[source]¶
Restores specific sensor type properties from a DOM element.
- Parameters:
element (QDomElement) – DOM node corresponding to item (e.g. ‘Sensor’ element)
document (QDomDocument) – DOM document
- Return type:
bool
- readXml(self, element: QDomElement, document: QDomDocument) bool[source]¶
Restores generic sensor details from a DOM element.
- Parameters:
element (QDomElement) – DOM node corresponding to item (e.g. ‘Sensor’ element)
document (QDomDocument) – DOM document
- Return type:
bool
- setData(self, data: QgsAbstractSensor.SensorData)[source]¶
Sets the latest captured data from the sensor.
- Parameters:
data (QgsAbstractSensor.SensorData)
- setName(self, name: str | None)[source]¶
Sets the user-friendly name identfying the sensor.
- Parameters:
name (Optional[str])
- setStatus(self, status: Qgis.DeviceConnectionStatus)[source]¶
Sets the current sensor
status.- Parameters:
status (Qgis.DeviceConnectionStatus)
- status(self) Qgis.DeviceConnectionStatus[source]¶
Returns the current sensor status.
- Return type:
- signal statusChanged[source]¶
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.
- virtual type(self) str[source]¶
Returns the sensor type. This will match the type string of the sensor class, as used by
QgsSensorRegistry.- Return type:
str
- virtual writePropertiesToElement(self, element: QDomElement, document: QDomDocument) bool[source]¶
Write specific sensor type properties into a DOM element.
- Parameters:
element (QDomElement) – DOM node corresponding to item (e.g. ‘Sensor’ element)
document (QDomDocument) – DOM document
- Return type:
bool