Speaking of dlna, the UPnP protocol must be mentioned. This can be seen from the layer of dlna.
UPnP is the abbreviation of Universal Plug and Play, that is, universal plug-and-play. This Protocol is dominated by Intel and Microsoft, mainly for the home network and enterprise network.
UPnP organization Forum address: http://www.upnp.org
.
The UPnP architecture is based on the IP technology to enable automatic connections and collaboration between the home network and enterprise network devices.
The basic UPnP protocol is the UPnP Device architecture, and the latest version is 1.1. This UDA architecture shows how devices in the LAN discover each other, understand each other, and communicate with each other.
Technologies used by UPnP include IP, TCP, UDP, HTTP, and XML.
Process of adding an UPnP Device to the network
To add an UPnP Device to the network, you must first obtain the IP address (even if the DHCP service is unavailable ).
The following steps are calledDiscover or search
. If a control point is added to the network, a broadcast protocol is sent, and all the UPnP devices in the LAN respond. If a device is added to the network, the device information and service information of the device will be sent regularly so that the control points of interest can be found. This discovery process is based on the SSDP protocol.
Note that the device here refers to a device that has stored content, such as a media server or a device that plays a media, such as a player or gateway device. The Control Point (CP) is a client that does not have the ability to store content, play media, gateway, or other devices, and can only browse the content of devices.
The control point and the device find the other party. The next step isDescription
The control point is used to understand the functions of the device. In this phase, the device will tell the control point about the device, the services that the device can provide, the commands that the service contains, and the parameters required for the commands.
After the control point understands the capabilities of the device, the next step isControl
. According to the service and command list provided by the device, the control point can send commands to control the device's response. For example, when browsing the device content, the control point can send the Browse command to get the device content and present it to the user. The control commands sent by control points are described in XML using the SOAP protocol.
The next step of control isEvent
. An UPnP describes a set of command lists and variables that describe the running state information. Service in
These variables are updated when they are changed. You can subscribe to the control points to obtain relevant changes.
The Service publishes updates by sending event messages. Event messages include one or more State Information variables and their current values. These messages also use XML
Format, which is formatted using the Gena protocol. A special initialization message is sent when the control point subscribes for the first time. It includes the variable name and value related to the service. To support coexistence of multiple control points,
Events are designed to concurrently notify all control points. Therefore, all subscribers receive all Event Notifications equally.
The last step isPerformance
. If a device has a presentation URL, you can use the control point to obtain the display information of the device. That is, you can load the URL in the browser and allow users to perform related control or view operations. The specific operations supported are performed by the presentation page and the device.
The concept of control point and device is mentioned above. Control PointControl Point
(CP for short)Device
. A control point cannot be called a device. It can only browse the content of a device.
We use graphs to describe the interaction process between the UPnP protocol stack and the UPnP Device:
UPnP protocol stack
UPnP Device interaction process
What are the application scenarios of UPnP?
Typical application scenarios
As PC becomes the center of the network and provides increasingly rich media and connection services, more and more applications will be developed after devices are connected to PCs. The following example is only a small part of it:
Smart Home Network
Many smart home environments use existing home control networks, such as home networks, to control and monitor the entire home environment, such as lighting, security, and other home devices. These networks can be connected to PCs,
Outside the PC, it cannot be accessed by other devices. Using UPnP devices can bridge these networks into a single network and provide more devices for users to access the devices in the home network. In implementation, you do not need
You only need to change the device into an UPnP Device and be able to communicate with the control point and receive control commands of the control point.
Digital audio/video file management
Digital audio and video files that can be played on PCs and other devices are growing exponentially in recent years. In a home, there may be several computers or other devices used to save these files. Use UPnP
These files are centrally managed across different PCs. These devices can be discovered and controlled by other control points (such as PCs and UPnP receivers). The player can obtain these audio and video files through the home network.
Files and play them back. Users can enjoy these audio and video files on TV.
Digital Image Library
Many families use digital cameras to take photos, scan and save existing photos, and then upload these photos to their computers for storage. Classify it in a computer or display it as a slide. With
As the number of photos increases, the photos may be stored on multiple devices or media, such as CDs, hard disks, and flash cards. Using UPnP technology, the image library can exist as a device and automatically
. This makes it possible for a photo repository to be temporarily used by multiple applications, such as displaying slides in electronic frames, set-top boxes, and TVs.
What types of UPnP devices are included?
1. Basic device. This is actually an abstract device that does not provide any services.
2. UPnP AV device. The device type provided for the dlna framework, including media server and media render.
3. UPnP printer device. Provides the Print Service.
4. gateway device (IGD ). This application is very extensive. Many routers include the services of this device.
5. UPnP devices. Provides scanning services.
6. digital cameras. Provides services similar to cameras.
7. Light control. This is a standard example service for UPnP Device protocols.
The following figure shows the above UPnP Device types.
We mainly look at UPnP AV devices and what services they provide and their supporting internal devices.
Based on the UPnP Device architecture, the UPnP organization adds the UPnP AV architecture, which specifies the interaction between the audio and video devices and control points and the services provided by the audio and video devices.
This architecture includes two AV devices and a control point. One AV device is Media Server, which stores various audio and video, images, and other multimedia materials. The other is media render, which can obtain multimedia data from the Media Server and play it locally.
The following figure describes the interaction process of these three components (Media Server, media render, control point.
From this figure, we can also see the media
The services provided by the server include at least content directoy and Connection
Manager and avtransport (CDs for short,
CMS and AVT. CDs and CMS are mandatory services, while AVT is optional.
Media render provides at least Rendering Control and connection management.
Manager and avtransport,
CMS and AVT. Here, the RCs and CMS are mandatory services, while the AVT is optional.
In this architecture, the interaction model of the three components is also provided in actual applications. If you are interested, you can read the model further.