Hi,
In documentation of DBus in qt: Declaring Slots in D-Bus Adaptors information about QDBusMessage parameter can be found.
I need access to this parameter to be able post errors instead standard output.
According to this documentation it should look like this (more or less):
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.some.dbus.iterface.name")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.some.dbus.iterface.name\">\n"
" <method name=\"myMethod\">\n"
" <arg direction=\"in\" type=\"u\" name=\"in\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"out1\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"out2\"/>\n"
" </method>\n"
"")
public:
.... // standard stuff
public Q_SLOTS:
bool myMethod
(uint in,
QString &out2
);
// this version works bool myMethod
(uint in,
const QDBusMessege
&messege,
QString &out2
);
// this version doesn't work }
class SomeAdaptor : public: QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.some.dbus.iterface.name")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.some.dbus.iterface.name\">\n"
" <method name=\"myMethod\">\n"
" <arg direction=\"in\" type=\"u\" name=\"in\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"out1\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"out2\"/>\n"
" </method>\n"
"")
public:
.... // standard stuff
public Q_SLOTS:
bool myMethod(uint in, QString &out2); // this version works
bool myMethod(uint in, const QDBusMessege &messege, QString &out2); // this version doesn't work
}
To copy to clipboard, switch view to plain text mode
First version of myMethod slot works perfectly! Data are received and send back.
But when this method is replaced with second version, it doesn't work (client is unable to call method).
Now what should I do to make it work?
Should I correct xml data in Q_CLASSINFO("D-Bus Introspection"? If yes, than how?
Or maybe my declaration of slot is incorrect?
Documentations says that this argument should be between input and output arguments like in my example.
Bookmarks