[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-23 21:00:08
Message-ID: 200702232200.08896.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Iván Forcada Atienza wrote:
>dbus-send --system --print-reply --reply-timeout=2000
> --type=method_call --dest=org.freedesktop.NetworkManager
> /org/freedesktop/NetworkManager/Devices/ath0/Networks/WiForcada
> org.freedesktop.NetworkManager.getProperties
>
>Thanks 4 your patience :-)))

Please use the tools at your disposal. If the method that you are calling 
doesn't return a QVariantMap, you shouldn't use QVariantMap. Find out 
what that type is and use it.

First and foremost: qdbus.

For example:
$ qdbus --system 
org.freedesktop.Hal /org/freedesktop/Hal/devices/computer | 
grep 'GetProperty('
method QDBusVariant org.freedesktop.Hal.Device.GetProperty(QString key)

As you can see, that method returns a QDBusVariant.

Another useful tool: qdbusxml2cpp. For example, fetch the XML 
introspection from Hal like this:

$ qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer 
Introspect > /tmp/Hal.xml

And then generate a nice C++ class with qdbusxml2cpp:
$ qdbusxml2cpp -p device -m /tmp/Hal.xml org.freedesktop.Hal.Device

(Unfortunately, that above will fail because the type a{sv} needs to be 
further described for qdbusxml2cpp to work. It'll describe what to do.)

Use the device.h and device.cpp files it generates in your project. It's a 
lot easier to use and a lot error prone as well.

Now, I don't have NetworkManager, so I can't help you there. If NM doesn't 
return XML introspection (and I think someone told me on IRC it doesn't), 
please go scream at the NM developers. Any D-Bus application that is 
self-respecting MUST return its XML introspection. (you can quote me on 
that)

-- 
  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