Piskvorkar
16th November 2010, 22:48
Hi,
I'm creating some simple client - service application. Using Qt Mobility 1.1, Qt 4.7 (qtsdk-201005). In my service class i've something as this:
...
public slots:
int sampleMethod(int par1, char par2, QString par3);
Than in client, when got service proxy object successfully using QServiceManager:
QServieManager manager;
...
QObject *serviceProxy = manager.loadInterface(...); // successfull
// now try invoke method
int ret = 0;
bool ok = QMetaObject::invokeMethod(serviceProxy, "sampleMethod", Q_RETURN_ARG(int,ret), Q_ARG(int,0), Q_ARG(char,'a'), Q_ARG(QString,"something"));
Everything seems ok, but the char parameter received in Service is incorrect (not 'a' and when try it again, the value seems to be random). Same for unsinged char, long, unsigned long, ... only int is ok. And maybe some Qt classes as QString, QDataTime are ok. But why not char?
I've even tried to run dbus-monitor and here it seems, that values are passed correctly, so maybe they are parsed from DBus packet in some incorrect way.
If I invoke the same method with the same parameter directly on the Service object, using invoke method, i works fine (sampleMethod on object is called with proper values)
MyServiceObject *service = new MyServiceObject();
invokeMethod(service, "sampleMethod", Q_RETURN_ARG(int,ret), Q_ARG(int,0), Q_ARG(char,'a'), Q_ARG(QString,"something"));
Thanks for ideas.
I'm creating some simple client - service application. Using Qt Mobility 1.1, Qt 4.7 (qtsdk-201005). In my service class i've something as this:
...
public slots:
int sampleMethod(int par1, char par2, QString par3);
Than in client, when got service proxy object successfully using QServiceManager:
QServieManager manager;
...
QObject *serviceProxy = manager.loadInterface(...); // successfull
// now try invoke method
int ret = 0;
bool ok = QMetaObject::invokeMethod(serviceProxy, "sampleMethod", Q_RETURN_ARG(int,ret), Q_ARG(int,0), Q_ARG(char,'a'), Q_ARG(QString,"something"));
Everything seems ok, but the char parameter received in Service is incorrect (not 'a' and when try it again, the value seems to be random). Same for unsinged char, long, unsigned long, ... only int is ok. And maybe some Qt classes as QString, QDataTime are ok. But why not char?
I've even tried to run dbus-monitor and here it seems, that values are passed correctly, so maybe they are parsed from DBus packet in some incorrect way.
If I invoke the same method with the same parameter directly on the Service object, using invoke method, i works fine (sampleMethod on object is called with proper values)
MyServiceObject *service = new MyServiceObject();
invokeMethod(service, "sampleMethod", Q_RETURN_ARG(int,ret), Q_ARG(int,0), Q_ARG(char,'a'), Q_ARG(QString,"something"));
Thanks for ideas.