How to handle multi output parameters with DBUS-Method?
-
Hi all
I have a xml file as bellow:
@<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.example.chat">
<method name="CalcTime">
<arg name="TimeStamp" direction="out" type="i">
<doc>
<line> TimeStamp: The value of the monotonic system clock (millisecond precision) when this signal was sent out.</line>
</doc>
</arg>
<arg name="IsDaylightSaving" direction="out" type="i">
<doc>
<line> 1 is DST is currently used, 0 otherwise.</line>
</doc>
</arg>
</method>
</interface>
</node>@as the xml file, that have two parameter for output, and I using qtdbusxml2cpp got the interface file as bellow:
@class OrgExampleChatInterface: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "org.example.chat"; }public:
OrgExampleChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
~OrgExampleChatInterface();public Q_SLOTS: // METHODS
inline QDBusPendingReply<int, int> CalcTime()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QLatin1String("CalcTime" ), argumentList);
}
inline QDBusReply<int> CalcTime(int &IsDaylightSaving)
{
QList<QVariant> argumentList;
QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CalcTime"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) {
IsDaylightSaving = qdbus_cast<int>(reply.arguments().at(1));
}
return reply;
}Q_SIGNALS: // SIGNALS
};namespace org {
namespace example {
typedef ::OrgExampleChatInterface chat;
}
}@I implement the method in server:
@int ChatMainWindow::CalcTime(int& val)
{
val = 8;
return 1024;
}@and call it in client:
@int v3;
QDBusReply<int> reply = ifc->CalcTime(v3);
qDebug() << "###########: " << reply;
qDebug() << "###########: " << v3;
@
but the method does'nt run in server, the client output as bellow:
###########: 151468768
###########: 0I found that doesn't called at the CalcTime function in server ,
What's wrong? please correct it. thank you very munch.BR,
Mecland