Hi all,<br>I m writing a Java class which needs to execute the &quot;GetAllProperties&quot; method from the  org.freedesktop.Hal.Device interface&nbsp; with the following signature:<br> &lt;interface name=&quot;org.freedesktop.Hal.Device&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;method name=&quot;GetAllProperties&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;arg name=&quot;properties&quot; direction=&quot;out&quot; type=&quot;a{sv}&quot;/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/method&gt;<br>...<br>&lt;/interface&gt;<br><br>What is the correct prototype I have to use when I declare it in a DBusInterface ? <br>
This is my attempt, Is it correct ?: <br>package org.freedesktop.Hal;<br><br>import java.util.Map;<br>import org.freedesktop.dbus.DBusInterface;<br>import org.freedesktop.dbus.Variant;<br><br>public interface Device extends DBusInterface {<br>
&nbsp;&nbsp;&nbsp; public Map&lt;String,Variant&lt;Object&gt;&gt; GetAllProperties();<br>...<br>}<br><br><br>I invoke this method with :<br>Device d = (Device) conn.getRemoteObject(&quot;org.freedesktop.Hal&quot;,&quot;/org/freedesktop/Hal/devices/computer&quot;,Device.class);<br>
d.GetAllProperties();<br><br>I managed to get the key (String) and the value (Variant&lt;Object&gt;) with:<br> Variant&lt;Map&lt;String,Variant&lt;Object&gt;&gt;&gt; v = new Variant&lt;Map&lt;String,Variant&lt;Object&gt;&gt;&gt;(d.GetAllProperties(), new DBusMapType(String.class, Variant.class));<br>
Map&lt;String,Variant&lt;Object&gt;&gt; mp = v.getValue();<br>Iterator&lt;String&gt; iter = mp.keySet().iterator();<br>while(iter.hasNext()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s = iter.next();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(&quot;Property: &quot;+s + &quot;- &quot;+mp.get(s).toString());<br>
}<br><br>How can I cast the values (Variant&lt;Object&gt;) to their equivalent Java types (which are known in advance) ?<br><br>Thanks<br>Gilles<br><br>