Java – How does UPnP work?

How does UPnP work?… here is a solution to the problem.

How does UPnP work?

I’m working on an application that renders web pages in a UPNP-enabled TV. I’ve implemented UPnP with Cling UPnP
Now I’m not sure how to proceed further. How is the connection between the TV and the device achieved? Is it a socket connection? Does anyone have any examples or tutorials on this topic to help me implement UPnP streaming.

I searched on Google, but it mostly points to existing apps available in Google Play.
Thanks

Solution

Okay, so the service descriptor xml (SCPD) contains the <action>s of the <actionList> and its arguments, which can be in (to TV) or out (Will use react for Action on TV). You need to “invoke” the operation, which means that Cling serializes it to SOAP RPC and sends it to the device as an HTTP request. In the response, you will get the overall result of the same call as normal HTTP, with 200 for normal, 500 for bad request, etc. Each code has a specific interpretation in the context of a particular operation call. The response will also retain the parameters specified in the out SCPD.

But when you use an abstract library like Cling, you’re not that interested in all this. It will do everything for you. Disclaimer: I’m not familiar with Cling, just know enough other UPnP libraries to know where to look for things.

As a TV, the 3 services you are talking about are undoubtedly AVTransport, ConnectionManager, and RenderingControl The method you need is org.teleal.cling.support.renderingcontrol.callback.SetVolume.

I’m not saying you don’t need to understand the underlying workings of UPnP. Capturing UPnP specs bundle and at least reading the DeviceArchitecture pdf is essential. And you will definitely need specifications to know more complex services such as AVTransport . Tip: Don’t care about InstanceID and ConnectionID. Unless you’re connected to a very advanced renderer (TVs nowadays are not), it’s all 0s.

Related Problems and Solutions