Connection tracker class finished.
[yandex-traffic] / connection.hpp
1 #ifndef __CONNECTION_H__
2 #define __CONNECTION_H__
3
4 #include <QtCore>
5 #include <QtDBus>
6
7
8 // Singleton, which listens for ICD DBUS events about connection change
9 class ConnectionChecker : public QObject
10 {
11     Q_OBJECT
12
13 private:
14     bool _connected;
15     QDBusConnection _bus;
16     QDBusInterface *_itf;
17
18 protected:
19     ConnectionChecker ();
20
21     void updateState (bool new_state);
22
23 protected slots:
24     void stateSignal (const QDBusMessage& msg);
25
26 public:
27     static ConnectionChecker *instance ();
28
29     bool isConnected () const
30     { return _connected; };
31
32     void requestState ();
33
34 signals:
35     void connected (bool active);
36 };
37
38 #endif // __CONNECTION_H__