Connection handling improved again. Added ability to bybass general Maemo connectivit...
[jenirok] / src / common / connectionmanager.h
index 9261eb3..547163d 100644 (file)
@@ -33,15 +33,15 @@ class ConnectionManager : public QObject
 
 public:
 
+    enum ConnectionType {NO_TYPE, WLAN, GPRS};
+    enum Error {NO_ERROR, NO_AVAILABLE_CONNECTIONS, INVALID_IAP, UNKNOWN_ERROR};
+
     struct Connection
     {
-        QString serviceType;
-        unsigned int serviceAttributes;
-        QString serviceID;
-        QString networkName;
-        QString networkType;
-        unsigned int networkAttributes;
-        QByteArray networkID;
+        ConnectionType type;
+        QString id;
+        QString name;
+        int strength;
     };
 
     ConnectionManager(QObject* parent = 0);
@@ -49,10 +49,13 @@ public:
     void setBlocking(bool value);
     bool connect();
     bool connect(Connection const& connection);
+    bool connect(QString const& id);
+    bool getBestConnection(Connection& connection, ConnectionType type = NO_TYPE);
     bool disconnect(bool force = false);
     bool isConnected();
-    bool scanConnections(QList<Connection>& connections);
-    static unsigned int const TIMEOUT = 25000;
+    bool scanConnections(QList<Connection>& connections, ConnectionType type = NO_TYPE);
+    Error error() const;
+    static unsigned int const TIMEOUT = 20000;
 
 signals:
     void connectReply(bool connected);
@@ -79,6 +82,7 @@ private:
     int numberOfConnections_;
     int scannedConnections_;
     int timer_;
+    Error error_;
     QList<Connection>* connections_;
     QDBusInterface* icd2interface_;
 };