Page 18 of 21

SOAP for set volume level

Posted: Thu Oct 20, 2011 5:20 pm
by moras86
If you would like to get or set volume level you can use SOAP future integrated with Samsung TV (B-series and up). You need to send xml schema.
Example for set volume (33) at IP (192.168.0.10):

Code: Select all

POST /upnp/control/RenderingControl1 HTTP/1.1
SOAPACTION: urn:schemas-upnp-org:service:RenderingControl:1#SetVolume
CONNECTION: close
CONTENT-LENGTH: 368
CONTENT-TYPE: text/xml
HOST: http://192.168.1.10:52235
USER-AGENT: Http/1.1

<?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>
      <DesiredVolume>33</DesiredVolume>
      <Channel>Master</Channel>
    </ns0:SetVolume>
  </s:Body>
</s:Envelope>
Similar way you can read and set: volume mute, brightness, contrast, sharpness, color temperature.

I use this in my Remote LAN Control app. Maybe it's possible to make script for work with PRV+ (or myButtons).

Re: [How-To] Remote Control Signal Over Lan?

Posted: Sat Oct 22, 2011 10:32 am
by rinaldinicri
Is there a way to send remote command from a shell script running on the tv?
Thanks

Re: [How-To] Remote Control Signal Over Lan?

Posted: Mon Oct 24, 2011 11:43 am
by juusso
create script setvol.sh, chmod it to 755.
copy netcat (nc) to /mtd_rwarea/netcat/nc
Execute this script with required volume value at the end:

Code: Select all

/mtd_rwarea/setvol.sh 10& 

Code: Select all

#!/bin/sh

nc=/mtd_rwarea/netcat/nc
allow_loud=0

vol=$1


if [ ! -f $nc ] ; then
	echo "\"$nc\" not found!"
	exit
fi

if [ -z $vol ] ; then
	echo "Add desired volume as parameter!"
	exit
fi

if [ $vol -lt 0 ] ; then
	echo "Volume out of range! [0-99]"
	exit
fi

if [ $vol -gt 99 ] ; then
	echo "Volume out of range! [0-99]"
	exit
fi

if [ $vol -gt 15 ] ; then
	if [ $allow_loud != 1 ] ; then
		echo "Not allowed to set volume higher then 15 per default! Set \"allow_loud\" to 1 in this script."
		exit
	fi
fi

content_len=366
if [ $vol -ge 10 ] ; then
	content_len=367
fi


echo -n 'POST /upnp/control/RenderingControl1 HTTP/1.0
User-Agent: Twisted PageGetter
Host: 127.0.0.1
Content-Length: '$content_len'
SOAPACTION: "urn:schemas-upnp-org:service:RenderingControl:1#SetVolume"
content-type: text/xml ;charset="utf-8"
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><DesiredVolume>'$vol'</DesiredVolume></ns0:SetVolume></s:Body></s:Envelope>' | $nc localhost 52235 | grep HTTP/1.
Don`t remember who is the script author, but the method to send soap message in that way works.

p.s. Original posted by flo-ogb.

Re: [How-To] Remote Control Signal Over Lan?

Posted: Mon Oct 24, 2011 3:42 pm
by rinaldinicri
Hi fdelahuz thanks for your reply.
I need to do it directly on a script running on the tv.
As far as I know telnet client is not available on the tv.

Onother question:
Is there a way to get current information (channel, volume, ...) of the running status of tv?
is it possible to get thsi info from a shell?

Thanks a lot