Connection handling in daemon improved. Added settings to allow automatic connection...
[jenirok] / src / common / connectionmanager.h
index 9261eb3..49e6dfc 100644 (file)
@@ -33,15 +33,16 @@ class ConnectionManager : public QObject
 
 public:
 
+    enum ConnectionType {WLAN, GPRS};
+    enum NetworkMode {NETWORK_UNKNOWN, NETWORK_2G, NETWORK_2_5G, NETWORK_3G, NETWORK_3_5G};
+    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 +50,15 @@ public:
     void setBlocking(bool value);
     bool connect();
     bool connect(Connection const& connection);
+    bool connect(QString const& id);
+    bool getBestConnection(Connection& connection);
+    bool autoConnect();
     bool disconnect(bool force = false);
     bool isConnected();
     bool scanConnections(QList<Connection>& connections);
-    static unsigned int const TIMEOUT = 25000;
+    NetworkMode getNetworkMode();
+    Error error() const;
+    static unsigned int const TIMEOUT = 20000;
 
 signals:
     void connectReply(bool connected);
@@ -79,6 +85,7 @@ private:
     int numberOfConnections_;
     int scannedConnections_;
     int timer_;
+    Error error_;
     QList<Connection>* connections_;
     QDBusInterface* icd2interface_;
 };