X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FCecSharpTester%2FCecSharpClient.cs;h=006c83ae24e15a72e0063aff54690dfd4867ede2;hb=7b62b76ed9aa25bfad944140edfde33903a417bb;hp=342d7c094e1b74eeffedce288953221007f960a0;hpb=dd4ace4fb38ecd5c24f94bd590572bbd9660d12c;p=deb_libcec.git diff --git a/src/CecSharpTester/CecSharpClient.cs b/src/CecSharpTester/CecSharpClient.cs index 342d7c0..006c83a 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,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") { @@ -334,7 +332,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 +383,8 @@ namespace CecSharpClient } } - private int LogLevel; - private LibCecSharp Lib; + private int LogLevel; + private LibCecSharp Lib; + private LibCECConfiguration Config; } }