Fernando Gomes
Fernando Gomes

Reputation: 31

SSDP for device discovery

I am developing a hardware device that should be automatically discovered in Windows, so I prefer to do it through SSDP instead of mDNS (Zeroconf, etc.) to avoid to force users to install its support applications. I just need that the device appears in the network in Windows Explorer, and clicking on it to open the default browser using the device IP address in the URL. I've already made the code (answering in unicast to multicast M-SEARCH requests and sending NOTIFY messages on boot and periodically), I can see the messages in Wireshark on the Windows PC but the device still doesn't appear in the explorer network folder, and I can see there other devices like my printer, TV, media player, etc, and I see their messages also on Wireshark. I'm searching for some advice in the content of the notify and response messages, and also in the xml file with the device profile for such a simple device - I just want to advertise that the device has a webserver on its IP address.

These are the messages that I'm sending:

In multicast:

NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=100
NT: upnp:rootdevice
USN: uuid:c5baf4a1-0c8e-44da-9714-ef0123411223::upnp:rootdevice
NTS: ssdp:alive
SERVER: NodeMCU/20150415 UPnP/1.1 xpto/0.1
Location: http://192.168.3.246/deviceprofile.xml

In unicast as a reply to the M-SEARCH:

HTTP/1.1 200 OK
Cache-Control: max-age=100
EXT:
SERVER: NodeMCU/20150415 UPnP/1.1 xpto/0.1
ST: upnp:rootdevice
USN: uuid:c5baf4a1-0c8e-44da-9714-ef0123411223
Location: http://192.168.3.246/deviceprofile.xml

deviceprofile.xml:

<?xml version='1.0'?>
<root xmlns='urn:schemas-upnp-org:device-1-0'>
<device>
<deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
<presentationURL>http://192.168.3.246/</presentationURL>
<friendlyName>Remote control</friendlyName>
<manufacturer>xpto.com</manufacturer>
<manufacturerURL>http://xpto.com/</manufacturerURL>
<serialNumber>10275488</serialNumber>
<UDN>uuid:c5baf4a1-0c8e-44da-9714-ef0123411223</UDN>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:Basic:1</serviceType>
<serviceId>urn:upnp-org:serviceId:1</serviceId>
</service>
</serviceList>
</device></root>

Anything else needed in order for the device to show up in the windows explorer network folder?

Thanks in advance

Fernando

Upvotes: 2

Views: 6883

Answers (2)

Thomas Tempelmann
Thomas Tempelmann

Reputation: 12043

Just in case people come here to find infos about SSDP for the Mac: I've published an open source SSDP Browser.

Upvotes: 0

yjzhang
yjzhang

Reputation: 5309

Your deviceprofile.xml is not well formed according to UPnP Specification. Other element is needed under<service> tag. Also, urn:schemas-upnp-org:service:Basic:1 is illegal, you need to change to UPnP pre-defined or customise under your own namespace. An example could be:

<service>
    <serviceType>urn:schemas-upnp-org:service:XXXX:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:1</serviceId>
    <SCPDURL>URL to service description.xml</SCPDURL>
    <controlURL>URL for control</controlURL>
    <eventSubURL>URL for eventing</eventSubURL> 
</service>

You can check: Part2.3 of http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf

Upvotes: 2

Related Questions