diff --git a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs index 8e75cff20..be4a8860a 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/Camera.cs @@ -38,6 +38,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 const string ClpUserName = "tbf"; const string ClpPassword = "C1ern4V0d4"; const string ClpPrompt = "$ "; + const bool ClpSkipFirstLine = true; public readonly CameraCfg CameraCfg; @@ -144,7 +145,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 if (cameraDetected) { /// Open telnet clint and start the log-in process - Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, ClpPrompt); + Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, ClpPrompt, ClpSkipFirstLine); if (CameraCfg.DisplayTerminal) { diff --git a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/CameraCfg.cs b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/CameraCfg.cs index b24eac51f..bcf23be16 100644 --- a/TestBenchFramework/BenchControl/Network/Camera/CLP1611/CameraCfg.cs +++ b/TestBenchFramework/BenchControl/Network/Camera/CLP1611/CameraCfg.cs @@ -2,6 +2,7 @@ /// Copyright (c) 2017 Sensus Metering Systems /// using TBF.BenchControl.Generic; +using TBF.Resources; namespace TBF.BenchControl.Network.Camera.CLP1611 { @@ -33,7 +34,12 @@ namespace TBF.BenchControl.Network.Camera.CLP1611 public string ToString(int i) { - return string.Format("Name={0}, HWAddr={1}, Parent={2}", Name, HardwareAddress, ParentName); + return string.Format("Name={0}, Address={1}, Terminal={2}, Use test images={3}, Parent={4}", + Name, + HardwareAddress, + DisplayTerminal ? Strings.yes : Strings.no, + UseTestImages ? Strings.yes : Strings.no, + ParentName); } } } diff --git a/TestBenchFramework/BenchControl/Network/Telnet/TelnetClient.cs b/TestBenchFramework/BenchControl/Network/Telnet/TelnetClient.cs index 8c6d939b6..e55c9bac7 100644 --- a/TestBenchFramework/BenchControl/Network/Telnet/TelnetClient.cs +++ b/TestBenchFramework/BenchControl/Network/Telnet/TelnetClient.cs @@ -202,14 +202,15 @@ namespace TBF.BenchControl.Network.Telnet readonly string telnetUserName; readonly string telnetPassword; readonly string defaultPrompt; + readonly bool skipFirstLine; /// Skip the first line when logging in - DateTime cmdStartTime; /// Time of the last Dequeue (= command execution start time). - TimeSpan cmdTimeOut; /// Time out period of the last dequeued command. - DateTime connectTimeout; /// Checked when handling NvtEvent.Timeout and in the state NvtState.Login + DateTime cmdStartTime; /// Time of the last Dequeue (= command execution start time). + TimeSpan cmdTimeOut; /// Time out period of the last dequeued command. + DateTime connectTimeout; /// Checked when handling NvtEvent.Timeout and in the state NvtState.Login - int timeDone = 0; /// Duration of commands in [s] executed so far ... - /// ... starting from Command(CmdAction.NOTIFICATION, "Begin") + int timeDone = 0; /// Duration of commands in [s] executed so far ... + /// ... starting from Command(CmdAction.NOTIFICATION, "Begin") Command currentCmd = new Command(CmdAction.VOID); /// The currently executed command, used to calculate timeDone @@ -222,12 +223,13 @@ namespace TBF.BenchControl.Network.Telnet /// Hostname (IP address) and the port number is passed to worker thread /// in a Command with CmdAction.CONNECT and str=hostname. /// - public TelnetClient(object objRef, string threadId, string userName, string password, string defaultPrompt) + public TelnetClient(object objRef, string threadId, string userName, string password, string defaultPrompt, bool skipFirstLine) { this.objRef = objRef; this.telnetUserName = userName; this.telnetPassword = password; this.defaultPrompt = defaultPrompt; + this.skipFirstLine = skipFirstLine; state = TelnetState.Inactive; /// Device's icon is being updated by HNIP vt = new VirtualTerminal(); /// TODO: pass a VirtualTerminal reference @@ -792,7 +794,7 @@ namespace TBF.BenchControl.Network.Telnet /// /// Username /// - RetVal retval = WaitForLoginPrompt(": "); + RetVal retval = WaitForLoginPrompt(": ", skipFirstLine); if (retval != RetVal.OK) return retval; vt.WriteVt(username + System.Environment.NewLine); WriteLineTcp(username); @@ -800,14 +802,14 @@ namespace TBF.BenchControl.Network.Telnet /// /// Password (hidden on the VT) /// - retval = WaitForLoginPrompt(": "); + retval = WaitForLoginPrompt(": ", false); if (retval != RetVal.OK) return retval; WriteLineTcp(password); /// /// Reset 'prompt' after (re)login and wait for the prompt /// - retval = WaitForLoginPrompt(prompt); + retval = WaitForLoginPrompt(prompt, false); if (retval != RetVal.OK) return retval; log.Info("Telnet login successfully completed " + hostname); @@ -820,7 +822,7 @@ namespace TBF.BenchControl.Network.Telnet /// /// Quit condition, login prompt should end with this pattern /// - RetVal WaitForLoginPrompt(string endsWithPattern) + RetVal WaitForLoginPrompt(string endsWithPattern, bool skipFirstLine) { StringBuilder s = new StringBuilder(); @@ -846,9 +848,26 @@ namespace TBF.BenchControl.Network.Telnet if (ds != null && ds.Length > 0) { - vt.WriteVt(ds); - s.Append(ds); - OnVtTextChanged(); + if (skipFirstLine) + { + if (ds.Contains(Environment.NewLine)) + { + skipFirstLine = false; + string afterNL = ds.Substring(ds.IndexOf(Environment.NewLine) + Environment.NewLine.Length); + if (afterNL.Length > 0) + { + vt.WriteVt(afterNL); + s.Append(afterNL); + OnVtTextChanged(); + } + } + } + else + { + vt.WriteVt(ds); + s.Append(ds); + OnVtTextChanged(); + } } } while (!s.ToString().EndsWith(endsWithPattern)); diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 5c6d143af..64d3283f0 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.12.467.1")] -[assembly: AssemblyFileVersion("2.12.467.1")] +[assembly: AssemblyVersion("2.12.468.1")] +[assembly: AssemblyFileVersion("2.12.468.1")]