Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Related Pages

connection.h

00001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002 /* connection.h: Qt wrapper for DBusConnection
00003  *
00004  * Copyright (C) 2003  Zack Rusin <zack@kde.org>
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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

Generated on Tue Sep 13 01:28:06 2005 for D-BUS by  doxygen 1.4.4