Libksysguard

SensorDaemonInterface_p.h
1/*
2 SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QObject>
10#include <memory>
11
12#include "systemstats/SensorInfo.h"
13
15
16namespace KSysGuard
17{
18/**
19 * Internal helper class to communicate with the daemon.
20 *
21 * This is mostly for convenience on top of the auto-generated KSysGuardDaemon
22 * D-Bus interface.
23 */
25{
27
28public:
30 ~SensorDaemonInterface() override;
31
32 void requestMetaData(const QString &sensorId);
33 void requestMetaData(const QStringList &sensorIds);
34 Q_SIGNAL void metaDataChanged(const QString &sensorId, const SensorInfo &info);
35 void requestValue(const QString &sensorId);
36 Q_SIGNAL void valueChanged(const QString &sensorId, const QVariant &value);
37
38 QDBusPendingCallWatcher *allSensors() const;
39
40 void subscribe(const QString &sensorId);
41 void subscribe(const QStringList &sensorIds);
42 void unsubscribe(const QString &sensorId);
43 void unsubscribe(const QStringList &sensorIds);
44
45 Q_SIGNAL void sensorAdded(const QString &sensorId);
46 Q_SIGNAL void sensorRemoved(const QString &sensorId);
47
48 static SensorDaemonInterface *instance();
49
50private:
51 void onMetaDataChanged(const QHash<QString, SensorInfo> &metaData);
52 void onValueChanged(const SensorDataList &values);
53 void reconnect();
54
55 class Private;
56 const std::unique_ptr<Private> d;
57};
58
59}
Internal helper class to communicate with the daemon.
Q_OBJECTQ_OBJECT
Q_SIGNALQ_SIGNAL
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.