Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
  3. <node>
  4. <interface name="some.interface.Foo">
  5. <method name="GetValues">
  6. <arg name="values" type="a(oa{sv})" direction="out"/>
  7. <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<SomeStruct>" />
  8. </method>
  9. </interface>
  10. </node>
  11.  
  12. qdbusxml2cpp-qt5 -c InterfaceFoo -p interface_foo foo.xml
  13.  
  14. class InterfaceFoo: public QDBusAbstractInterface
  15. {
  16. Q_OBJECT
  17. public:
  18. static inline const char *staticInterfaceName()
  19. { return "some.interface.Foo"; }
  20.  
  21. public:
  22. InterfaceFoo(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
  23.  
  24. ~InterfaceFoo();
  25.  
  26. public Q_SLOTS: // METHODS
  27. inline QDBusPendingReply<QList<SomeStruct> > GetValues()
  28. {
  29. QList<QVariant> argumentList;
  30. // NOTICE THIS LINE.
  31. return asyncCallWithArgumentList(QStringLiteral("GetValues"), argumentList);
  32. }
  33.  
  34. Q_SIGNALS: // SIGNALS
  35. };
  36.  
  37. namespace some {
  38. namespace interface {
  39. typedef ::InterfaceFoo Foo;
  40. }
  41. }
  42. #endif
  43.  
  44. some::interface::Foo *interface = new some::interface::Foo("some::interface", "/Foo", QDBusConnection::systemBus(), this);
  45. // THIS SHOULD block until a reply is received or it times out.
  46. QList<SomeStruct> data = interface->GetValues();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement