Hi,<br>I'm currently creating an Android application aiming to be able to fully control all multimedia application using DBus system. That way, I would be able to control pretty much all of linux audio and video programs from a single application and server, nice ;)<br>
<br>I managed to go pretty far on my own, the android application works (with a minimal set of functionalities for now), the MPRIS1 interface works perfectly, and MPRIS2 is well on the way, but for a single problem that kept me stuck for a while now.<br>
<br>I need to connect my application to the signal org.freedesktop.DBUS.Properties.PropertiesChanged.<br>Here is how the signals are organised :<br>Bus name: org.bansheeproject.Banshee<br>Object Path : /org/mpris/MediaPlayer2<br>
Interface : org.freedesktop.DBus.Properties (containing the PropertiesChanged signal)<br><br>So I applied the same principle I used successfully until then to try to use this signal:<br>- Create an interface extending DBusInterface, and using the annotation<br>
@DBusInterfaceName("org.freedesktop.DBus.Properties")<br><br>- Creating a handler implementing DBusSigHandler<br><br>- Connecting the the handler to dbus via the addSigHandler function<br><br>But this time, it doesn't work. I think I might be doing something wrong about the fact that the interface is org.freedesktop.DBus.Properties.<br>
Usually I dealt with interfaces that had the same name as the object path (like org.mpris.MediaPlayer2.Player for instance).<br><br>Here are the relevant (adapted to be more readable) code part, and stripped bare of anything useless to solve my problem<br>
<br><br><br>** File: dbus.mpris2.DBusMPRIS2.java<br>String serviceBusName = "org.mpris.MediaPlayer2.banshee";<br>String playerPath = "/org/mpris/MediaPlayer2";<br>String playerPropertiesInterface = "org.mpris.MediaPlayer2.Player";<br>
        trackListObjectPath = "/TrackList";<br>protected static DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION);<br><br>// THIS ONE DOESN'T work<br>PropertiesHandler pHandler = new PropertiesHandler();<br>
conn.addSigHandler(org.mpris.MediaPlayer2.PropertiesChangedSignal.PropertiesChanged.class, pHandler);<br><br>// This one works perfectly<br>SeekedHandler seekedHandler = new SeekedHandler(server);<br>conn.addSigHandler(org.mpris.MediaPlayer2.Player.Seeked.class, seekedHandler);<br>
<br><br>**************************************************<br>** File : dbus.mpris2.PropertiesChangedSignal.java <br>I wanted to put it into org.freedesktop.DBus.Properties.java, but obviously I can't, because the interface already exists...<br>
I think that it is the source of my problem, since I don't quite understand the relationship between the annotation, and the package location...<br>**************************************************<br>@DBusInterfaceName("org.freedesktop.DBus.Properties")<br>
public interface PropertiesChangedSignal extends DBusInterface {<br><br>    public static class PropertiesChanged extends DBusSignal {<br>        public final Map<String, Variant> changed_properties;<br>        public final List<String> invalidated_properties;<br>
<br>        public PropertiesChanged(String path,<br>                Map<String, Variant> changed_properties,<br>                List<String> invalidated_properties) throws DBusException {<br>            super(path, changed_properties, invalidated_properties);<br>
            this.changed_properties = changed_properties;<br>            this.invalidated_properties = invalidated_properties;<br>        }<br>    }<br>}<br><br>***************************<br>** File: PropertiesHandler<br>
***************************<br><br>public class PropertiesHandler implements DBusSigHandler<dbus.mpris2.PropertiesChangedSignal.PropertiesChanged>  {<br><br>    @Override<br>    public void handle(PropertiesChanged arg0) {<br>
        // TODO Auto-generated method stub<br>        System.out.println("SIGNAL RECIEVED!!! AT LAST");<br>    }<br><br>}<br><br><br><br><br>*****<br>And finally, here is the dbus log relevant to the signal<br><br>
signal sender=:1.68 -> dest=(null destination) serial=828 path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged<br>   string "org.mpris.MediaPlayer2.Player"<br>   array [<br>
      dict entry(<br>         string "PlaybackStatus"<br>         variant             string "Paused"<br>      )<br>   ]<br>   array [<br>   ]<br><br><br><br>*****<br>If you need to have a look at my full code to get a better understanding of the situation, it is here: <a href="https://github.com/geenux/AndroidMultimediaControl">https://github.com/geenux/AndroidMultimediaControl</a><br>
<br>Another little side question: Why didn't CreateInterface provide me the interface for the PropertiesChanged signal, but provided it for everything else than this signal? <br><br>Thanks in advance for your precious help,<br>
<br>Arnaud TANGUY<br><br>