Samsung TV’s (series D and probably series C) are equipped with some feature called Rendering Control Service. It is simply network protocol useful to control some parameters related to audio and video options (e.g. volume level, brightness etc).
Protocol is based on HTTP and XML technology. Requests are sent by TCP port 52235 and looks like:
POST /upnp/control/RenderingControl1 HTTP/1.1 Content-Type: text/xml; charset="utf-8 SOAPACTION: "SoapAction:urn:schemas-upnp-org:service:RenderingControl:1#GetVolume" Cache-Control: no-cache Host: 192.168.1.102:52235 Content-Length: 354 Connection: Close <?xml version="1.0" encoding="utf-8"?> <s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <ns0:GetVolume xmlns:ns0="urn:schemas-upnp-org:service:RenderingControl:1"> <InstanceID>0</InstanceID> <Channel>Master</Channel> </ns0:GetVolume> </s:Body> </s:Envelope>
SOAPACTION contains action name (GetVolume), rest of this string is constant. Host IP is, of course, our device address. Content-Length define payload data length (XML data). Rest of the headers above is rather self-explanatory.
Header lines are separated by two bytes CR+LF (carriage return 0x0D followed by new line symbol 0x0A). Between headers and payload there is one extra empty line – CR+LF+CR+LF.
XML data is almost entirely predefined constant. Only <ns0:Getvolume …>…</ns0:GetVolume> are customizable. GetVolume is action name and the subtags (InstanceID, Channel) are parameters with determined values. List of all valid actions, values and parameters are covered in http://upnp.org/specs/av/UPnP-av-RenderingControl-v1-Service.pdf. My TV does not support every actions defined in here.
TV response will be similar to request:
HTTP/1.1 200 OK CONTENT-LENGTH: 289 CONTENT-TYPE: text/xml; charset="utf-8" DATE: Thu, 01 Jan 1970 03:25:13 GMT EXT: SERVER: Linux/9.0 UPnP/1.0 PROTOTYPE/1.0 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetVolumeResponse xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><CurrentVolume>6</CurrentVolume></u:GetVolumeResponse></s:Body></s:Envelope>
I’m sure it require no comment.
We can of course set up parameters too. E.g. it is possible to set volume:
POST /upnp/control/RenderingControl1 HTTP/1.1 Content-Type: text/xml; charset="utf-8 SOAPACTION: "SoapAction:urn:schemas-upnp-org:service:RenderingControl:1#SetVolume" Cache-Control: no-cache Host: 192.168.1.102:52235 Content-Length: 389 Connection: Close <?xml version="1.0" encoding="utf-8"?> <s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <ns0:SetVolume xmlns:ns0="urn:schemas-upnp-org:service:RenderingControl:1"> <InstanceID>0</InstanceID> <Channel>Master</Channel> <InstanceID>0</InstanceID> <DesiredVolume>69</DesiredVolume> </ns0:SetVolume> </s:Body> </s:Envelope>
I plan to release simply C++ classes to control Samsung TV with this protocol, and previously described Samsung Network Remote Control.