From kde-devel Mon Feb 12 17:48:40 2007 From: Thiago Macieira Date: Mon, 12 Feb 2007 17:48:40 +0000 To: kde-devel Subject: Re: [Semi-OT] How to get a dbus array of dbus_object_path from a Message-Id: <200702121848.41136.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-devel&m=117130256818116 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0582506721==" --===============0582506721== Content-Type: multipart/signed; boundary="nextPart23431189.e2O8r9qD0c"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart23431189.e2O8r9qD0c Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Iv=E1n 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=3D2000 > --type=3Dmethod_call --dest=3Dorg.freedesktop.NetworkManager > /org/freedesktop/NetworkManager > +org.freedesktop.NetworkManager.getDevices >method return sender=3D:1.2 -> dest=3D:1.28 > array [ > object path "/org/freedesktop/NetworkManager/Devices/ath0" > ] > >I code the following: > >QDBusConnection bus =3D QDBusConnection::systemBus(); >QDBusInterface dbus_iface( > "org.freedesktop.NetworkManager", > "/org/freedesktop/NetworkManager", > "org.freedesktop.NetworkManager", bus); >QDBusReply reply =3D 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=20 an array of strings. So you can't use a QStringList. Please use=20 QList. >... 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. Unless that method is a QVariantList in disguise. I am not sure. =2D-=20 =A0 Thiago Macieira =A0- =A0thiago (AT) macieira.info - thiago (AT) kde.org =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint: =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358 --nextPart23431189.e2O8r9qD0c Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQBF0Kh5M/XwBW70U1gRArq+AKCaKokNe3JfgqD8SzSBFjQbQIa91ACeLjRU FNSBxzLQqBpnXEDquPCLevU= =/JZz -----END PGP SIGNATURE----- --nextPart23431189.e2O8r9qD0c-- --===============0582506721== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============0582506721==--