| 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 | |
| 10 | namespace QtSensorsPrivate { |
| 11 | |
| 12 | class OrgFreedesktopDBusPropertiesInterface; |
| 13 | |
| 14 | } // namespace QtSensorsPrivate |
| 15 | |
| 16 | class IIOSensorProxySensorBase : public QSensorBackend |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | public: |
| 20 | static char const * const id; |
| 21 | |
| 22 | IIOSensorProxySensorBase(const QString &dbusPath, const QString dbusIface, QSensor *sensor); |
| 23 | ~IIOSensorProxySensorBase(); |
| 24 | |
| 25 | bool isServiceRunning() const { return m_serviceRunning; } |
| 26 | QString serviceName() const; |
| 27 | |
| 28 | protected: |
| 29 | static quint64 produceTimestamp(); |
| 30 | virtual void updateProperties(const QVariantMap &changedProperties) = 0; |
| 31 | |
| 32 | private slots: |
| 33 | void serviceRegistered(); |
| 34 | void serviceUnregistered(); |
| 35 | void propertiesChanged(const QString &interface, const QVariantMap &changedProperties, |
| 36 | const QStringList &invalidatedProperties); |
| 37 | |
| 38 | private: |
| 39 | bool m_serviceRunning; |
| 40 | QtSensorsPrivate::OrgFreedesktopDBusPropertiesInterface *m_propertiesInterface; |
| 41 | QString m_dbusInterface; |
| 42 | }; |
| 43 | |
| 44 | #endif // IIOSENSORPROXY_SENSORBASE_H |
| 45 | |