00001
00023 #ifndef _TelepathyQt_base_connection_h_HEADER_GUARD_
00024 #define _TelepathyQt_base_connection_h_HEADER_GUARD_
00025
00026 #ifndef IN_TP_QT_HEADER
00027 #error IN_TP_QT_HEADER
00028 #endif
00029
00030 #include <TelepathyQt/DBusService>
00031 #include <TelepathyQt/Global>
00032 #include <TelepathyQt/Types>
00033
00034 #include <QDBusConnection>
00035
00036 class QString;
00037
00038 namespace Tp
00039 {
00040
00041 class TP_QT_EXPORT BaseConnection : public DBusService
00042 {
00043 Q_OBJECT
00044 Q_DISABLE_COPY(BaseConnection)
00045
00046 public:
00047 static BaseConnectionPtr create(const QString &cmName, const QString &protocolName,
00048 const QVariantMap ¶meters)
00049 {
00050 return BaseConnectionPtr(new BaseConnection(
00051 QDBusConnection::sessionBus(), cmName, protocolName, parameters));
00052 }
00053 template<typename BaseConnectionSubclass>
00054 static SharedPtr<BaseConnectionSubclass> create(const QString &cmName,
00055 const QString &protocolName, const QVariantMap ¶meters)
00056 {
00057 return SharedPtr<BaseConnectionSubclass>(new BaseConnectionSubclass(
00058 QDBusConnection::sessionBus(), cmName, protocolName, parameters));
00059 }
00060 static BaseConnectionPtr create(const QDBusConnection &dbusConnection,
00061 const QString &cmName, const QString &protocolName,
00062 const QVariantMap ¶meters)
00063 {
00064 return BaseConnectionPtr(new BaseConnection(
00065 dbusConnection, cmName, protocolName, parameters));
00066 }
00067 template<typename BaseConnectionSubclass>
00068 static SharedPtr<BaseConnectionSubclass> create(const QDBusConnection &dbusConnection,
00069 const QString &cmName, const QString &protocolName,
00070 const QVariantMap ¶meters)
00071 {
00072 return SharedPtr<BaseConnectionSubclass>(new BaseConnectionSubclass(
00073 dbusConnection, cmName, protocolName, parameters));
00074 }
00075
00076 virtual ~BaseConnection();
00077
00078 QString cmName() const;
00079 QString protocolName() const;
00080 QVariantMap parameters() const;
00081
00082 QVariantMap immutableProperties() const;
00083
00084 virtual QString uniqueName() const;
00085 bool registerObject(DBusError *error = NULL);
00086
00087 Q_SIGNALS:
00088 void disconnected();
00089
00090 protected:
00091 BaseConnection(const QDBusConnection &dbusConnection,
00092 const QString &cmName, const QString &protocolName,
00093 const QVariantMap ¶meters);
00094
00095 virtual bool registerObject(const QString &busName, const QString &objectPath,
00096 DBusError *error);
00097
00098 private:
00099 class Adaptee;
00100 friend class Adaptee;
00101 class Private;
00102 friend class Private;
00103 Private *mPriv;
00104 };
00105
00106 }
00107
00108 #endif