/
counter.h
81 lines (62 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
* Copyright © 2012, Jolla.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
#ifndef COUNTER_H
#define COUNTER_H
#include <QObject>
#include <QVariantMap>
#include <QtDBus/QDBusAbstractAdaptor>
#include <QtDBus/QDBusObjectPath>
18
#include "networkmanager.h"
19
20
21
22
/*
* Proxy class for interface net.connman.Counter
*/
23
24
// static const char counterPath[] = "/ConnectivityCounter";
25
26
class CounterPrivate;
27
28
29
class Counter : public QObject
{
Q_OBJECT
30
31
Q_PROPERTY(quint64 bytesReceived READ bytesReceived NOTIFY bytesReceivedChanged)
Q_PROPERTY(quint64 bytesTransmitted READ bytesTransmitted NOTIFY bytesTransmittedChanged)
32
33
34
35
36
37
Q_PROPERTY(quint32 secondsOnline READ secondsOnline NOTIFY secondsOnlineChanged)
Q_PROPERTY(bool roaming READ roaming NOTIFY roamingChanged)
Q_PROPERTY(quint32 accuracy READ accuracy WRITE setAccuracy NOTIFY accuracyChanged)
Q_PROPERTY(quint32 interval READ interval WRITE setInterval NOTIFY intervalChanged)
Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
38
Q_DISABLE_COPY(Counter)
39
40
41
public:
explicit Counter(QObject *parent = 0);
42
43
virtual ~Counter();
44
45
quint64 bytesReceived() const;
quint64 bytesTransmitted() const;
46
47
48
49
50
51
52
53
54
55
56
57
quint32 secondsOnline() const;
bool roaming() const;
quint32 accuracy() const;
void setAccuracy(quint32 accuracy);
quint32 interval() const;
void setInterval(quint32 interval);
bool running() const;
void setRunning(bool on);
58
59
Q_SIGNALS:
60
void counterChanged(const QString &servicePath, const QVariantMap &counters, bool roaming);
61
62
void bytesReceivedChanged(quint64 bytesRx);
void bytesTransmittedChanged(quint64 bytesTx);
63
64
65
66
67
void secondsOnlineChanged(quint32 seconds);
void roamingChanged(bool roaming);
void accuracyChanged(quint32 accuracy);
void intervalChanged(quint32 interval);
void runningChanged(bool running);
68
69
70
71
private Q_SLOTS:
void updateCounterAgent();
72
private:
73
CounterPrivate *d_ptr;
74
75
friend class CounterAdaptor;
76
77
void serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming);
78
void release();
79
};
80
81
#endif // COUNTER_H