summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-11 03:02:36 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-11 03:02:36 +0200
commita6c957faef10efce3056791a4bd3be900b423411 (patch)
tree797a29cd563253ccc1069d5055da93d3ecadd0d9
parent299bbcdb59198910188ebe1abbae1d9868d8ae6d (diff)
parent14b5821f7b9998c1263c592d2cc70f21f1e72981 (diff)
downloadqtsensors-a6c957faef10efce3056791a4bd3be900b423411.tar.gz
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I71deece5315cb9b29bd9bc72c3198c80c9d14442
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/main.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/sensors/iio-sensor-proxy/main.cpp b/src/plugins/sensors/iio-sensor-proxy/main.cpp
index 136dd40..580e2c4 100644
--- a/src/plugins/sensors/iio-sensor-proxy/main.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/main.cpp
@@ -46,6 +46,9 @@
#include <qsensorbackend.h>
#include <qsensormanager.h>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusConnectionInterface>
+
#include <QtCore/QFile>
#include <QtCore/QDebug>
@@ -57,12 +60,14 @@ class IIOSensorProxySensorPlugin : public QObject, public QSensorPluginInterface
public:
void registerSensors() override
{
- if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id))
- QSensorManager::registerBackend(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id, this);
- if (!QSensorManager::isBackendRegistered(QLightSensor::type, IIOSensorProxyLightSensor::id))
- QSensorManager::registerBackend(QLightSensor::type, IIOSensorProxyLightSensor::id, this);
- if (!QSensorManager::isBackendRegistered(QCompass::type, IIOSensorProxyCompass::id))
- QSensorManager::registerBackend(QCompass::type, IIOSensorProxyCompass::id, this);
+ if (QDBusConnection::systemBus().interface()->isServiceRegistered("net.hadess.SensorProxy")) {
+ if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id))
+ QSensorManager::registerBackend(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QLightSensor::type, IIOSensorProxyLightSensor::id))
+ QSensorManager::registerBackend(QLightSensor::type, IIOSensorProxyLightSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QCompass::type, IIOSensorProxyCompass::id))
+ QSensorManager::registerBackend(QCompass::type, IIOSensorProxyCompass::id, this);
+ }
}
QSensorBackend *createBackend(QSensor *sensor) override