Reply
Thread Tools
sakya's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#1
Hi!

I have a problem with a dbus method call using Qt.

The method I'm calling is this (it works in the terminal):
Code:
dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_operator_name byte:0 uint32:10 uint32:222
method return sender=:1.20 -> dest=:1.4287 reply_serial=2
   string "vodafone IT"
   int32 0
When I try to call it from Qt I always get the error:
Code:
can't find method Phone.Net::get_operator_name
Here's my code
Code:
QDBusInterface device(QLatin1String("com.nokia.phone.net"),
                      QLatin1String("/com/nokia/phone/net"),
                      QLatin1String("Phone.Net"),
                      QDBusConnection::systemBus());
int opCode = 10;
int countryCode = 222;
QDBusMessage msg = device.call(QLatin1String("get_operator_name"), 0, opCode, countryCode);
I'm almost sure the device is correct (it works for calling get_registration_status) so what's the problem?

Many thanks.

Last edited by sakya; 2011-09-07 at 19:36.
 
Posts: 235 | Thanked: 339 times | Joined on Nov 2010
#2
It's an issue of wrong types. You're sending (I believe) three integers, when the method wants a byte and two quint32's. I would cast 0 to a uchar and make the other two quint32.

That error message is dodgy; I think it's a custom one sent by the CSD daemon
 

The Following 2 Users Say Thank You to jstokes For This Useful Post:
sakya's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#3
Thanks for your reply.
I get the same error passing one uchar and two quint32 variables.

EDIT: From Qt documentation here:
http://doc.trolltech.org/latest/qdbustypesystem.html

uchar --> BYTE
uint --> UINT32

but also using uchar and two uint I get the same error...strange.

Last edited by sakya; 2011-09-07 at 19:33.
 

The Following User Says Thank You to sakya For This Useful Post:
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#4
This one works for me:


QDBusMessage msg = device.call(QLatin1String("get_operator_name"), QVariant::fromValue(uchar(0)), opCode, countryCode);
 

The Following 2 Users Say Thank You to nicolai For This Useful Post:
sakya's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#5
Yes, it works using QVariant::fromValue(), many thanks.
 

The Following User Says Thank You to sakya For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 21:00.