00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef DBUS_QT_CONNECTION_H
00024 #define DBUS_QT_CONNECTION_H
00025
00026 #include "message.h"
00027
00028 #include <qobject.h>
00029 #include <qstring.h>
00030
00031 #include "dbus/dbus.h"
00032
00033 namespace DBusQt {
00034 namespace Internal {
00035 class Integrator;
00036 }
00037
00038 class Connection : public QObject
00039 {
00040 Q_OBJECT
00041 public:
00042 Connection( QObject *parent =0 );
00043 Connection( const QString& host,
00044 QObject *parent = 0 );
00045 Connection( DBusBusType type, QObject* parent = 0 );
00046
00047 bool isConnected() const;
00048 bool isAuthenticated() const;
00049
00050 Message borrowMessage();
00051 Message popMessage();
00052 void stealBorrowMessage( const Message& );
00053 void dbus_connection_setup_with_qt_main (DBusConnection *connection);
00054
00055 public slots:
00056 void open( const QString& );
00057 void close();
00058 void flush();
00059 void send( const Message& );
00060 void sendWithReply( const Message& );
00061 Message sendWithReplyAndBlock( const Message& );
00062
00063 protected slots:
00064 void dispatchRead();
00065
00066 protected:
00067 void init( const QString& host );
00068 virtual void *virtual_hook( int id, void *data );
00069
00070 private:
00071 friend class Internal::Integrator;
00072 DBusConnection *connection() const;
00073 Connection( DBusConnection *connection, QObject *parent );
00074
00075 private:
00076 struct Private;
00077 Private *d;
00078 };
00079
00080 }
00081
00082
00083 #endif