[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [Semi-OT] How to get a dbus array of dbus_object_path from a
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-02-12 17:48:40
Message-ID: 200702121848.41136.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Iván Forcada Atienza wrote:
>I'm trying to get the response from a dbus call using qt4 dbus module.
>I'm able to get a QString reply without problems, but the problems
>arrive when this reply is an aggregation of a primitive type (not
>QStringList).
>
>For example, if I want to get this:

>ivan@masao:~$ dbus-send --system --print-reply --reply-timeout=2000
> --type=method_call --dest=org.freedesktop.NetworkManager
> /org/freedesktop/NetworkManager
> +org.freedesktop.NetworkManager.getDevices

>method return sender=:1.2 -> dest=:1.28
>   array [
>      object path "/org/freedesktop/NetworkManager/Devices/ath0"
>   ]
>
>I code the following:
>
>QDBusConnection bus = QDBusConnection::systemBus();
>QDBusInterface dbus_iface(
>                        "org.freedesktop.NetworkManager",
>                        "/org/freedesktop/NetworkManager",
>                        "org.freedesktop.NetworkManager", bus);
>QDBusReply<QStringList> reply = dbus_iface.call("getDevices");

Stop. That's not the correct reply type.

You can see from the reply above that it's an array of object paths, not 
an array of strings. So you can't use a QStringList. Please use 
QList<QDBusObjectPath>.

>... but I always get:
>Error:  "Unexpected reply signature" (
> "org.freedesktop.DBus.Error.InvalidSignature" )
>
>
>It seems that the problem is that call() method is not returning a
> QStringList DBusReply. So I've changed it to QDBusVariant, QString,
> QDBusObjectPath ... but no success.

QList<QDBusObjectPath>.

Unless that method is a QVariantList in disguise. I am not sure.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic