Skip to content
Kirk edited this page Aug 26, 2016 · 5 revisions

This console application demonstrates how easy it is to create very small .EXE applications that can execute commands on your device with only 6 lines of code.

For the fastest execution of this example, it is suggested that you have already registered your device and have a complete API Device file available.

SonyAPILib mySonyLib = new SonyAPILib();  
mySonyLib.LOG.Enable = false;  
SonyAPILib.SonyDevice mySonyDev = new SonyAPILib.SonyDevice();  
mySonyDev = mySonyLib.Locate.DeviceLoad(@"c:\MyDevices\Bravia55.xml");
string cmd = mySonyDev.GetCommandString("PowerOff");  
string results = mySonyDev.Ircc.SendIRCC(mySonyDev, cmd);  

If you DO NOT have a device file, but have registered the device successfully, you can also use the BuildFromDocument() method in this example.

SonyAPILib mySonyLib = new SonyAPILib();  
mySonyLib.LOG.Enable = false;  
SonyAPILib.SonyDevice mySonyDev = new SonyAPILib.SonyDevice();  
mySonyDev.BuildFromDocument(new Uri("http://192.168.0.100:52323/dmr.xml"));  
string cmd = mySonyDev.GetCommandString("PowerOff");  
string results = mySonyDev.Ircc.SendIRCC(mySonyDev, cmd);  
Clone this wiki locally