cec: added RescanDevices()/cec_rescan_devices() to the interface, to let libCEC force...
[deb_libcec.git] / src / CecSharpTester / CecSharpClient.cs
index a86d6fb0865f08e264ab6b17c9b666e68786165a..006c83ae24e15a72e0063aff54690dfd4867ede2 100644 (file)
@@ -41,13 +41,16 @@ namespace CecSharpClient
   {
     public CecSharpClient()
     {
-      CecDeviceTypeList types = new CecDeviceTypeList();
-      types.Types[0] = CecDeviceType.RecordingDevice;
+      Config = new LibCECConfiguration();
+      Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
+      Config.DeviceName = "CEC Tester";
+      Config.ClientVersion = CecClientVersion.Version1_5_0;
+      Config.SetCallbacks(this);
+      LogLevel = (int)CecLogLevel.All;
 
-      Lib = new LibCecSharp("CEC Tester", types);
-      LogLevel = (int) CecLogLevel.All;
+      Lib = new LibCecSharp(Config);
 
-      Console.WriteLine("CEC Parser created - libcec version " + Lib.GetLibVersionMajor() + "." + Lib.GetLibVersionMinor());
+      Console.WriteLine("CEC Parser created - libcec version " + Lib.ToString(Config.ServerVersion));
     }
 
     public override int ReceiveCommand(CecCommand command)
@@ -195,11 +198,6 @@ namespace CecSharpClient
 
     public void MainLoop()
     {
-      Lib.EnableCallbacks(this);
-
-      Lib.PowerOnDevices(CecLogicalAddress.Tv);
-      Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
-
       bool bContinue = true;
       string command;
       while (bContinue)
@@ -257,7 +255,7 @@ namespace CecSharpClient
         else if (splitCommand[0] == "pa")
         {
           if (splitCommand.Length > 1)
-            Lib.SetPhysicalAddress(short.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
+            Lib.SetPhysicalAddress(ushort.Parse(splitCommand[1], System.Globalization.NumberStyles.HexNumber));
         }
         else if (splitCommand[0] == "osd")
         {
@@ -385,7 +383,8 @@ namespace CecSharpClient
       }
     }
 
-    private int         LogLevel;
-    private LibCecSharp Lib;
+    private int                 LogLevel;
+    private LibCecSharp         Lib;
+    private LibCECConfiguration Config;
   }
 }