UPnP AV Framework Overview (Windows CE 5.0)
The UPnP AV Framework assists developers building UPnP AV devices and control points. It does this by providing a set of C++ classes that define UPnP AV-specific methods and functionality.
Note The UPnP AV Framework, produced by Microsoft, provides functionality that makes assists developers building UPnP AV devices and control points. The UPnP AV DCP is a general specification produced by many companies, working as the UPnP Forum. At the time of writing, the specification was at version 1.01, and this is the version supported by the UPnP AV Framework. For an introduction to the general UPnP AV DCP, see UPnP AV DCP Overview and UPnP AV DCP Documentation.
Windows CE and Windows Mobile also provides UPnP device and control point functionality, documented in Using the UPnP Device Host API and Using the UPnP Control Point API, respectively. However, the Device Host and Control Point APIs are generic and apply to all possible devices and control points. They provide basic UPnP functionality and rely on custom COM objects provided by developers to provide actual device functionality.
Implementing UPnP AV Devices
To implement a UPnP AV MediaRenderer using solely the generic UPnP functionality, a developer creates a set of COM objects that expose the state variables and actions of the MediaRenderer services (AVTransport, ConnectionManager, and RenderingControl) and then registers these COM objects with the provided UPnP Device Host functionality.
In contrast, with the UPnP AV Framework, a developer derives from provided classes for the MediaRenderer services, specifically IAVTransportImpl, IConnectionManagerImpl, and IRenderingControlImpl. In derived classes, the developer provides device-specific functionality in specific methods, like IConnectionManager::PrepareForConnection.
The UPnP AV Framework uses the generic Device Host API to expose the functionality you provide in the custom C++ classes, but this use is transparent to most developers. The UPnP AV Framework provides COM objects that integrate with the Device Host API and then call the functionality implemented in the derived C++ classes. Developers do not need to modify the provided COM objects.
For more information about using the UPnP AV Framework to implement a UPnP AV device, see Developing UPnP AV Framework Devices. For more information about the classes provided with the UPnP AV Framework, see UPnP AV Framework Class Organization.
Implementing UPnP AV Control Points
A developer can create UPnP AV control points using solely the UPnP Control Point API, or they can use the UPnP AV Framework to more efficiently develop UPnP AV control points.
Control points that use the UPnP AV Framework use the standard UPnP Control Point API to find UPnP devices on the network. This results in one or more generic IUPnPDevice pointers, which the control point code uses to create UPnP AV Framework MediaRendererDevice and MediaServerDevice instances.
Control points use the MediaRendererDevice and MediaServerDevice classes to retrieve implementations of the same UPnP AV-specific interfaces implemented by UPnP AV devices. For example, a control point can interact with a MediaServer ContentDirectory service using ContentDirectory-specific methods provided by the IContentDirectory interface, which it obtains using MediaServerDevice::GetContentDirectory.
For more information about using the UPnP AV Framework to implement a UPnP AV control point, see Developing UPnP AV Framework Control Points.
Linking UPnP AV Devices and Control Points
Devices and control points that use the UPnP AV Framework use the same methods on the same interfaces, but they use them differently. UPnP AV devices implement the methods while UPnP AV control points call them.
For example, a MediaServer device implements IContentDirectory::Search by searching its internal content database and returning matching items. A control point calls IContentDirectory::Search and uses the returned data.
This linkage can, at least superficially, hide the fact that devices and control points are usually on different computers on the network.
The UPnP AV Framework implements this linkage by providing proxy classes that control points and devices actually call. For example, when a control point calls a method like IContentDirectory::Search, it's actually executing code in a control point proxy class. The proxy class communicates with the specified MediaServer device using standard UPnP network calls.
Similarly, on the device, UPnP AV Framework proxy code calls a device implementation of the IContentDirectory::Search method which then returns the results to the control point over the network.
Note Although this implementation can make it appear that device and control point are on the same computer, it is important that code that uses the UPnP AV Framework always consider the possibility of network and other communication errors by not assuming that all calls will succeed.
Send Feedback on this topic to the authors