public:
- enum ConnectionType {WLAN, GPRS};
- enum NetworkMode {NETWORK_UNKNOWN, NETWORK_2G, NETWORK_2_5G, NETWORK_3G, NETWORK_3_5G};
+ enum ConnectionType {NO_TYPE, WLAN, GPRS};
enum Error {NO_ERROR, NO_AVAILABLE_CONNECTIONS, INVALID_IAP, UNKNOWN_ERROR};
struct Connection
ConnectionManager(QObject* parent = 0);
~ConnectionManager();
- void setBlocking(bool value);
bool connect();
bool connect(Connection const& connection);
bool connect(QString const& id);
- bool getBestConnection(Connection& connection);
- bool autoConnect();
+ bool getBestConnection(Connection& connection, ConnectionType type = NO_TYPE);
bool disconnect(bool force = false);
bool isConnected();
- bool scanConnections(QList<Connection>& connections);
- NetworkMode getNetworkMode();
+ bool scanConnections(QList<Connection>& connections, ConnectionType type = NO_TYPE);
Error error() const;
- static unsigned int const TIMEOUT = 20000;
-
-signals:
- void connectReply(bool connected);
- void isConnectedReply(bool connected);
- void newConnection(ConnectionManager::Connection const& connection);
- void scanReady();
+ static unsigned int const TIMEOUT = 15000;
+ static unsigned int const WAIT_AFTER_CONNECT = 400;
protected:
virtual void timerEvent(QTimerEvent* event);
void scanResult(const QDBusMessage& rep);
private:
+ void sleep(unsigned int ms);
bool waitSignal(bool* ready);
- bool blocking_;
bool stateReady_;
bool connectionReady_;
bool scanReady_;
- bool connected_;
+ static bool connected_;
bool timeout_;
int numberOfConnections_;
int scannedConnections_;
int timer_;
+ ConnectionType searchType_;
Error error_;
QList<Connection>* connections_;
QDBusInterface* icd2interface_;