X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FCecSharpTester%2FCecSharpClient.cs;h=061a992047877beebe9b9ec6fd1d7bbc22c19579;hb=10c03f2c2ee8de84829e5b38e655a0a7b14c737a;hp=342d7c094e1b74eeffedce288953221007f960a0;hpb=dd4ace4fb38ecd5c24f94bd590572bbd9660d12c;p=deb_libcec.git diff --git a/src/CecSharpTester/CecSharpClient.cs b/src/CecSharpTester/CecSharpClient.cs index 342d7c0..061a992 100644 --- a/src/CecSharpTester/CecSharpClient.cs +++ b/src/CecSharpTester/CecSharpClient.cs @@ -32,8 +32,8 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; +using CecSharp; namespace CecSharpClient { @@ -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); @@ -257,7 +258,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") { @@ -334,7 +335,7 @@ namespace CecSharpClient Console.WriteLine("CEC bus information"); Console.WriteLine("==================="); CecLogicalAddresses addresses = Lib.GetActiveDevices(); - for (int iPtr = 0; iPtr < addresses.Addresses.Count(); iPtr++) + for (int iPtr = 0; iPtr < addresses.Addresses.Length; iPtr++) { CecLogicalAddress address = (CecLogicalAddress)iPtr; if (!addresses.IsSet(address)) @@ -385,7 +386,8 @@ namespace CecSharpClient } } - private int LogLevel; - private LibCecSharp Lib; + private int LogLevel; + private LibCecSharp Lib; + private LibCECConfiguration Config; } }