1// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef IIOSENSORPROXY_SENSORBASE_H
6#define IIOSENSORPROXY_SENSORBASE_H
7
8#include <qsensorbackend.h>
9
10class OrgFreedesktopDBusPropertiesInterface;
11
12class IIOSensorProxySensorBase : public QSensorBackend
13{
14 Q_OBJECT
15public:
16 static char const * const id;
17
18 IIOSensorProxySensorBase(const QString &dbusPath, const QString dbusIface, QSensor *sensor);
19 ~IIOSensorProxySensorBase();
20
21 bool isServiceRunning() const { return m_serviceRunning; }
22 QString serviceName() const;
23
24protected:
25 static quint64 produceTimestamp();
26 virtual void updateProperties(const QVariantMap &changedProperties) = 0;
27
28private slots:
29 void serviceRegistered();
30 void serviceUnregistered();
31 void propertiesChanged(const QString &interface, const QVariantMap &changedProperties,
32 const QStringList &invalidatedProperties);
33
34private:
35 bool m_serviceRunning;
36 OrgFreedesktopDBusPropertiesInterface *m_propertiesInterface;
37 QString m_dbusInterface;
38};
39
40#endif // IIOSENSORPROXY_SENSORBASE_H
41

source code of qtsensors/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h