QSensorManager

The QSensorManager class handles registration and creation of sensor backends. More

Inheritance diagram of PySide2.QtSensors.QSensorManager

Synopsis

Static functions

Detailed Description

Sensor plugins register backends using the registerBackend() function.

When connectToBackend() is called, the createBackend() function will be called.

class QSensorManager
static PySide2.QtSensors.QSensorManager.createBackend(sensor)
Parameters

sensorQSensor

Return type

QSensorBackend

Create a backend for sensor . Returns null if no suitable backend exists.

static PySide2.QtSensors.QSensorManager.isBackendRegistered(type, identifier)
Parameters
  • typeQByteArray

  • identifierQByteArray

Return type

bool

Returns true if the backend identified by type and identifier is registered.

This is a convenience method that helps out plugins doing dynamic registration.

static PySide2.QtSensors.QSensorManager.registerBackend(type, identifier, factory)
Parameters

Register a sensor for type . The identifier must be unique.

The factory will be asked to create instances of the backend.

static PySide2.QtSensors.QSensorManager.setDefaultBackend(type, identifier)
Parameters
  • typeQByteArray

  • identifierQByteArray

Sets or overwrite the sensor type with the backend identifier .

static PySide2.QtSensors.QSensorManager.unregisterBackend(type, identifier)
Parameters
  • typeQByteArray

  • identifierQByteArray

Unregister the backend for type with identifier .

Note that this only prevents new instance of the backend from being created. It does not invalidate the existing instances of the backend. The backend code should handle the disappearance of the underlying hardware itself.