cec: use the new "config constructor" in CecSharpClient
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 10 Feb 2012 11:45:11 +0000 (12:45 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 10 Feb 2012 11:45:11 +0000 (12:45 +0100)
src/CecSharpTester/CecSharpClient.cs

index a86d6fb0865f08e264ab6b17c9b666e68786165a..f989eb03cdc347fe82fd654ab651e7320f1d558a 100644 (file)
@@ -41,11 +41,14 @@ 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());
     }
@@ -195,8 +198,6 @@ namespace CecSharpClient
 
     public void MainLoop()
     {
-      Lib.EnableCallbacks(this);
-
       Lib.PowerOnDevices(CecLogicalAddress.Tv);
       Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
 
@@ -385,7 +386,8 @@ namespace CecSharpClient
       }
     }
 
-    private int         LogLevel;
-    private LibCecSharp Lib;
+    private int                 LogLevel;
+    private LibCecSharp         Lib;
+    private LibCECConfiguration Config;
   }
 }