X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FCecSharpTester%2FCecSharpClient.cs;h=f470171fe3c88de5f7e648e795290ec0254c648d;hb=f81c0652a60fc95dd880bdbf279e61801c5cc1ec;hp=006c83ae24e15a72e0063aff54690dfd4867ede2;hpb=3efda01ac7b070e09012a5725112eb44c17001b4;p=deb_libcec.git diff --git a/src/CecSharpTester/CecSharpClient.cs b/src/CecSharpTester/CecSharpClient.cs index 006c83a..f470171 100644 --- a/src/CecSharpTester/CecSharpClient.cs +++ b/src/CecSharpTester/CecSharpClient.cs @@ -31,7 +31,6 @@ */ using System; -using System.Collections.Generic; using System.Text; using CecSharp; @@ -44,13 +43,14 @@ namespace CecSharpClient Config = new LibCECConfiguration(); Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; Config.DeviceName = "CEC Tester"; - Config.ClientVersion = CecClientVersion.Version1_5_0; + Config.ClientVersion = CecClientVersion.Version1_99_0; Config.SetCallbacks(this); LogLevel = (int)CecLogLevel.All; Lib = new LibCecSharp(Config); + Lib.InitVideoStandalone(); - Console.WriteLine("CEC Parser created - libcec version " + Lib.ToString(Config.ServerVersion)); + Console.WriteLine("CEC Parser created - libCEC version " + Lib.ToString(Config.ServerVersion)); } public override int ReceiveCommand(CecCommand command) @@ -94,45 +94,7 @@ namespace CecSharpClient return 1; } - void FlushLog() - { - CecLogMessage message = Lib.GetNextLogMessage(); - bool bGotMessage = !message.Empty; - while (bGotMessage) - { - if (((int)message.Level & LogLevel) == (int)message.Level) - { - string strLevel = ""; - switch (message.Level) - { - case CecLogLevel.Error: - strLevel = "ERROR: "; - break; - case CecLogLevel.Warning: - strLevel = "WARNING: "; - break; - case CecLogLevel.Notice: - strLevel = "NOTICE: "; - break; - case CecLogLevel.Traffic: - strLevel = "TRAFFIC: "; - break; - case CecLogLevel.Debug: - strLevel = "DEBUG: "; - break; - default: - break; - } - string strLog = string.Format("{0} {1,16} {2}", strLevel, message.Time, message.Message); - Console.WriteLine(strLog); - } - - message = Lib.GetNextLogMessage(); - bGotMessage = !message.Empty; - } - } - - public bool Connect(int timeout) + public bool Connect(int timeout) { CecAdapter[] adapters = Lib.FindAdapters(string.Empty); if (adapters.Length > 0) @@ -168,31 +130,31 @@ namespace CecSharpClient void ShowConsoleHelp() { Console.WriteLine( - "================================================================================" + System.Environment.NewLine + - "Available commands:" + System.Environment.NewLine + - System.Environment.NewLine + - "[tx] {bytes} transfer bytes over the CEC line." + System.Environment.NewLine + - "[txn] {bytes} transfer bytes but don't wait for transmission ACK." + System.Environment.NewLine + - "[on] {address} power on the device with the given logical address." + System.Environment.NewLine + - "[standby] {address} put the device with the given address in standby mode." + System.Environment.NewLine + - "[la] {logical_address} change the logical address of the CEC adapter." + System.Environment.NewLine + - "[pa] {physical_address} change the physical address of the CEC adapter." + System.Environment.NewLine + - "[osd] {addr} {string} set OSD message on the specified device." + System.Environment.NewLine + - "[ver] {addr} get the CEC version of the specified device." + System.Environment.NewLine + - "[ven] {addr} get the vendor ID of the specified device." + System.Environment.NewLine + - "[lang] {addr} get the menu language of the specified device." + System.Environment.NewLine + - "[pow] {addr} get the power status of the specified device." + System.Environment.NewLine + - "[poll] {addr} poll the specified device." + System.Environment.NewLine + - "[scan] scan the CEC bus and display device info" + System.Environment.NewLine + - "[mon] {1|0} enable or disable CEC bus monitoring." + System.Environment.NewLine + - "[log] {1 - 31} change the log level. see cectypes.h for values." + System.Environment.NewLine + - "[ping] send a ping command to the CEC adapter." + System.Environment.NewLine + - "[bl] to let the adapter enter the bootloader, to upgrade" + System.Environment.NewLine + - " the flash rom." + System.Environment.NewLine + - "[r] reconnect to the CEC adapter." + System.Environment.NewLine + - "[h] or [help] show this help." + System.Environment.NewLine + - "[q] or [quit] to quit the CEC test client and switch off all" + System.Environment.NewLine + - " connected CEC devices." + System.Environment.NewLine + + "================================================================================" + Environment.NewLine + + "Available commands:" + Environment.NewLine + + Environment.NewLine + + "[tx] {bytes} transfer bytes over the CEC line." + Environment.NewLine + + "[txn] {bytes} transfer bytes but don't wait for transmission ACK." + Environment.NewLine + + "[on] {address} power on the device with the given logical address." + Environment.NewLine + + "[standby] {address} put the device with the given address in standby mode." + Environment.NewLine + + "[la] {logical_address} change the logical address of the CEC adapter." + Environment.NewLine + + "[pa] {physical_address} change the physical address of the CEC adapter." + Environment.NewLine + + "[osd] {addr} {string} set OSD message on the specified device." + Environment.NewLine + + "[ver] {addr} get the CEC version of the specified device." + Environment.NewLine + + "[ven] {addr} get the vendor ID of the specified device." + Environment.NewLine + + "[lang] {addr} get the menu language of the specified device." + Environment.NewLine + + "[pow] {addr} get the power status of the specified device." + Environment.NewLine + + "[poll] {addr} poll the specified device." + Environment.NewLine + + "[scan] scan the CEC bus and display device info" + Environment.NewLine + + "[mon] {1|0} enable or disable CEC bus monitoring." + Environment.NewLine + + "[log] {1 - 31} change the log level. see cectypes.h for values." + Environment.NewLine + + "[ping] send a ping command to the CEC adapter." + Environment.NewLine + + "[bl] to let the adapter enter the bootloader, to upgrade" + Environment.NewLine + + " the flash rom." + Environment.NewLine + + "[r] reconnect to the CEC adapter." + Environment.NewLine + + "[h] or [help] show this help." + Environment.NewLine + + "[q] or [quit] to quit the CEC test client and switch off all" + Environment.NewLine + + " connected CEC devices." + Environment.NewLine + "================================================================================"); } @@ -205,7 +167,7 @@ namespace CecSharpClient Console.WriteLine("waiting for input"); command = Console.ReadLine(); - if (command.Length == 0) + if (command != null && command.Length == 0) continue; string[] splitCommand = command.Split(' '); if (splitCommand[0] == "tx" || splitCommand[0] == "txn")