X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fcommon%2Fconnectionmanager.h;h=9261eb3d3b01c6172e6fd6012759e61864e64699;hb=7457945ab2973c6c93fbb9e92af7d81f15bced9d;hp=ea44605acaa0097b3fb30560ef8b23df4cc681b4;hpb=cf883c1283eb6b096592ef875a32696fee9dd6ff;p=jenirok diff --git a/src/common/connectionmanager.h b/src/common/connectionmanager.h index ea44605..9261eb3 100644 --- a/src/common/connectionmanager.h +++ b/src/common/connectionmanager.h @@ -20,35 +20,67 @@ #define CONNECTIONMANAGER_H #include +#include #include -#include -#include -#include +#include +#include +#include +#include class ConnectionManager : public QObject { Q_OBJECT public: - static ConnectionManager& instance(); + + struct Connection + { + QString serviceType; + unsigned int serviceAttributes; + QString serviceID; + QString networkName; + QString networkType; + unsigned int networkAttributes; + QByteArray networkID; + }; + + ConnectionManager(QObject* parent = 0); + ~ConnectionManager(); + void setBlocking(bool value); bool connect(); - bool disconnect(); + bool connect(Connection const& connection); + bool disconnect(bool force = false); bool isConnected(); + bool scanConnections(QList& connections); + static unsigned int const TIMEOUT = 25000; signals: - void connected(); - void disconnected(); - void error(QString const& error); + void connectReply(bool connected); + void isConnectedReply(bool connected); + void newConnection(ConnectionManager::Connection const& connection); + void scanReady(); + +protected: + virtual void timerEvent(QTimerEvent* event); +private slots: + void stateChange(const QDBusMessage& rep); + void connectionChange(const QDBusMessage& rep); + void scanResult(const QDBusMessage& rep); private: - ConnectionManager(); - static void connectionHandler(ConIcConnection *connection, - ConIcConnectionEvent *event, - gpointer user_data); - static ConnectionManager* instance_; - ConIcConnection* connection_; + bool waitSignal(bool* ready); + bool blocking_; + bool stateReady_; + bool connectionReady_; + bool scanReady_; bool connected_; + bool timeout_; + int numberOfConnections_; + int scannedConnections_; + int timer_; + QList* connections_; + QDBusInterface* icd2interface_; }; #endif