master-nevi / UPnAtom

An open source Universal Plug and Play library with a focus on media streaming coordination using the UPnP A/V profile; written in Swift but for both Objective-C and Swift apps.
MIT License
137 stars 55 forks source link

Discover services and devices defined by device #17

Open bpeschier opened 8 years ago

bpeschier commented 8 years ago

Devices can list their own services and (sub)devices in the serviceList and deviceList properties (and those can in their place list services and devices, etc). In the current implementation discovery is purely done by the SSDP.

master-nevi commented 8 years ago

I was under the impression that sub devices and sub services would advertise themselves over SSDP as well in which case they would get picked up. Are you saying they don't? If not do you have some description XML to test with?

bpeschier commented 8 years ago

They do as well, but the definition is also on the device, which makes it easier to discover related services (I need the MediaRenderer and the AVTransport of a single device, with multiple devices advertising)

This is a part of the description XML, it lists services and subdevices with their services:


<?xml version="1.0" encoding="utf-8" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
   ...
    <serviceList>
      <service>
        <serviceType>urn:schemas-upnp-org:service:AlarmClock:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:AlarmClock</serviceId>
        <controlURL>/AlarmClock/Control</controlURL>
        <eventSubURL>/AlarmClock/Event</eventSubURL>
        <SCPDURL>/xml/AlarmClock1.xml</SCPDURL>
      </service>    
      <service>
        <serviceType>urn:schemas-upnp-org:service:MusicServices:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:MusicServices</serviceId>
        <controlURL>/MusicServices/Control</controlURL>
        <eventSubURL>/MusicServices/Event</eventSubURL>
        <SCPDURL>/xml/MusicServices1.xml</SCPDURL>
      </service>    
      <service>
        <serviceType>urn:schemas-upnp-org:service:AudioIn:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:AudioIn</serviceId>
        <controlURL>/AudioIn/Control</controlURL>
        <eventSubURL>/AudioIn/Event</eventSubURL>
        <SCPDURL>/xml/AudioIn1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:DeviceProperties:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:DeviceProperties</serviceId>
        <controlURL>/DeviceProperties/Control</controlURL>
        <eventSubURL>/DeviceProperties/Event</eventSubURL>
        <SCPDURL>/xml/DeviceProperties1.xml</SCPDURL>
      </service>    
      <service>
        <serviceType>urn:schemas-upnp-org:service:SystemProperties:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:SystemProperties</serviceId>
        <controlURL>/SystemProperties/Control</controlURL>
        <eventSubURL>/SystemProperties/Event</eventSubURL>
        <SCPDURL>/xml/SystemProperties1.xml</SCPDURL>
      </service>    
      <service>
        <serviceType>urn:schemas-upnp-org:service:ZoneGroupTopology:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:ZoneGroupTopology</serviceId>
        <controlURL>/ZoneGroupTopology/Control</controlURL>
        <eventSubURL>/ZoneGroupTopology/Event</eventSubURL>
        <SCPDURL>/xml/ZoneGroupTopology1.xml</SCPDURL>
      </service>    
      <service>
        <serviceType>urn:schemas-upnp-org:service:GroupManagement:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:GroupManagement</serviceId>
        <controlURL>/GroupManagement/Control</controlURL>
        <eventSubURL>/GroupManagement/Event</eventSubURL>
        <SCPDURL>/xml/GroupManagement1.xml</SCPDURL>
      </service>
    </serviceList>
    <deviceList>
      <device>
  <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
  ...
  <serviceList>
    <service>
      <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
      <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
      <controlURL>/MediaServer/ContentDirectory/Control</controlURL>
      <eventSubURL>/MediaServer/ContentDirectory/Event</eventSubURL>
      <SCPDURL>/xml/ContentDirectory1.xml</SCPDURL>
    </service>
    <service>
      <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
        <controlURL>/MediaServer/ConnectionManager/Control</controlURL>
        <eventSubURL>/MediaServer/ConnectionManager/Event</eventSubURL>
        <SCPDURL>/xml/ConnectionManager1.xml</SCPDURL>
      </service>
    </serviceList>
      </device>
      <device>
    <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
        ....
    <serviceList>
      <service>
        <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
        <controlURL>/MediaRenderer/RenderingControl/Control</controlURL>
        <eventSubURL>/MediaRenderer/RenderingControl/Event</eventSubURL>
        <SCPDURL>/xml/RenderingControl1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
        <controlURL>/MediaRenderer/ConnectionManager/Control</controlURL>
        <eventSubURL>/MediaRenderer/ConnectionManager/Event</eventSubURL>
        <SCPDURL>/xml/ConnectionManager1.xml</SCPDURL>
      </service>
      <service>
        <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
        <controlURL>/MediaRenderer/AVTransport/Control</controlURL>
        <eventSubURL>/MediaRenderer/AVTransport/Event</eventSubURL>
        <SCPDURL>/xml/AVTransport1.xml</SCPDURL>
      </service>
          <service>
            <serviceType>urn:schemas-upnp-org:service:GroupRenderingControl:1</serviceType>
            <serviceId>urn:upnp-org:serviceId:GroupRenderingControl</serviceId>
            <controlURL>/MediaRenderer/GroupRenderingControl/Control</controlURL>
            <eventSubURL>/MediaRenderer/GroupRenderingControl/Event</eventSubURL>
            <SCPDURL>/xml/GroupRenderingControl1.xml</SCPDURL>
          </service>
    </serviceList>
      </device>
    </deviceList>
  </device>
</root>