内容表

上一话题

QSensor

下一话题

QSensorBackendFactory

QSensorBackend

QSensorBackend class is a sensor implementation. 更多

Inheritance diagram of PySide2.QtSensors.QSensorBackend

概要

函数

虚函数

详细描述

Sensors on a device will be represented by sub-classes of QSensorBackend .

class QSensorBackend ( sensor [ , parent=Q_NULLPTR ] )
参数
PySide2.QtSensors.QSensorBackend. addDataRate ( min , max )
参数
  • min qreal

  • max qreal

Add a data rate (consisting of min and max values) for the sensor.

Note that this function should be called from the constructor so that the information is available immediately.

PySide2.QtSensors.QSensorBackend. addOutputRange ( min , max , accuracy )
参数
  • min qreal

  • max qreal

  • accuracy qreal

Add an output range (consisting of min , max values and accuracy ) for the sensor.

Note that this function should be called from the constructor so that the information is available immediately.

PySide2.QtSensors.QSensorBackend. isFeatureSupported ( feature )
参数

feature Feature

返回类型

bool

校验特征是否由此传感器后端所支持。

这是后端侧的 isFeatureSupported() . Reimplement this function if the backend supports one of the additional sensor features of Feature .

Returns whether the feature feature is supported by this backend. The default implementation returns false.

PySide2.QtSensors.QSensorBackend. newReadingAvailable ( )

Notify the QSensor class that a new reading is available.

PySide2.QtSensors.QSensorBackend. reading ( )
返回类型

QSensorReading

If the backend has lost its reference to the reading it can call this method to get the address.

Note that you will need to down-cast to the appropriate type.

另请参阅

setReading()

PySide2.QtSensors.QSensorBackend. sensor ( )
返回类型

QSensor

Returns the sensor front end associated with this backend.

PySide2.QtSensors.QSensorBackend. sensorBusy ( )

Inform the front end that the sensor is busy. This implicitly calls sensorStopped() and is typically called from start() .

Note that the front end must call isBusy() to see if the sensor is busy. If the sensor has stopped due to an error the sensorError() function should be called to notify the class of the error condition.

PySide2.QtSensors.QSensorBackend. sensorError ( error )
参数

error int

Inform the front end that a sensor error occurred. Note that this only reports an error code. It does not stop the sensor.

另请参阅

sensorStopped()

PySide2.QtSensors.QSensorBackend. sensorStopped ( )

Inform the front end that the sensor has stopped. This can be due to start() failing or for some unexpected reason (eg. hardware failure).

Note that the front end must call isActive() to see if the sensor has stopped. If the sensor has stopped due to an error the sensorError() function should be called to notify the class of the error condition.

PySide2.QtSensors.QSensorBackend. setDataRates ( otherSensor )
参数

otherSensor QSensor

Set the data rates for the sensor based on otherSensor .

This is designed for sensors that are based on other sensors.

setDataRates(otherSensor);
											

Note that this function must be called from the constructor.

PySide2.QtSensors.QSensorBackend. setDescription ( description )
参数

description – unicode

设置 description 为传感器。

Note that this function should be called from the constructor so that the information is available immediately.

PySide2.QtSensors.QSensorBackend. start ( )

开始报告值。

PySide2.QtSensors.QSensorBackend. stop ( )

停止报告值。