Any examples/tutorials on using Intel UPNP's VirtualDirectory Handler?

I've been working with the UPNP library from Intel in a VB.NET project and though the lack of documentation has made it hard (literally guessing what property/method I have to use in every line of code) I've been able to bend it to my will, and I've got a pretty much functional application that uses UPNP on Windows.

My problem is, I now want to be able to transfer files from the device host to the control point. Scourging Google for answers shows that Intel's UPNP uses an embedded Web server to process everything related to UPNP, and I can add custom directories to my device with the AddVirtualDirectory method. But then, the luck ends. No documentation, no examples, nothing.

So my question is: does anyone know how to use it? All I discovered is that the method requires 2 delegate functions, declared as VirtualDirectoryHandler, but I don't know what am I supposed to do with these.

Thanks for your help.

L├ęster

Answers


So to make requirement clear: control point needs to pull (download) images from a device. Device doesn't need to access (push) to the control point. No other device will try to access the images already stored on the control point. Hence only the device needs to implement ContentDirectory, the control point doesn't.

I recommend you read UPnP-av-ContentDirectory document (any version) from MediaServer folder of the UPnP specs bundle. Look up CreateObject, DeleteObject, ImportResource, ExportResource. You actually won't need them if my assumption above is correct, but for understanding what is meant by file transfer in UPnP. I admit not knowing anything about Intel UPnP specifically, so follows a guesswork from general UPnP knowledge and random fulltext search.

To enable object downloading, the device needs to present a browseable media storage. Basically, you need to implement GET request handler on the device. UPnP is nothing more than an ad-hoc net of webservers, spiced with some multicasting and extra headers. That's why "Intel's UPNP uses an embedded Web server". Any UPnP device is a webserver. Intel UPnP already contains implementations of VirtualDirectoryHandler in MediaServerDevice.WebServer_OnHeaderReceiveSink and WebServer_OnPacketReceiveSink. Chances are, that you could use this MediaServerDevice.cs out of the box to have ContentDirectory implemented. Have a look at usages of VirtualDirectoryHandler throughout the SDK to get an idea how to use it.

The control point downloader will need to execute the AVTransport.Browse command to find resource URL(s) of image(s) to be downloaded. Intel's MediaBrowser.cs looks promising. I recommend you read also the beginning of the document pointed above, to get an insight into the navigational structure of UPnP ContentDirectory. When in doubt, run DeviceSpy from Intel's Tools suite and query your device manually. Start with ObjectID "0". Nothing will help you more to understand the ContentDirectory than seeing the raw XML DIDL response.

Once your control point knows the resource URL, you simply download it via HTTP GET. There is no need for fancy ImportObject as the control point is also the target storage. This last part is technically not about UPnP at all.


Need Your Help

Segfault accessing or setting struct member

c struct segmentation-fault

It's been a while since I worked with pointers or C in general. I'm working on a project (malloc implementation related) for school but can't make progress past the initial phase because I'm having

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.