我正在开发一个应该在 Windows 中自动发现的硬件设备,所以我更喜欢通过 SSDP 而不是 mDNS(Zeroconf 等)来完成,以避免强制用户安装其支持应用程序。我只需要设备出现在 Windows 资源管理器的网络中,然后单击它以使用 URL 中的设备 IP 地址打开默认浏览器。我已经编写了代码(以单播方式回答多播 M-SEARCH 请求并在启动时定期发送 NOTIFY 消息),我可以在 Windows PC 上的 Wireshark 中看到消息,但设备仍然没有出现在资源管理器网络中文件夹,我可以看到其他设备,如我的打印机、电视、媒体播放器等,我也在 Wireshark 上看到他们的消息。我在通知和响应消息的内容中寻找一些建议,
这些是我要发送的消息:
在多播中:
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
在单播中作为对 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
设备配置文件.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>
为了使设备显示在 Windows 资源管理器网络文件夹中,还需要什么其他东西?
提前致谢
费尔南多