3

Using the Java library Cling, I can discover my TV on the LAN using upnp. The TV advertises the following upnp services

  • RenderingControl
  • AVTransport
  • ConnectionManager

It also says, it is of type "MediaRenderer" and the model description is "Samsung TV DMR".

As far as I understand, all these capabilities could also be provided by a computer for example. But in the "real" world, a TV and a computer are two different things (although they may offer the same services).

Through which upnp method can I uniquely identify that I am talking to a "TV"?

Philipp
  • 4,659
  • 9
  • 48
  • 69
  • You'll probably have to do this by parsing device xml for certain manufacturers/models. I'm curious why you need to do this however - if a TV and computer offer the same services, they're essentially the same as far as UPnP control points are concerned. Why would you need to differentiate between them? – simonc Apr 28 '12 at 18:32
  • I want to use the info whether the TV is on, to automate things in my home (like switching lights) but this should not react if only a pc is turned on (different usage situation). If possible I'd like to make it a portable solution not just applicable to my specific TV. – Philipp Apr 29 '12 at 10:26

2 Answers2

2

It's better to look deeper into service description file (SCPD).

In StateVariables of RenderingControl, TV usually has Contrast and Brightness, but PC DLNA devices usually don't.

Using GetProtocolInfo of ConnectionManager service, we can get a list of capable media formats, which could be used to distinguash a TV from other audio devices.

See http://upnp.org/specs/av/av4/

yjzhang
  • 4,859
  • 3
  • 19
  • 21
  • Good point. When I get to return to this project, I'll check whether that's a good solution for the TVs I have at hand. – Philipp Aug 26 '13 at 07:30
1

The only solution i could come up with for "portability" is to make a whitelist of devices per their unique id (UUID). If you intend to implement a controller which listens to appearance of some specific device, then obtain the UUID of the device and configure the controller with it. If your controller's gonna have UI, present all devices found and ask the user "is this a TV?". I dare to say there is no deterministic way in UPnP to say that a specific UPnP device "is a TV". UPnP simply does not specify such device classes. Your services observation is absolutely correct and you could get the same response not only from a computer but also a DVD player or a smart alarm clock.

Pavel Zdenek
  • 7,146
  • 1
  • 23
  • 38