Class is not finished yet. It lacks the core: DBus messages.
--- /dev/null
+#include "connection.hpp"
+
+static ConnectionChecker *_instance = NULL;
+
+
+// --------------------------------------------------
+// ConnectionChecker singleton
+// --------------------------------------------------
+ConnectionChecker *ConnectionChecker::instance ()
+{
+ if (!_instance)
+ _instance = new ConnectionChecker;
+ return _instance;
+}
+
+
+ConnectionChecker::ConnectionChecker ()
+{
+ // start timer which will check connection
+ startTimer (15*1000);
+}
+
+
+void ConnectionChecker::timerEvent (QTimerEvent *)
+{
+ // check for connection
+}
--- /dev/null
+#ifndef __CONNECTION_H__
+#define __CONNECTION_H__
+
+#include <QtCore>
+
+
+// Singleton, which periodically checks for connection state and notifies when it changed.
+class ConnectionChecker : public QObject
+{
+ Q_OBJECT
+
+private:
+ ConnectionChecker ();
+
+protected:
+ void timerEvent (QTimerEvent *event);
+
+public:
+ static ConnectionChecker *instance ();
+
+signals:
+ void connected (bool active);
+};
+
+#endif // __CONNECTION_H__
--- /dev/null
+TEMPLATE = app
+
+SOURCES += main.cpp
+HEADERS += mainwindow.hpp
+
+include (../../yandex-traffic-core.pri)
+
--- /dev/null
+#include <QtGui>
+#include "mainwindow.hpp"
+
+
+int main(int argc, char *argv[])
+{
+ QApplication app (argc, argv);
+ MainWindow w;
+
+ w.show ();
+
+ return app.exec ();
+}
--- /dev/null
+#ifndef __MAINWINDOW_H__
+#define __MAINWINDOW_H__
+
+#include <QtGui>
+#include <connection.hpp>
+
+class MainWindow : public QWidget
+{
+ Q_OBJECT
+public:
+ MainWindow ()
+ : QWidget ()
+ {
+ ConnectionChecker *cc = ConnectionChecker::instance ();
+
+ connect (cc, SIGNAL (connected (bool)), SLOT (connected (bool)));
+ }
+
+protected slots:
+ void connected (bool active)
+ {
+ if (active)
+ printf ("Device connected\n");
+ else
+ printf ("Device not connected\n");
+ }
+};
+
+#endif // __MAINWINDOW_H__
TEMPLATE = subdirs
-SUBDIRS = regions traffic widget
+SUBDIRS = regions traffic widget conn
-HEADERS += $$PWD/regions.hpp $$PWD/settings.hpp $$PWD/traffic.hpp $$PWD/http_fetcher.hpp
-SOURCES += $$PWD/regions.cpp $$PWD/settings.cpp $$PWD/traffic.cpp $$PWD/http_fetcher.cpp
+HEADERS += $$PWD/regions.hpp $$PWD/settings.hpp $$PWD/traffic.hpp $$PWD/http_fetcher.hpp $$PWD/connection.hpp
+SOURCES += $$PWD/regions.cpp $$PWD/settings.cpp $$PWD/traffic.cpp $$PWD/http_fetcher.cpp $$PWD/connection.cpp
-QT += network xml
+QT += network xml dbus
+CONFIG += qdbus
+
+maemo5 {
+ CONFIG += icd2
+}
INCLUDEPATH += $$PWD