1 /* 2 SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org> 3 4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 5 */ 6 7 #pragma once 8 9 #include <QObject> 10 11 #include <systemstats/SensorInfo.h> 12 13 namespace KSysGuard 14 { 15 class SensorProperty; 16 } 17 class Daemon; 18 19 /** 20 * This class represents an individual connection to the daemon 21 */ 22 class Client : public QObject 23 { 24 Q_OBJECT 25 public: 26 Client(Daemon *parent, const QString &serviceName); 27 ~Client() override; 28 void subscribeSensors(const QStringList &sensorIds); 29 void unsubscribeSensors(const QStringList &sensorIds); 30 void sendFrame(); 31 32 private: 33 void sendValues(const KSysGuard::SensorDataList &updates); 34 void sendMetaDataChanged(const KSysGuard::SensorInfoMap &sensors); 35 36 const QString m_serviceName; 37 Daemon *m_daemon; 38 QHash<QString, KSysGuard::SensorProperty *> m_subscribedSensors; 39 QMultiHash<KSysGuard::SensorProperty *, QMetaObject::Connection> m_connections; 40 KSysGuard::SensorDataList m_pendingUpdates; 41 KSysGuard::SensorInfoMap m_pendingMetaDataChanges; 42 }; 43