我正在开发一个应该在Windows中自动发现的硬件设备,所以我更喜欢通过SSDP而不是mDNS (Zeroconf等)来实现。以避免强迫用户安装其支持应用程序。我只需要将设备显示在中的网络中,然后单击它以使用URL中的设备IP地址打开默认浏览器。我已经编写了代码(应答多播M-搜索请求,并在启动时定期发送通知消息),我可以在Windows PC上看到Wireshark中的消息,但该设备仍然没有出现在资源管理器网络文件夹中,我还可以看到其他设备,如打印机、电视、媒体播放器等,我还可以在Wireshark上看到它们的消息。我在通知和响应消息的内容中搜索一些建议,也在xml文件中搜索这样一个简单设备的设备配置文件--我只是想宣传一下,该设备在其IP地址上有一个its服务器。
以下是我要传达的信息:
在组播中:
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-搜索的答复:
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.xmldeviceprofile.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资源管理器网络文件夹中,还需要其他什么吗?
提前感谢
费尔南多
发布于 2015-07-29 13:27:17
您的deviceprofile.xml格式不符合UPnP规范。在<service>标记下需要其他元素。另外,urn:schemas-upnp-org:service:Basic:1是非法的,您需要在您自己的命名空间中更改为UPnP预定义或自定义。一个例子可以是:
<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>您可以查看:Part2.3 of http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf
https://stackoverflow.com/questions/30668322
复制相似问题