Universal Plug-n-Play: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(New Page on Universal Plug-n-Play)
 
(Added device definition XML document information.)
Line 15: Line 15:
NTS: ssdp:alive
NTS: ssdp:alive


== Device Information ==
Further information about the device can be retrieved by sending an HTTP GET request to the URL specified in the LOCATION header.
Further information about the device can be retrieved by sending an HTTP GET request to the URL specified in the LOCATION header. The HTTP content that is returned will contain information about the device, and any services provided by the device. Each service has a unique Service Type that can be used to determine the exact functionality supported by the service, as well as a more generic Service ID that can be used as a fallback service classification for compatibility.

Each service listed in this document will have a link (SCPDURL) to a service definition XML file that provides even more metadata about that specific service, as well as a "control" URL that is used to send SOAP messages to control the service, and an "event subscription" URL that is used to subscribe to event notifications.

An example device definition document is shown below:

<source lang="xml">
<root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:pnpx="http://schemas.microsoft.com/windows/pnpx/2005/11" xmlns:df="http://schemas.microsoft.com/windows/2008/09/devicefoundation">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
<UDN>uuid:55076f6e-6b79-4d65-6401-00d0b811d10b</UDN>
<friendlyName>MediaServer</friendlyName>
<manufacturer>Manufacturer, Inc.</manufacturer>
<manufacturerURL>http://www.manufacturer.com</manufacturerURL>
<modelName>MediaServer 1.0</modelName>
<modelURL>http://www.manufacturer.com/MediaServer</modelURL>
<modelDescription>Media Server</modelDescription>
<modelNumber>Media Server Home</modelNumber>
<serialNumber>123345-50023</serialNumber>
<UPC>1009234789893</UPC>
<presentationURL>http://100.100.100.100/</presentationURL>
<iconList>
<icon>
<mimetype>image/jpeg</mimetype>
<height>48</height>
<width>48</width>
<depth>24</depth>
<url>/images/icon-48x48.jpg</url>
</icon>
<icon>
<mimetype>image/jpeg</mimetype>
<height>120</height>
<width>120</width>
<depth>24</depth>
<url>/images/icon-120x120.jpg</url>
</icon>
</iconList>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
<SCPDURL>/ConnectionManager.xml</SCPDURL>
<eventSubURL>/ConnectionManager/Event</eventSubURL>
<controlURL>/ConnectionManager/Control</controlURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
<SCPDURL>/ContentDirectory.xml</SCPDURL>
<eventSubURL>/ContentDirectory/Event</eventSubURL>
<controlURL>/ContentDirectory/Control</controlURL>
</service>
</serviceList>
</device>
</root>
</source>


== External Links ==
== External Links ==

Revision as of 02:36, 10 March 2019

Universal Plug-n-Play (UPnP) is a standard set of network protocols defined to allow network devices to discover and retrieve metadata from other devices on the same network. It uses various network protocols, such as UDP, HTTP and SOAP messages to allow reliable cross-platform communication.

Device Discovery

UPnP devices can be discovered by listening for multicast UDP messages on port 1900.

These messages will contain HTTP-like requests and headers containing URLs that allow clients to further query the device for more information using HTTP GET requests, which return XML documents defining any services, actions or events supported by the device.

An example of a NOTIFY message sent by a device every few minutes may look like:

NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
LOCATION: http://100.100.100.100/Device.xml
NT: upnp:rootdevice
NTS: ssdp:alive  

Device Information

Further information about the device can be retrieved by sending an HTTP GET request to the URL specified in the LOCATION header. The HTTP content that is returned will contain information about the device, and any services provided by the device. Each service has a unique Service Type that can be used to determine the exact functionality supported by the service, as well as a more generic Service ID that can be used as a fallback service classification for compatibility.

Each service listed in this document will have a link (SCPDURL) to a service definition XML file that provides even more metadata about that specific service, as well as a "control" URL that is used to send SOAP messages to control the service, and an "event subscription" URL that is used to subscribe to event notifications.

An example device definition document is shown below:

<root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:pnpx="http://schemas.microsoft.com/windows/pnpx/2005/11" xmlns:df="http://schemas.microsoft.com/windows/2008/09/devicefoundation">
	<specVersion>
		<major>1</major>
		<minor>0</minor>
	</specVersion>
	<device>
		<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
		<UDN>uuid:55076f6e-6b79-4d65-6401-00d0b811d10b</UDN>
		<friendlyName>MediaServer</friendlyName>
		<manufacturer>Manufacturer, Inc.</manufacturer>
		<manufacturerURL>http://www.manufacturer.com</manufacturerURL>
		<modelName>MediaServer 1.0</modelName>
		<modelURL>http://www.manufacturer.com/MediaServer</modelURL>
		<modelDescription>Media Server</modelDescription>
		<modelNumber>Media Server Home</modelNumber>
		<serialNumber>123345-50023</serialNumber>
		<UPC>1009234789893</UPC>
		<presentationURL>http://100.100.100.100/</presentationURL>
		<iconList>
			<icon>
				<mimetype>image/jpeg</mimetype>
				<height>48</height>
				<width>48</width>
				<depth>24</depth>
				<url>/images/icon-48x48.jpg</url>
			</icon>
			<icon>
				<mimetype>image/jpeg</mimetype>
				<height>120</height>
				<width>120</width>
				<depth>24</depth>
				<url>/images/icon-120x120.jpg</url>
			</icon>
		</iconList>
		<serviceList>
			<service>
				<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
				<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
				<SCPDURL>/ConnectionManager.xml</SCPDURL>
				<eventSubURL>/ConnectionManager/Event</eventSubURL>
				<controlURL>/ConnectionManager/Control</controlURL>
			</service>
			<service>
				<serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
				<serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
				<SCPDURL>/ContentDirectory.xml</SCPDURL>
				<eventSubURL>/ContentDirectory/Event</eventSubURL>
				<controlURL>/ContentDirectory/Control</controlURL>
			</service>
		</serviceList>
	</device>
</root>

External Links

UPnP Specifications and Architecture Documentation