Command Line Capability

665 views
Skip to first unread message

SonyAPILib

unread,
Jun 8, 2015, 8:28:41 PM6/8/15
to sony-api...@googlegroups.com
I am currently wondering what it would take so me to make this API run in the background as a +COM service. This would allow all kinds of future capabilities, however I think there is much involved.

So right now, I am looking at creating a "Command Line" exe that can be used in other apps very easily.
It would require quite a few switches and parameters, but it is doable!

maybe something like: SonyApi.exe /f c:\mydevice.xml  /s IRCC /a1 getCommandValue /p1 VolumeUp /a2 XSendIRCC /p p1 

This would load the device file located at C:\mydevice.xml,
Use the service IRCC,
1st get the command value for "VolumeUp"
then Send that value using the SendIRCC action.

Possible? Usable?

Let me know.

nikiforo...@gmail.com

unread,
Jun 9, 2015, 9:46:15 AM6/9/15
to sony-api...@googlegroups.com
Maybe it will be easier at the first stage, to send direct IRCC commands, something like SonyApi.exe /AAAAAgAAAJcAAAAcAw ==
The base of codes will be used by external app.

SonyAPILib

unread,
Jun 9, 2015, 10:58:52 AM6/9/15
to sony-api...@googlegroups.com, nikiforo...@gmail.com, nikiforo...@gmail.com
That would work, but with all the other services, I think we would need to specify which service and action you are wanting to execute, along with the needed parameters.
Also you would still need to have a saved device file, that could be loaded at time of execution.
This will make the command line .exe able to do more than just send IRCC codes.
 
I ccan get rid of the GetCommandValue, as you stated, then users would need to get that value from their application side before executing the exe.. 

May start playing around to see what I can accomplish.

BTY, I added WoL to v5.2 today!

SonyAPILib

unread,
Jun 9, 2015, 3:50:57 PM6/9/15
to sony-api...@googlegroups.com, k.her...@gmail.com
OK,

I created a quick command line application today.
Currently it only handles the IRCC commands, but it does work!
I will add in the other functions as I have time to work on it!

As mentioned, you will need to obtain the command string value before using the command line.
For example, the following command line will execute a VolumeUp on my STR-DN840 home theater amplifier:

DLNALib.exe /f "C:\STR-DN840.xml"/s"IRCC"/a "XSendIRCC"/p1"AAAAAgAAADAAAAASAQ=="


SonyAPILib

unread,
Jun 10, 2015, 1:20:28 PM6/10/15
to sony-api...@googlegroups.com, k.her...@gmail.com
Command Line application is on GitHub.


I did not include the open source for this, but is is a way to start testing the new API.

This can be used to locate, Save and execute device Actions from a command line!

This uses the latest version of the SonyAPILib v5.2.

Please let me know if you have any questions.

More to come soon!!!


On Monday, June 8, 2015 at 8:28:41 PM UTC-4, SonyAPILib wrote:

nikiforo...@gmail.com

unread,
Jun 10, 2015, 6:24:55 PM6/10/15
to sony-api...@googlegroups.com
Hi!
Unfortunately it doesn't work for me:


C:\Windows\system32>D:\dlnalib\DLNALib.exe /f "d:\dlnalib\BRAVIA KDL-42W828B.xml" /s "IRCC" /a "XSendIRCC" /p1 "AAAAAQAAAAEAAAATAw=="

Unhandled exception: System.ArgumentNullException: value cannot be null
Parameter name: s
   в System.IO.StringReader..ctor(String s)
   в Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, Json
SerializerSettings settings)
   в Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializ
erSettings settings)
   в Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
   в SonyAPILib.SonyAPI_Lib.IRCC1.XSendIRCC(SonyDevice parent, String irccCode)
   в DLNALib.Program.Main(String[] args)


C:\Windows\system32>D:\dlnalib\DLNALib.exe /f "d:\dlnalib\BRAVIA KDL-42W828B.xml" /WOL
ERROR: Missing parameters....


Saving devices to the file, gave error, until i disconnect other DLNA devices, such as mediaplayers. Select Sony by the index did not work, because discovery gave every time different index for each found device.

C:\Windows\system32>D:\dlnalib\DLNALib.exe /d /ds 0 /dp "d:\dlnalib"
Locating Devices. Please wait.........
Devices Found: 17
Saving Device: RT-N66U.xml to d:\dlnalib\RT-N66U.xml
Saving Device: RT-N66U.xml to d:\dlnalib\RT-N66U.xml
Saving Device: PCH-A100: UPnP AV Server.xml to d:\dlnalib\PCH-A100: UPnP AV Serv
er.xml
ERROR: Incorrect parameters....

SonyAPILib

unread,
Jun 12, 2015, 6:47:27 AM6/12/15
to sony-api...@googlegroups.com, nikiforo...@gmail.com, nikiforo...@gmail.com
Thanks for your reply.
WOW, you go a lot of UPnP/DLNA devices!

I also got the copy of your files, thank you.

It appears that it is building the device properly, as your file looks good!
The only thing I noticed, was the Registered property is False.
You said you registered using the 5.1 version.

Try using the command line again, to create another device file, and see if the Registered property gets set to True!
Also, not sure how quick you downloaded from GitHub, but I did upload an update yesterday to fix some bugs I had discovered.

Your 1st error seems to be in the Newtonsoft.json library, which usually means some Information is missing.
The only Json function in the IRCC service is the cookie!

I will look in to the WOL, because that does not require registration or a service, so it should work!

Your last error is what I believe I fixed during my upload yesterday. If not, then I'll have to look at that too.

Kirk Herron

unread,
Jun 12, 2015, 8:05:43 AM6/12/15
to sony-api...@googlegroups.com, Sergey Nikiforov
I just uploaded an update to github that should fix the WOL command.

--
You received this message because you are subscribed to the Google Groups "Sony API Library" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sony-api-libra...@googlegroups.com.
To post to this group, send email to sony-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sony-api-library/ffb5ee4b-28e0-4c41-ad4f-c3bb4be9ff7b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

SonyAPILib

unread,
Jun 15, 2015, 10:24:30 AM6/15/15
to sony-api...@googlegroups.com, k.her...@gmail.com
UPDATE: New Command Line application has been tested with Gen3 and is available on GitHub.
This is now using the latest version of the SonyAPILib.dll v5.2.

Now you can Locate, Register and send commands using a command line application.

At a command prompt, type dlnalib /h to see the help file.

To locate your devices, simply type: dlnalib /l  This will display a list of devices found on your network. The display will show each device's Document URL.

With this information, you can build a device file. Type: dlnalib /b "http://192.168.0.100:52323/dmr.xml" c:\MyDevices

This will build a Device Description XML file used by the new 5.2 API. This file name will be the same name as the Device's friendly name. Once saved, you can change the name of the file without any issues. I make mine shorter so they are easier to enter! For example: I changed: BRAVIA KDL-55828B.xml to Bravia55.xml. (If the file name has spaces, you must surround with quotes)

Next you can register the device using the newly created device description file.
Type: dlnalib /r "c:\MyDevices\BRAVIA KDL-55828B.XML" or with a shorter name: dlnalib /r c:\MyDevices\Bravia55.XML

If this is a Gen3 device, it will save your cookie file to the c:\ProgramData\Sony folder. This will also allow you to use the same cookie with other applications without having to copy or move the cookie to another folder.
Also the cookie file name will include the name of the device to keep it from getting overwritten from another Gen3 device.

Now you can send commands to the device! This command requires a few parameters, and they must be in this order.
Also you must obtain or have the command value prior to using this.

To send a VolumeUp command, first we have to know the command value: AAAAAQAAAAEAAAASAw== (This can easily be found in the devices XML file)
Now we use our device file and run the command line like this: dlnalib /a c:\MyDevices\Bravia55 IRCC XSendIRCC AAAAAQAAAAEAAAASAw==

I will be adding a Wiki on Github for this to explain in more detail.
Also as I increase the functionality of the API, I will also bring these commands over to the Command Line app.

Thank you every one for your help, and especially @sergey for his testing help!


On Monday, June 8, 2015 at 8:28:41 PM UTC-4, SonyAPILib wrote:

witt...@gmail.com

unread,
Dec 18, 2015, 12:36:36 AM12/18/15
to Sony API Library, k.her...@gmail.com
Hello,

I stumbled on this thread and I downloaded the files however it appears to fail to find any devices on my network although there are two kdl75w850c TV's
The TV's are on a static IP and on the same subnet so not sure why they are not being picked up...

Kev

SonyAPILib

unread,
Dec 19, 2015, 8:56:26 AM12/19/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
First let me say, Thank you for your interest in my code!

Please double check your model number: KDL75W850c???
This does not show up in the Compatible device list here: http://info.tvsideview.sony.net/en_ww/home_device.html#bra01
Also, can you tell me the year your Bravia was made?

If your model is a KDLW75850c, then you may need to download and upgrade your firmware.

witt...@gmail.com

unread,
Dec 23, 2015, 12:11:56 AM12/23/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
 
Definitely interested in the code and hoping I can get it to work.
 
I'm trying to send remote commands to 2 Sony TV's that I am helping setup in a not for profit organisation.
 
The model number is definitely KDL75W850C (http://www.sony.com.au/product/kdl-75w850c)
 
It's part of the KDL-W85xC series
 
I recently updated the firmware (about a week ago when I first setup the TV's)
 
The sideview app on my android phone will allow me to remote control each tv individually across the network - but I am hoping to setup the laptop onsite with some batch file shortcuts that will do some common actions on both TV's by running curl / rest calls in the background to each device.
 
For example wake up
Select HDMI1 input
Sleep/Standby
 
So far I have been able to send these commands using a browser Rest plug in but my attempts to run them using Curl haven't worked - I get a 403 authentication error
 
Hope that helps a bit :-)

SonyAPILib

unread,
Dec 23, 2015, 10:36:44 AM12/23/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
I know it's he holidays, but can you tell me what you have tried so far?

Do you know the URL to the TV's Description File? it is usually something like:
http://xxx.xxx.xxx.xxx:52323/dmr.xml

or
 http://xxx.xxx.xxx.xxx:8080/description.xml

From your question, I'm understanding that you have downloaded the Command Line application, and are trying to use the DLNALib.exe file?
Make sure you have also copied or downloaded the NewtonSoft.Json.dll to the same folder the DLNALib.exe is located.
This file can be found in the project download "Assemblies" folder.

Open a "Cmd" prompt and try pinging the TV's 1st. Make sure there is not a network issue!

Navigate to the folder where you have the files saved and,
run: DLNALib.exe /l /log
(The log switch will force it to create a logging file that can be found at: C:\ProgramData\Sony. Send me a copy of this!)
If the locator finds any devices, it should show their Description File URL on the screen.

This is step 1, lets see what we have so far!

witt...@gmail.com

unread,
Dec 23, 2015, 7:53:21 PM12/23/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
Hello,
The great thing about the holidays is I actually have some spare time.
This time when I ran the find command it actually found both TV's:

1) http://192.168.2.232:8008/ssdp/device-desc.xml
2) http://192.168.2.231:52323/MediaRenderer.xml
3) http://192.168.2.231:52323/MediaRenderer.xml
4) http://192.168.2.231:52323/MediaRenderer.xml
5) http://192.168.2.231:52323/MediaRenderer.xml
6) http://192.168.2.231:52323/MediaRenderer.xml
7) http://192.168.2.231:52323/MediaRenderer.xml
8) http://192.168.2.232:24977/sony/webapi/ssdp/dd.xml
9) http://192.168.2.231:4567/sony/webapi/ssdp/dd.xml
10) http://192.168.2.231:8008/ssdp/device-desc.xml
11) http://192.168.2.232:15066/dd.xml
12) http://192.168.2.231:1968/dd.xml
13) http://192.168.2.232:52323/MediaRenderer.xml
14) http://192.168.2.232:52323/MediaRenderer.xml
15) http://192.168.2.232:52323/MediaRenderer.xml
16) http://192.168.2.232:52323/MediaRenderer.xml
17) http://192.168.2.232:52323/MediaRenderer.xml
18) http://192.168.2.232:52323/MediaRenderer.xml

So I created the files by running the following commands:

<Ran this> D:\auto>dlnalib /b "http://192.168.2.231:1968/dd.xml" d:\auto
<This was the screen output> Saving Device: KDL-75W850C.xml to d:\auto\KDL-75W850C.xml
<I then renamed the above file to TVL.XML>

<Ran this> D:\auto>dlnalib /b "http://192.168.2.232:15066/dd.xml" d:\auto
<This was the screen output> Saving Device: KDL-75W850C.xml to d:\auto\KDL-75W850C.xml
<I then renamed the above file to TVR.XML>

I do not appear to register the device.

I tried:
D:\auto>dlnalib /r "D:\auto\TVR.xml" /log
KDL-75W850C: Performing Registration....
Before continuing, you may need to set the device to Registration Mode,
Confirm Registration or enter the Registration PIN code.
Go to the device and perfrom any step, or be ready to before hitting enter below!
=====================================
Hit enter to Continue....


D:\auto>

The log file says:
24/12/2015 10:31:09 AM - Verifing Registration for: KDL-75W850C
24/12/2015 10:31:09 AM - Checking Status of Device KDL-75W850C
24/12/2015 10:31:09 AM - Checking Device Status for KDL-75W850C Failed!
24/12/2015 10:31:09 AM - System.NullReferenceException: Object reference not set to an instance of an object.
   at SonyAPILib.SonyAPI_Lib.SonyDevice.getActionlist(String lAction, String actionList_URL)
   at SonyAPILib.SonyAPI_Lib.SonyDevice.checkStatus()
24/12/2015 10:31:09 AM - KDL-75W850C: Registration Check returned: False
24/12/2015 10:31:14 AM - Controlling Mac address: F8-32-E4-38-BC-B2
24/12/2015 10:31:14 AM - Registration was NOT successful for device at: 192.168.2.232

I've tried playing around with the simpleIP and preshared key settings and even putting this into the xml or the command prompt but this hasn't made any difference - any ideas?

If I try and send a command to put the input to HDMI1 I get the following in the log:

24/12/2015 10:41:39 AM - Verifing Registration for: KDL-75W850C
24/12/2015 10:41:39 AM - Checking Status of Device KDL-75W850C
24/12/2015 10:41:39 AM - Checking Device Status for KDL-75W850C Failed!
24/12/2015 10:41:39 AM - System.NullReferenceException: Object reference not set to an instance of an object.
   at SonyAPILib.SonyAPI_Lib.SonyDevice.getActionlist(String lAction, String actionList_URL)
   at SonyAPILib.SonyAPI_Lib.SonyDevice.checkStatus()
24/12/2015 10:41:39 AM - KDL-75W850C: Registration Check returned: False
24/12/2015 10:41:39 AM - IRCC Recieved XSendIRCC Command: AAAAAgAAABoAAABaAw==
24/12/2015 10:41:39 AM - Sending IRCC Command: AAAAAgAAABoAAABaAw==
24/12/2015 10:41:39 AM - Creating HttpWebRequest to URL: http://192.168.2.232/sony/ircc
24/12/2015 10:41:39 AM - Sending the following parameter: <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAgAAABoAAABaAw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>
24/12/2015 10:41:39 AM - Setting Header Information: 192.168.2.232
24/12/2015 10:41:39 AM - Header Host: 192.168.2.232:6891
24/12/2015 10:41:39 AM - Setting Header User Agent: Dalvik/1.6.0 (Linux; u; Android 4.0.3; EVO Build/IML74K)
24/12/2015 10:41:39 AM - Setting Header X-CERS-DEVICE-ID: TVSideView-F8-32-E4-38-BC-B2
24/12/2015 10:41:39 AM - Sending WebRequest
24/12/2015 10:41:39 AM - Sending WebRequest Complete
24/12/2015 10:41:39 AM - Creating Web Request Response
24/12/2015 10:41:39 AM - Error communicating with device

SonyAPILib

unread,
Dec 23, 2015, 9:33:28 PM12/23/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
Ok, did some research and this is 4K Sony, which is actually newer than what my code was written for!
My code goes to Generation 3, but that is like 2014....

But lets not give up yet!!!

I would like to look at some of these XML files.
But before we do that, I think you used the wrong file to create your device and register.

Try using:
and 

Also, you should be able to go to any of these urls in a browser and see the file.
If you can I would like to see #1, 8, 9, 10, 11 and 12

witt...@gmail.com

unread,
Dec 28, 2015, 7:45:01 PM12/28/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
Hello,
Not sure if the emails came through to you with the xml files from the TV's exported as pdf's? I've also emailed through the logs from trying to authenticate with the below recommended file - unfortunately it didn't work but I'll be having a bit of a go later this week...

I have also tried doing some packet captures on my mobile phone to see how the sideview app interacts with the TV's - so far I haven't made much headway but as I am not much of a programmer I am hoping I recognise what authentication I may need when I see it.

SonyAPILib

unread,
Dec 30, 2015, 10:11:43 AM12/30/15
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
Sent you a PM to your Gmail with some more information and a change to the SonyAPILib that may help us with the Gen 4 devices.

witt...@gmail.com

unread,
Jan 2, 2016, 1:53:28 AM1/2/16
to Sony API Library, k.her...@gmail.com, witt...@gmail.com
Hello,
Finally got some time to do some more testing.  I downloaded the dll you sent me but when I put it in the directory the dlnalib.exe stops working, I get the following:
D:\auto>DLNALib.exe /h

Unhandled Exception: System.MissingMethodException: Method not found: 'Void APILogging.set_enableLogging(Boolean)'.
   at DLNALib.Program.Main(String[] args)

D:\auto>DLNALib.exe /l

Unhandled Exception: System.MissingMethodException: Method not found: 'Void APILogging.set_enableLogging(Boolean)'.
   at DLNALib.Program.Main(String[] args)

If I put the old one back it will run the commands.  With the authentication the TV's are the same as Gen 3 - when you go to authenticate the tv pops up a random 4 digit code and you have about 30 seconds to enter it into sideview.

Let me know if there is something else I can try - it looks like there is something in that new dll that my pc doesn't like.

brendan...@gmail.com

unread,
May 3, 2016, 9:34:17 AM5/3/16
to Sony API Library
Hello there

"witt..." has moved away and we are having trouble with these commands going through. Basically, both TV's were working, then one stopped. I got them both working again by changing a setting on the actual TV in the Bravia Sync Settings. But now neither TV is accepting the IRCC commands and I am trying to fix it.

I was just sent this forum link and have been reading the conversation. Tonight I ran some commands and logged the results. Below is what I received when I tried to run the switch to HDMI1 command:

dlnalib.exe /a D:\auto\TVL.xml IRCC XSendIRCC "AAAAAgAAABoAAABaAw==" /log
dlnalib.exe /a D:\auto\TVR.xml IRCC XSendIRCC "AAAAAgAAABoAAABaAw==" /log

5/3/2016 10:38:49 PM - Verifing Registration for: BraviaLeft
5/3/2016 10:38:49 PM - Checking for Generation 3 Cookie
5/3/2016 10:38:49 PM - BraviaLeft: Cookie Loaded: FA43E6142C77F21C75F7B4D8720F301B10BD2F64
5/3/2016 10:38:49 PM - BraviaLeft: Checking if Cookie has Expired: 05/08/2016 09:04:44
5/3/2016 10:38:49 PM - BraviaLeft: Cookie Expiration Date: 05/08/2016 09:04:44
5/3/2016 10:38:49 PM - BraviaLeft: Current Date and Time : 5/3/2016 10:38:49 PM
5/3/2016 10:38:49 PM - BraviaLeft: Cookie is not Expired.
5/3/2016 10:38:49 PM - auth: Adding Cookie to Device: FA43E6142C77F21C75F7B4D8720F301B10BD2F64
5/3/2016 10:38:49 PM - BraviaLeft: Cookie Found: auth=[{"Comment":"","CommentUri":null,"HttpOnly":false,"Discard":false,"Domain":"192.168.2.231","Expired":false,"Expires":"\/Date(1462662284851+1000)\/","Name":"auth","Path":"/sony/","Port":"","Secure":false,"TimeStamp":"\/Date(1461452684851+1000)\/","Value":"FA43E6142C77F21C75F7B4D8720F301B10BD2F64","Version":0}]

5/3/2016 10:38:49 PM - BraviaLeft: Registration Check returned: True
5/3/2016 10:38:49 PM - IRCC Recieved XSendIRCC Command: AAAAAgAAABoAAABaAw==
5/3/2016 10:38:49 PM - Sending IRCC Command: AAAAAgAAABoAAABaAw==
5/3/2016 10:38:49 PM - Creating HttpWebRequest to URL: http://192.168.2.231/sony/ircc
5/3/2016 10:38:49 PM - Sending the following parameter: <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAgAAABoAAABaAw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>
5/3/2016 10:38:49 PM - Setting Header Information: 192.168.2.231
5/3/2016 10:38:49 PM - Header Host: 192.168.2.231:11738
5/3/2016 10:38:49 PM - Setting Header User Agent: Dalvik/1.6.0 (Linux; u; Android 4.0.3; EVO Build/IML74K)
5/3/2016 10:38:49 PM - Processing Auth Cookie
5/3/2016 10:38:49 PM - Cookie Container Count: 1
5/3/2016 10:38:49 PM - Setting Header Cookie: auth=FA43E6142C77F21C75F7B4D8720F301B10BD2F64
5/3/2016 10:38:49 PM - Sending WebRequest
5/3/2016 10:38:49 PM - Sending WebRequest Complete
5/3/2016 10:38:49 PM - Creating Web Request Response
5/3/2016 10:38:49 PM - Error communicating with device
5/3/2016 10:38:50 PM - Verifing Registration for: BraviaRight
5/3/2016 10:38:50 PM - Checking for Generation 3 Cookie
5/3/2016 10:38:50 PM - BraviaRight: Cookie Loaded: E5F7EEBDFAAC5D1B8DCE2D4E73EA7BD9BB26AA46
5/3/2016 10:38:50 PM - BraviaRight: Checking if Cookie has Expired: 05/16/2016 07:35:09
5/3/2016 10:38:50 PM - BraviaRight: Cookie Expiration Date: 05/16/2016 07:35:09
5/3/2016 10:38:50 PM - BraviaRight: Current Date and Time : 5/3/2016 10:38:50 PM
5/3/2016 10:38:50 PM - BraviaRight: Cookie is not Expired.
5/3/2016 10:38:50 PM - auth: Adding Cookie to Device: E5F7EEBDFAAC5D1B8DCE2D4E73EA7BD9BB26AA46
5/3/2016 10:38:50 PM - BraviaRight: Cookie Found: auth=[{"Comment":"","CommentUri":null,"HttpOnly":false,"Discard":false,"Domain":"192.168.2.232","Expired":false,"Expires":"\/Date(1463348109468+1000)\/","Name":"auth","Path":"/sony/","Port":"","Secure":false,"TimeStamp":"\/Date(1462138509468+1000)\/","Value":"E5F7EEBDFAAC5D1B8DCE2D4E73EA7BD9BB26AA46","Version":0}]

5/3/2016 10:38:50 PM - BraviaRight: Registration Check returned: True
5/3/2016 10:38:50 PM - IRCC Recieved XSendIRCC Command: AAAAAgAAABoAAABaAw==
5/3/2016 10:38:50 PM - Sending IRCC Command: AAAAAgAAABoAAABaAw==
5/3/2016 10:38:50 PM - Creating HttpWebRequest to URL: http://192.168.2.232/sony/ircc
5/3/2016 10:38:50 PM - Sending the following parameter: <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAgAAABoAAABaAw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>
5/3/2016 10:38:50 PM - Setting Header Information: 192.168.2.232
5/3/2016 10:38:50 PM - Header Host: 192.168.2.232:13743
5/3/2016 10:38:50 PM - Setting Header User Agent: Dalvik/1.6.0 (Linux; u; Android 4.0.3; EVO Build/IML74K)
5/3/2016 10:38:50 PM - Processing Auth Cookie
5/3/2016 10:38:50 PM - Cookie Container Count: 1
5/3/2016 10:38:50 PM - Setting Header Cookie: auth=E5F7EEBDFAAC5D1B8DCE2D4E73EA7BD9BB26AA46
5/3/2016 10:38:50 PM - Sending WebRequest
5/3/2016 10:38:50 PM - Sending WebRequest Complete
5/3/2016 10:38:50 PM - Creating Web Request Response
5/3/2016 10:38:50 PM - Error communicating with device

Here is what I received when I ran:

dlnalib.exe /l /log:

5/3/2016 10:40:00 PM - UPnP is Discovering devices....
5/3/2016 10:40:25 PM - Devices Discovered: 1

I also have pdf's of the detail when entering the following into a web browser:
http://192.168.2.231:8008/ssdp/device-desc.xml
http://192.168.2.232:8008/ssdp/device-desc.xml

I am sorry to just dump all of this information on you in the hope that you can help.

If you have time, a couple of other questions I am curious about are:
Does it matter if the TV are connected via DCHP or Static?
Do you know what settings, if any, need to be set on the actual TV?

Thank you in advance

SonyAPILib

unread,
May 3, 2016, 7:40:03 PM5/3/16
to Sony API Library, brendan...@gmail.com
I can't be for sure what is going on here, as I remember these are newer generation devices.
The logging information all looks good up t the point it is trying to send the command?? Very Strange.

I would make sure the TV's are on a static IP address, and they need to match what is in the TVL.xml and TVR.xml files as the Device_IP_Address for each.
Also, they can not have the same name, and I remember this was an issue at one time to, but Witt changed it in the TV's.

Also not sure why the "Locate" command only found 1 of the TV's. Check you network connections and be sure you can ping both TV's

cgat...@gmail.com

unread,
Aug 19, 2016, 4:49:46 AM8/19/16
to Sony API Library, k.her...@gmail.com
Hi I have a STR DN840 and cannot get the dlnalib.exe tool to register with the receiver.

Log:
19.08.2016 10:38:03 - Verifing Registration for: STR-DN840 A56180
19.08.2016 10:38:03 - Checking Status of Device STR-DN840 A56180
19.08.2016 10:38:03 - Checking Device Status for STR-DN840 A56180 Failed!
19.08.2016 10:38:03 - System.NullReferenceException: Object reference not set to an instance of an object.
   at SonyAPILib.SonyAPI_Lib.SonyDevice.getActionlist(String lAction, String actionList_URL)
   at SonyAPILib.SonyAPI_Lib.SonyDevice.checkStatus()
19.08.2016 10:38:03 - STR-DN840 A56180: Registration Check returned: False


But that is not my original goal. I was hoping to use your tool to aquire those IRC codes. I have written a small linux script to control the receiver. What I cannot obtain are those IRCC codes. How did you get them? Could you explain it to me, please?

Thanks

cgat...@gmail.com

unread,
Aug 19, 2016, 5:38:34 AM8/19/16
to Sony API Library, k.her...@gmail.com, cgat...@gmail.com
Some additions:
There is a second url found for the STR-Dn840 which ends up like this:

19.08.2016 10:56:10 - Retrieving Device Description Document from URI:
19.08.2016 10:56:10 - Retrieving Controlling devices Mac Address. (this computer)
19.08.2016 10:56:10 - Mac Address retrieved: AC220B81C8C1
19.08.2016 10:56:10 - Re-Parsing Mac Address. (Replace : with -)
19.08.2016 10:56:10 - Mac Address has been re-Parsed: AC-22-0B-81-C8-C1
19.08.2016 10:56:10 - Document Found
19.08.2016 10:56:10 - Action List Found.
19.08.2016 10:56:11 - Device has a registration Mode of: 1
19.08.2016 10:56:11 -  is Retrieving Generation:1 Remote Command List
19.08.2016 10:56:11 - Creating HttpWebRequest to URL: http://192.168.1.82:50001/cers/getRemoteCommandList
19.08.2016 10:56:11 - Setting Header Information: 192.168.1.82:50001
19.08.2016 10:56:11 - Creating Web Request Response
19.08.2016 10:56:11 - There was an error during the Web Request or Response! System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
   at System.Net.HttpWebRequest.GetResponse()
   at SonyAPILib.SonyAPI_Lib.SonyDevice.HttpGet(String Url)
19.08.2016 10:56:11 - Retrieve Command List was Successful

If I request http://192.168.1.82:50001/cers/getRemoteCommandList manually I get a 403 (forbidden) response. So to register I need the device file, to get the device file I need to register because of the forbidden information - that's strange.

SonyAPILib

unread,
Aug 19, 2016, 8:43:16 AM8/19/16
to Sony API Library, k.her...@gmail.com, cgat...@gmail.com
OK,

Yes, sometimes devices will return more than 1 URL. When unsure which one to use, you can always open the XML file and browse through it.

The correct description URL for your STR-DN840 is:  http://192.168.1.82:8080/description.xml.

Are you putting the STR-DN840 in to registration mode before trying to use the EXE to register?
The STR-DN840 has a section in the Network Settings that allows you to put it in to Registration mode.
You may need to refer to your manual.

Here is a few things to try.

1) Use the Build from Document switch to create your API Device file: 
DLNALib.exe /b " http://192.168.1.82:8080/description.xml" "C:\Temp" /log
This should create a file in C:\Temp named: 
 STR-DN840 A56180.xml (You may have to create the Temp folder)

2) Go to your STR-DN840 and put it in to registration mode.

3) Now run the Register command using the file created in step 1:
DLNALib.exe /r "C:\Temp\STR-DB840 A56180.xml" /log

4) If the registration is Successful, then repeat Step 1 so that it creates a new API Device file with the registration!

Now, you should be able to open C:\Temp\STR-DB840 A56180.xml and see all the commands!

cgat...@gmail.com

unread,
Aug 23, 2016, 3:26:02 AM8/23/16
to Sony API Library, k.her...@gmail.com, cgat...@gmail.com
Hi thanks for your reply.
the build from document doesn't work, allready.

command is:
DLNALib.exe /b http://192.168.1.82:8080/description.xml "C:\NoBackup\DLNA" /log

the log file output for this command says:
23.08.2016 09:12:49 - Retrieving Device Description Document from URI:

23.08.2016 09:12:49 - http://192.168.1.82:8080/description.xml
23.08.2016 09:12:49 - Retrieving Controlling devices Mac Address. (this computer)
23.08.2016 09:12:49 - Mac Address retrieved: F01FAF1A00C6
23.08.2016 09:12:49 - Re-Parsing Mac Address. (Replace : with -)
23.08.2016 09:12:49 - Mac Address has been re-Parsed: F0-1F-AF-1A-00-C6
23.08.2016 09:12:49 - Document Found
23.08.2016 09:12:49 - Action List Found.
23.08.2016 09:12:50 - Device has a registration Mode of: 1
23.08.2016 09:12:50 -  is Retrieving Generation:1 Remote Command List
23.08.2016 09:12:50 - Creating HttpWebRequest to URL: http://192.168.1.82:50001/cers/getRemoteCommandList
23.08.2016 09:12:50 - Setting Header Information: 192.168.1.82:50001
23.08.2016 09:12:50 - Creating Web Request Response
23.08.2016 09:12:50 - There was an error during the Web Request or Response! System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.

   at
System.Net.HttpWebRequest.GetResponse()
   at
SonyAPILib.SonyAPI_Lib.SonyDevice.HttpGet(String Url)
23.08.2016 09:12:50 - Retrieve Command List was Successful


It finds the description xml and tries to request the remotecommandlist - but this request fails. the error message does not say why. But if I do a manual request for this url: http://192.168.1.82:50001/cers/getRemoteCommandList it says the connection is forbidden (403). As result it doesn't create the device xml file.
Any ideas?

SonyAPILib

unread,
Aug 23, 2016, 12:36:52 PM8/23/16
to Sony API Library, k.her...@gmail.com, cgat...@gmail.com
OK,

Let me ask you a couple of more questions:

1) Does the folder "C:\NoBackup\DLNA" exist? 
2) If #1 is NO, try creating the folder.
3) If #1 is Yes, Are there no files created in this folder at all?
4) There was a Patch Uploaded to GitHub 16 days ago, are you using the latest code? https://github.com/KHerron/SonyAPILib/commit/db6e2bcb182084c023ed3eacede138dbfac020cf

Also:
But if I do a manual request for this url: http://192.168.1.82:50001/cers/getRemoteCommandList it says the connection is forbidden (403)
This is because you have not registered with the device. You must successfully register before it will return the command list.

If you plan to have your Linux application retrieve this information from the device, you are going to have to make it register with the device too.
I can send you a copy of the current STR-DN840 Commands. But if you hard code them, your application will not work with any other Sony devices.

I also have some more updated code to push up to Git, as I have started on v5.3. (See Wiki Pages on Git)
Not much changes to the actual code, but A LOT of naming changes.
However, there is also a small update to the GetRemoteCommandList and BuildFromDocument, and I think it should solve your problem.
Also, Your more than welcome to create an Issue ticket on Git for any issues you are having.

I will push the changes to my GitHub page later today. Please download, test and report your findings!
Also, You are more than welcome to create an Issue ticket on GitHub for any issues you are having.

One last thing you may want to try, and that is running the ConsoleExample.exe application.
As it should force the Registration process. If that works, then go back and build your device file using the DLNALib.exe.
 
Thank you for all your input and help. I would like to see your Linux code, as we could possibly convert this one to work with Linux also.
Reply all
Reply to author
Forward
0 new messages