DBus Interface
D-Bus Interface
Coherence provides a D-Bus interface for other application enabling them to act as a UPnP client. Later we'll add methods to provide UPnP server functionality too.
Coherence if started with the use_dbus option, creates atm a service on the Session Bus. The object path of that service is '/org/Coherence', the interface is named 'org.Coherence'.
Coherence sends out signals for every device that shows up on the network, passing a D-Bus struct as a parameter. And again if that device detaches itself from the network, as parameter we have here the device udn.
At the moment these (UPnP A/V centric) signals are send:
- UPnP_ControlPoint_MediaServer_detected
- UPnP_ControlPoint_MediaServer_removed
- UPnP_ControlPoint_MediaRenderer_detected
- UPnP_ControlPoint_MediaRenderer_removed
A D-Bus device object is created for every UPnP device the internal ControlPoint detects on the network.
The object path of that device object is '/org/Coherence/devices/<uuid>', where uuid is a sanitized version of the real device uuid, without the 'uuid:' part and all '-'s removed.
uuid:fe814e3e-5214-4c24-847b-383fb599ff01 -> fe814e3e52144c24847b383fb599ff01
Furthermore D-Bus service objects are created for every service that device has.
The object path of these service objects is '/org/Coherence/devices/<uuid>/services/<service-id>'.
Having a File-Manager as a client
Upon the UPnP_ControlPoint_MediaServer_detected signal the file-manager should show a new device 'root'-folder in its network folder. And on the UPnP_ControlPoint_MediaServer_removed' remove that accordingly.
Now entering that or its subsequent folders should result in calling the Browse method of that device objects ContentDirectoryService?.
There will be a convenience method, to simplify the interaction with Coherence a bit.
The result of that convenience method could be a a{ss} dict with initially something like:
- name: title of the CDS object
- type: container or item
- id: id of the CDS object
- thumb: upnp:albumArtURI or dlna:profileID==JPEG_TN
and additionally for items:
- location: uri of first resource
- size: res:size
- mtime: dc:date
