Class: QgsAbstractSensor

class qgis.core.QgsAbstractSensor

Bases: PyQt5.QtCore.QObject

An abstract base class for sensor classes

New in version 3.32.

QgsAbstractSensor(parent: QObject = None) Constructor for an abstract sensor, bound to the specified parent.

Methods

childEvent

connectNotify

connectSensor

Connects the sensor to its source.

customEvent

data

Returns the latest captured data from the sensor.

disconnectNotify

disconnectSensor

Disconnects the sensor from its source.

errorString

Returns the last error message.

handleConnect

Handles the connection to the sensor.

handleDisconnect

Handles the disconnection from the sensor.

id

Returns the sensor ID.

isSignalConnected

name

Returns the user-friendly name identifying the sensor.

readPropertiesFromElement

Restores specific sensor type properties from a DOM element.

readXml

Restores generic sensor details from a DOM element.

receivers

sender

senderSignalIndex

setData

Sets the latest captured data from the sensor.

setName

Sets the user-friendly name identfying the sensor.

setStatus

Sets the current sensor status.

status

Returns the current sensor status.

timerEvent

type

Returns the sensor type.

writePropertiesToElement

Write specific sensor type properties into a DOM element.

writeXml

Write generic sensor properties into a DOM element.

Signals

dataChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

errorOccurred

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

nameChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

statusChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

class SensorData
class SensorData(QgsAbstractSensor.SensorData)

Bases: sip.wrapper

lastTimestamp
lastValue
childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
connectSensor(self)

Connects the sensor to its source.

customEvent(self, QEvent)
data(self) QgsAbstractSensor.SensorData

Returns the latest captured data from the sensor.

Return type:

QgsAbstractSensor.SensorData

dataChanged

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)
disconnectSensor(self)

Disconnects the sensor from its source.

errorOccurred

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

errorString(self) str

Returns the last error message.

Return type:

str

handleConnect(self)

Handles the connection to the sensor.

Note

Triggered by calling connectSensor()

handleDisconnect(self)

Handles the disconnection from the sensor.

Note

Triggered by calling disconnectSensor()

id(self) str

Returns the sensor ID.

Note

This is a autogenerated unique string identifying an individual sensor.

Return type:

str

isSignalConnected(self, QMetaMethod) bool
name(self) str

Returns the user-friendly name identifying the sensor.

Return type:

str

nameChanged

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

readPropertiesFromElement(self, element: QDomElement, document: QDomDocument) bool

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

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

receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
setData(self, data: QgsAbstractSensor.SensorData)

Sets the latest captured data from the sensor.

Parameters:

data (QgsAbstractSensor.SensorData) –

setName(self, name: str)

Sets the user-friendly name identfying the sensor.

Parameters:

name (str) –

setStatus(self, status: Qgis.DeviceConnectionStatus)

Sets the current sensor status.

Parameters:

status (Qgis.DeviceConnectionStatus) –

status(self) Qgis.DeviceConnectionStatus

Returns the current sensor status.

Return type:

Qgis.DeviceConnectionStatus

statusChanged

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

timerEvent(self, QTimerEvent)
type(self) str

Returns the sensor type. This will match the type string of the sensor class, as used by QgsSensorRegistry.

Return type:

str

writePropertiesToElement(self, element: QDomElement, document: QDomDocument) bool

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

writeXml(self, parentElement: QDomElement, document: QDomDocument) bool

Write generic sensor properties into a DOM element.

Parameters:
  • parentElement (QDomElement) – parent DOM element (e.g ‘Sensors’ element)

  • document (QDomDocument) – DOM document

Return type:

bool