00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IN_TP_QT_HEADER
00009 #error IN_TP_QT_HEADER
00010 #endif
00011
00012 #include <TelepathyQt/Types>
00013
00014 #include <QtGlobal>
00015
00016 #include <QString>
00017 #include <QObject>
00018 #include <QVariant>
00019
00020 #include <QDBusPendingReply>
00021
00022 #include <TelepathyQt/AbstractInterface>
00023 #include <TelepathyQt/DBusProxy>
00024 #include <TelepathyQt/Global>
00025
00026 namespace Tp
00027 {
00028 class PendingVariant;
00029 class PendingOperation;
00030 }
00031
00032 namespace Tp
00033 {
00034 namespace Client
00035 {
00036 namespace DBus
00037 {
00038
00046 class TP_QT_EXPORT DBusDaemonInterface : public Tp::AbstractInterface
00047 {
00048 Q_OBJECT
00049
00050 public:
00057 static inline QLatin1String staticInterfaceName()
00058 {
00059 return QLatin1String("org.freedesktop.DBus");
00060 }
00061
00069 DBusDaemonInterface(
00070 const QString& busName,
00071 const QString& objectPath,
00072 QObject* parent = 0
00073 );
00074
00083 DBusDaemonInterface(
00084 const QDBusConnection& connection,
00085 const QString& busName,
00086 const QString& objectPath,
00087 QObject* parent = 0
00088 );
00089
00096 DBusDaemonInterface(Tp::DBusProxy *proxy);
00097
00105 explicit DBusDaemonInterface(const Tp::AbstractInterface& mainInterface);
00106
00114 DBusDaemonInterface(const Tp::AbstractInterface& mainInterface, QObject* parent);
00115
00122 Tp::PendingVariantMap *requestAllProperties() const
00123 {
00124 return internalRequestAllProperties();
00125 }
00126
00127 public Q_SLOTS:
00136 inline QDBusPendingReply<QString> Hello(int timeout = -1)
00137 {
00138 if (!invalidationReason().isEmpty()) {
00139 return QDBusPendingReply<QString>(QDBusMessage::createError(
00140 invalidationReason(),
00141 invalidationMessage()
00142 ));
00143 }
00144
00145 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00146 this->staticInterfaceName(), QLatin1String("Hello"));
00147 return this->connection().asyncCall(callMessage, timeout);
00148 }
00149
00158 inline QDBusPendingReply<uint> RequestName(const QString& name, uint flags, int timeout = -1)
00159 {
00160 if (!invalidationReason().isEmpty()) {
00161 return QDBusPendingReply<uint>(QDBusMessage::createError(
00162 invalidationReason(),
00163 invalidationMessage()
00164 ));
00165 }
00166
00167 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00168 this->staticInterfaceName(), QLatin1String("RequestName"));
00169 callMessage << QVariant::fromValue(name) << QVariant::fromValue(flags);
00170 return this->connection().asyncCall(callMessage, timeout);
00171 }
00172
00181 inline QDBusPendingReply<uint> ReleaseName(const QString& name, int timeout = -1)
00182 {
00183 if (!invalidationReason().isEmpty()) {
00184 return QDBusPendingReply<uint>(QDBusMessage::createError(
00185 invalidationReason(),
00186 invalidationMessage()
00187 ));
00188 }
00189
00190 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00191 this->staticInterfaceName(), QLatin1String("ReleaseName"));
00192 callMessage << QVariant::fromValue(name);
00193 return this->connection().asyncCall(callMessage, timeout);
00194 }
00195
00204 inline QDBusPendingReply<uint> StartServiceByName(const QString& service, uint flags, int timeout = -1)
00205 {
00206 if (!invalidationReason().isEmpty()) {
00207 return QDBusPendingReply<uint>(QDBusMessage::createError(
00208 invalidationReason(),
00209 invalidationMessage()
00210 ));
00211 }
00212
00213 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00214 this->staticInterfaceName(), QLatin1String("StartServiceByName"));
00215 callMessage << QVariant::fromValue(service) << QVariant::fromValue(flags);
00216 return this->connection().asyncCall(callMessage, timeout);
00217 }
00218
00227 inline QDBusPendingReply<bool> NameHasOwner(const QString& nameToCheck, int timeout = -1)
00228 {
00229 if (!invalidationReason().isEmpty()) {
00230 return QDBusPendingReply<bool>(QDBusMessage::createError(
00231 invalidationReason(),
00232 invalidationMessage()
00233 ));
00234 }
00235
00236 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00237 this->staticInterfaceName(), QLatin1String("NameHasOwner"));
00238 callMessage << QVariant::fromValue(nameToCheck);
00239 return this->connection().asyncCall(callMessage, timeout);
00240 }
00241
00250 inline QDBusPendingReply<QStringList> ListNames(int timeout = -1)
00251 {
00252 if (!invalidationReason().isEmpty()) {
00253 return QDBusPendingReply<QStringList>(QDBusMessage::createError(
00254 invalidationReason(),
00255 invalidationMessage()
00256 ));
00257 }
00258
00259 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00260 this->staticInterfaceName(), QLatin1String("ListNames"));
00261 return this->connection().asyncCall(callMessage, timeout);
00262 }
00263
00272 inline QDBusPendingReply<QStringList> ListActivatableNames(int timeout = -1)
00273 {
00274 if (!invalidationReason().isEmpty()) {
00275 return QDBusPendingReply<QStringList>(QDBusMessage::createError(
00276 invalidationReason(),
00277 invalidationMessage()
00278 ));
00279 }
00280
00281 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00282 this->staticInterfaceName(), QLatin1String("ListActivatableNames"));
00283 return this->connection().asyncCall(callMessage, timeout);
00284 }
00285
00294 inline QDBusPendingReply<> AddMatch(const QString& rule, int timeout = -1)
00295 {
00296 if (!invalidationReason().isEmpty()) {
00297 return QDBusPendingReply<>(QDBusMessage::createError(
00298 invalidationReason(),
00299 invalidationMessage()
00300 ));
00301 }
00302
00303 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00304 this->staticInterfaceName(), QLatin1String("AddMatch"));
00305 callMessage << QVariant::fromValue(rule);
00306 return this->connection().asyncCall(callMessage, timeout);
00307 }
00308
00317 inline QDBusPendingReply<> RemoveMatch(const QString& rule, int timeout = -1)
00318 {
00319 if (!invalidationReason().isEmpty()) {
00320 return QDBusPendingReply<>(QDBusMessage::createError(
00321 invalidationReason(),
00322 invalidationMessage()
00323 ));
00324 }
00325
00326 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00327 this->staticInterfaceName(), QLatin1String("RemoveMatch"));
00328 callMessage << QVariant::fromValue(rule);
00329 return this->connection().asyncCall(callMessage, timeout);
00330 }
00331
00340 inline QDBusPendingReply<QString> GetNameOwner(const QString& name, int timeout = -1)
00341 {
00342 if (!invalidationReason().isEmpty()) {
00343 return QDBusPendingReply<QString>(QDBusMessage::createError(
00344 invalidationReason(),
00345 invalidationMessage()
00346 ));
00347 }
00348
00349 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00350 this->staticInterfaceName(), QLatin1String("GetNameOwner"));
00351 callMessage << QVariant::fromValue(name);
00352 return this->connection().asyncCall(callMessage, timeout);
00353 }
00354
00363 inline QDBusPendingReply<QStringList> ListQueuedOwners(const QString& name, int timeout = -1)
00364 {
00365 if (!invalidationReason().isEmpty()) {
00366 return QDBusPendingReply<QStringList>(QDBusMessage::createError(
00367 invalidationReason(),
00368 invalidationMessage()
00369 ));
00370 }
00371
00372 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00373 this->staticInterfaceName(), QLatin1String("ListQueuedOwners"));
00374 callMessage << QVariant::fromValue(name);
00375 return this->connection().asyncCall(callMessage, timeout);
00376 }
00377
00386 inline QDBusPendingReply<uint> GetConnectionUnixUser(const QString& connectionName, int timeout = -1)
00387 {
00388 if (!invalidationReason().isEmpty()) {
00389 return QDBusPendingReply<uint>(QDBusMessage::createError(
00390 invalidationReason(),
00391 invalidationMessage()
00392 ));
00393 }
00394
00395 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00396 this->staticInterfaceName(), QLatin1String("GetConnectionUnixUser"));
00397 callMessage << QVariant::fromValue(connectionName);
00398 return this->connection().asyncCall(callMessage, timeout);
00399 }
00400
00409 inline QDBusPendingReply<uint> GetConnectionUnixProcessID(const QString& connectionName, int timeout = -1)
00410 {
00411 if (!invalidationReason().isEmpty()) {
00412 return QDBusPendingReply<uint>(QDBusMessage::createError(
00413 invalidationReason(),
00414 invalidationMessage()
00415 ));
00416 }
00417
00418 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00419 this->staticInterfaceName(), QLatin1String("GetConnectionUnixProcessID"));
00420 callMessage << QVariant::fromValue(connectionName);
00421 return this->connection().asyncCall(callMessage, timeout);
00422 }
00423
00432 inline QDBusPendingReply<QByteArray> GetConnectionSELinuxSecurityContext(const QString& connectionName, int timeout = -1)
00433 {
00434 if (!invalidationReason().isEmpty()) {
00435 return QDBusPendingReply<QByteArray>(QDBusMessage::createError(
00436 invalidationReason(),
00437 invalidationMessage()
00438 ));
00439 }
00440
00441 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00442 this->staticInterfaceName(), QLatin1String("GetConnectionSELinuxSecurityContext"));
00443 callMessage << QVariant::fromValue(connectionName);
00444 return this->connection().asyncCall(callMessage, timeout);
00445 }
00446
00455 inline QDBusPendingReply<> ReloadConfig(int timeout = -1)
00456 {
00457 if (!invalidationReason().isEmpty()) {
00458 return QDBusPendingReply<>(QDBusMessage::createError(
00459 invalidationReason(),
00460 invalidationMessage()
00461 ));
00462 }
00463
00464 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00465 this->staticInterfaceName(), QLatin1String("ReloadConfig"));
00466 return this->connection().asyncCall(callMessage, timeout);
00467 }
00468
00477 inline QDBusPendingReply<QString> GetId(int timeout = -1)
00478 {
00479 if (!invalidationReason().isEmpty()) {
00480 return QDBusPendingReply<QString>(QDBusMessage::createError(
00481 invalidationReason(),
00482 invalidationMessage()
00483 ));
00484 }
00485
00486 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00487 this->staticInterfaceName(), QLatin1String("GetId"));
00488 return this->connection().asyncCall(callMessage, timeout);
00489 }
00490
00491 Q_SIGNALS:
00495 void NameOwnerChanged(const QString& name, const QString& oldOwner, const QString& newOwner);
00496
00500 void NameLost(const QString& name);
00501
00505 void NameAcquired(const QString& name);
00506
00507 protected:
00508 virtual void invalidate(Tp::DBusProxy *, const QString &, const QString &);
00509 };
00510
00518 class TP_QT_EXPORT IntrospectableInterface : public Tp::AbstractInterface
00519 {
00520 Q_OBJECT
00521
00522 public:
00529 static inline QLatin1String staticInterfaceName()
00530 {
00531 return QLatin1String("org.freedesktop.DBus.Introspectable");
00532 }
00533
00541 IntrospectableInterface(
00542 const QString& busName,
00543 const QString& objectPath,
00544 QObject* parent = 0
00545 );
00546
00555 IntrospectableInterface(
00556 const QDBusConnection& connection,
00557 const QString& busName,
00558 const QString& objectPath,
00559 QObject* parent = 0
00560 );
00561
00568 IntrospectableInterface(Tp::DBusProxy *proxy);
00569
00577 explicit IntrospectableInterface(const Tp::AbstractInterface& mainInterface);
00578
00586 IntrospectableInterface(const Tp::AbstractInterface& mainInterface, QObject* parent);
00587
00594 Tp::PendingVariantMap *requestAllProperties() const
00595 {
00596 return internalRequestAllProperties();
00597 }
00598
00599 public Q_SLOTS:
00608 inline QDBusPendingReply<QString> Introspect(int timeout = -1)
00609 {
00610 if (!invalidationReason().isEmpty()) {
00611 return QDBusPendingReply<QString>(QDBusMessage::createError(
00612 invalidationReason(),
00613 invalidationMessage()
00614 ));
00615 }
00616
00617 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00618 this->staticInterfaceName(), QLatin1String("Introspect"));
00619 return this->connection().asyncCall(callMessage, timeout);
00620 }
00621
00622 protected:
00623 virtual void invalidate(Tp::DBusProxy *, const QString &, const QString &);
00624 };
00625
00633 class TP_QT_EXPORT PeerInterface : public Tp::AbstractInterface
00634 {
00635 Q_OBJECT
00636
00637 public:
00644 static inline QLatin1String staticInterfaceName()
00645 {
00646 return QLatin1String("org.freedesktop.DBus.Peer");
00647 }
00648
00656 PeerInterface(
00657 const QString& busName,
00658 const QString& objectPath,
00659 QObject* parent = 0
00660 );
00661
00670 PeerInterface(
00671 const QDBusConnection& connection,
00672 const QString& busName,
00673 const QString& objectPath,
00674 QObject* parent = 0
00675 );
00676
00683 PeerInterface(Tp::DBusProxy *proxy);
00684
00692 explicit PeerInterface(const Tp::AbstractInterface& mainInterface);
00693
00701 PeerInterface(const Tp::AbstractInterface& mainInterface, QObject* parent);
00702
00709 Tp::PendingVariantMap *requestAllProperties() const
00710 {
00711 return internalRequestAllProperties();
00712 }
00713
00714 public Q_SLOTS:
00723 inline QDBusPendingReply<> Ping(int timeout = -1)
00724 {
00725 if (!invalidationReason().isEmpty()) {
00726 return QDBusPendingReply<>(QDBusMessage::createError(
00727 invalidationReason(),
00728 invalidationMessage()
00729 ));
00730 }
00731
00732 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00733 this->staticInterfaceName(), QLatin1String("Ping"));
00734 return this->connection().asyncCall(callMessage, timeout);
00735 }
00736
00745 inline QDBusPendingReply<QString> GetMachineId(int timeout = -1)
00746 {
00747 if (!invalidationReason().isEmpty()) {
00748 return QDBusPendingReply<QString>(QDBusMessage::createError(
00749 invalidationReason(),
00750 invalidationMessage()
00751 ));
00752 }
00753
00754 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00755 this->staticInterfaceName(), QLatin1String("GetMachineId"));
00756 return this->connection().asyncCall(callMessage, timeout);
00757 }
00758
00759 protected:
00760 virtual void invalidate(Tp::DBusProxy *, const QString &, const QString &);
00761 };
00762
00770 class TP_QT_EXPORT PropertiesInterface : public Tp::AbstractInterface
00771 {
00772 Q_OBJECT
00773
00774 public:
00781 static inline QLatin1String staticInterfaceName()
00782 {
00783 return QLatin1String("org.freedesktop.DBus.Properties");
00784 }
00785
00793 PropertiesInterface(
00794 const QString& busName,
00795 const QString& objectPath,
00796 QObject* parent = 0
00797 );
00798
00807 PropertiesInterface(
00808 const QDBusConnection& connection,
00809 const QString& busName,
00810 const QString& objectPath,
00811 QObject* parent = 0
00812 );
00813
00820 PropertiesInterface(Tp::DBusProxy *proxy);
00821
00829 explicit PropertiesInterface(const Tp::AbstractInterface& mainInterface);
00830
00838 PropertiesInterface(const Tp::AbstractInterface& mainInterface, QObject* parent);
00839
00846 Tp::PendingVariantMap *requestAllProperties() const
00847 {
00848 return internalRequestAllProperties();
00849 }
00850
00851 public Q_SLOTS:
00860 inline QDBusPendingReply<QDBusVariant> Get(const QString& interfaceName, const QString& propertyName, int timeout = -1)
00861 {
00862 if (!invalidationReason().isEmpty()) {
00863 return QDBusPendingReply<QDBusVariant>(QDBusMessage::createError(
00864 invalidationReason(),
00865 invalidationMessage()
00866 ));
00867 }
00868
00869 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00870 this->staticInterfaceName(), QLatin1String("Get"));
00871 callMessage << QVariant::fromValue(interfaceName) << QVariant::fromValue(propertyName);
00872 return this->connection().asyncCall(callMessage, timeout);
00873 }
00874
00883 inline QDBusPendingReply<> Set(const QString& interfaceName, const QString& propertyName, const QDBusVariant& value, int timeout = -1)
00884 {
00885 if (!invalidationReason().isEmpty()) {
00886 return QDBusPendingReply<>(QDBusMessage::createError(
00887 invalidationReason(),
00888 invalidationMessage()
00889 ));
00890 }
00891
00892 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00893 this->staticInterfaceName(), QLatin1String("Set"));
00894 callMessage << QVariant::fromValue(interfaceName) << QVariant::fromValue(propertyName) << QVariant::fromValue(value);
00895 return this->connection().asyncCall(callMessage, timeout);
00896 }
00897
00906 inline QDBusPendingReply<QVariantMap> GetAll(const QString& interfaceName, int timeout = -1)
00907 {
00908 if (!invalidationReason().isEmpty()) {
00909 return QDBusPendingReply<QVariantMap>(QDBusMessage::createError(
00910 invalidationReason(),
00911 invalidationMessage()
00912 ));
00913 }
00914
00915 QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(),
00916 this->staticInterfaceName(), QLatin1String("GetAll"));
00917 callMessage << QVariant::fromValue(interfaceName);
00918 return this->connection().asyncCall(callMessage, timeout);
00919 }
00920
00921 protected:
00922 virtual void invalidate(Tp::DBusProxy *, const QString &, const QString &);
00923 };
00924 }
00925 }
00926 }
00927 Q_DECLARE_METATYPE(Tp::Client::DBus::DBusDaemonInterface*)
00928 Q_DECLARE_METATYPE(Tp::Client::DBus::IntrospectableInterface*)
00929 Q_DECLARE_METATYPE(Tp::Client::DBus::PeerInterface*)
00930 Q_DECLARE_METATYPE(Tp::Client::DBus::PropertiesInterface*)