qdbusconnection.h

00001 /* qdbusconnection.h QDBusConnection object
00002  *
00003  * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
00004  *
00005  * Licensed under the Academic Free License version 2.1
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 #ifndef QDBUSCONNECTION_H
00024 #define QDBUSCONNECTION_H
00025 
00026 #include "dbus/qdbus.h"
00027 #include <QtCore/qstring.h>
00028 
00029 class QDBusConnectionPrivate;
00030 class QDBusError;
00031 class QDBusMessage;
00032 class QByteArray;
00033 class QObject;
00034 
00035 class QDBUS_EXPORT QDBusConnection
00036 {
00037 public:
00038     enum BusType { SessionBus, SystemBus, ActivationBus };
00039 
00040     QDBusConnection(const QString &name = QLatin1String(default_connection_name));
00041     QDBusConnection(const QDBusConnection &other);
00042     ~QDBusConnection();
00043 
00044     QDBusConnection &operator=(const QDBusConnection &other);
00045 
00046     bool isConnected() const;
00047     QDBusError lastError() const;
00048 
00049     enum NameRequestMode { NoReplace = 0, AllowReplace = 1, ReplaceExisting = 2 };
00050     bool requestName(const QString &name, NameRequestMode mode = NoReplace);
00051 
00052     QString baseService() const;
00053 
00054     bool send(const QDBusMessage &message) const;
00055     QDBusMessage sendWithReply(const QDBusMessage &message) const;
00056     int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver,
00057                            const char *slot) const;
00058 
00059     bool connect(const QString &path, const QString &interface,
00060                  const QString &name, QObject *receiver, const char *slot);
00061 
00062     bool registerObject(const QString &path, const QString &interface,
00063                         QObject *object);
00064     void unregisterObject(const QString &path);
00065 
00066     static QDBusConnection addConnection(BusType type,
00067                                const QString &name = QLatin1String(default_connection_name));
00068     static QDBusConnection addConnection(const QString &address,
00069                                const QString &name = QLatin1String(default_connection_name));
00070     static void closeConnection(const QString &name = QLatin1String(default_connection_name));
00071 
00072     QT_STATIC_CONST char *default_connection_name;
00073 
00074 private:
00075     QDBusConnectionPrivate *d;
00076 };
00077 
00078 #endif

Generated on Wed Feb 27 10:13:38 2008 for D-BUS by  doxygen 1.4.6