1 | /* |
2 | SPDX-FileCopyrightText: 2017 Jan Grulich <jgrulich@redhat.com> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef NETWORKMANAGERQT_DEVICE_STATISTICS_H |
8 | #define NETWORKMANAGERQT_DEVICE_STATISTICS_H |
9 | |
10 | #include <networkmanagerqt/networkmanagerqt_export.h> |
11 | |
12 | #include <nm-version.h> |
13 | |
14 | #include <QObject> |
15 | #include <QSharedPointer> |
16 | |
17 | namespace NetworkManager |
18 | { |
19 | class DeviceStatisticsPrivate; |
20 | |
21 | /*! |
22 | * \class NetworkManager::DeviceStatistics |
23 | * \inheaderfile NetworkManagerQt/DeviceStatistics |
24 | * \inmodule NetworkManagerQt |
25 | * |
26 | * \brief Represents device statistics interface. |
27 | */ |
28 | class NETWORKMANAGERQT_EXPORT DeviceStatistics : public QObject |
29 | { |
30 | Q_OBJECT |
31 | |
32 | /*! |
33 | * \property NetworkManager::DeviceStatistics::refreshRateMs |
34 | */ |
35 | Q_PROPERTY(uint refreshRateMs READ refreshRateMs WRITE setRefreshRateMs NOTIFY refreshRateMsChanged) |
36 | |
37 | /*! |
38 | * \property NetworkManager::DeviceStatistics::txBytes |
39 | */ |
40 | Q_PROPERTY(qulonglong txBytes READ txBytes NOTIFY txBytesChanged) |
41 | |
42 | /*! |
43 | * \property NetworkManager::DeviceStatistics::rxBytes |
44 | */ |
45 | Q_PROPERTY(qulonglong rxBytes READ rxBytes NOTIFY rxBytesChanged) |
46 | |
47 | public: |
48 | /*! |
49 | * \typedef NetworkManager::DeviceStatistics::Ptr |
50 | */ |
51 | typedef QSharedPointer<DeviceStatistics> Ptr; |
52 | /*! |
53 | * \typedef NetworkManager::DeviceStatistics::List |
54 | */ |
55 | typedef QList<Ptr> List; |
56 | |
57 | /*! |
58 | */ |
59 | explicit DeviceStatistics(const QString &path, QObject *parent = nullptr); |
60 | ~DeviceStatistics() override; |
61 | |
62 | /*! |
63 | * Refresh rate of the rest of properties of this interface. The properties are guaranteed to be refreshed |
64 | * each RefreshRateMs milliseconds in case the underlying counter has changed too. If zero, there is no guaranteed |
65 | * refresh rate of the properties. |
66 | */ |
67 | uint refreshRateMs() const; |
68 | /*! |
69 | */ |
70 | void setRefreshRateMs(uint refreshRate); |
71 | /*! |
72 | * Number of received bytes |
73 | */ |
74 | qulonglong rxBytes() const; |
75 | /*! |
76 | * Number of transmitted bytes |
77 | */ |
78 | qulonglong txBytes() const; |
79 | |
80 | Q_SIGNALS: |
81 | /*! |
82 | * Emitted when the refresh rate has changed |
83 | */ |
84 | void refreshRateMsChanged(uint refreshRate); |
85 | /*! |
86 | * Emitted when the received bytes has changed |
87 | */ |
88 | void rxBytesChanged(qulonglong rxBytes); |
89 | /*! |
90 | * Emitted when the transmitted bytes has changed |
91 | */ |
92 | void txBytesChanged(qulonglong txBytes); |
93 | |
94 | private: |
95 | Q_DECLARE_PRIVATE(DeviceStatistics) |
96 | DeviceStatisticsPrivate *const d_ptr; |
97 | }; |
98 | |
99 | } |
100 | #endif |
101 | |