File indexing completed on 2024-04-28 05:27:48
0001 /* 0002 SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QObject> 0010 0011 #include <systemstats/SensorInfo.h> 0012 0013 namespace KSysGuard 0014 { 0015 class SensorProperty; 0016 } 0017 class Daemon; 0018 0019 /** 0020 * This class represents an individual connection to the daemon 0021 */ 0022 class Client : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 Client(Daemon *parent, const QString &serviceName); 0027 ~Client() override; 0028 void subscribeSensors(const QStringList &sensorIds); 0029 void unsubscribeSensors(const QStringList &sensorIds); 0030 void sendFrame(); 0031 0032 private: 0033 void sendValues(const KSysGuard::SensorDataList &updates); 0034 void sendMetaDataChanged(const KSysGuard::SensorInfoMap &sensors); 0035 0036 const QString m_serviceName; 0037 Daemon *m_daemon; 0038 QHash<QString, KSysGuard::SensorProperty *> m_subscribedSensors; 0039 QMultiHash<KSysGuard::SensorProperty *, QMetaObject::Connection> m_connections; 0040 KSysGuard::SensorDataList m_pendingUpdates; 0041 KSysGuard::SensorInfoMap m_pendingMetaDataChanges; 0042 };