The QSensorManager class handles registration and creation of sensor backends. More...
Header: | #include <QSensorManager> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
QSensorBackend * | createBackend(QSensor *sensor) |
bool | isBackendRegistered(const QByteArray &type, const QByteArray &identifier) |
void | registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory) |
void | setDefaultBackend(const QByteArray &type, const QByteArray &identifier) |
void | unregisterBackend(const QByteArray &type, const QByteArray &identifier) |
Sensor plugins register backends using the registerBackend() function.
When QSensor::connectToBackend() is called, the createBackend() function will be called.
[static]
QSensorBackend *QSensorManager::createBackend(QSensor *sensor)Create a backend for sensor. Returns null if no suitable backend exists.
[static]
bool QSensorManager::isBackendRegistered(const QByteArray &type, const QByteArray &identifier)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]
void QSensorManager::registerBackend(const QByteArray
&type, const QByteArray &identifier, QSensorBackendFactory *factory)Register a sensor for type. The identifier must be unique.
The factory will be asked to create instances of the backend.
Sensor identifiers starting with generic
or dummy
are given lower priority when choosing the default sensor if other sensors are found.
[static]
void QSensorManager::setDefaultBackend(const QByteArray
&type, const QByteArray &identifier)Sets or overwrite the sensor type with the backend identifier.
[static]
void QSensorManager::unregisterBackend(const QByteArray
&type, const QByteArray &identifier)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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: