Possibility to switch off Telnet VirtualTerminal completely, IVirtualTerminal, DummyVT.
This commit is contained in:
parent
4564f0424c
commit
6e420250b4
@ -174,7 +174,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, TelnetPrompt, TelnetSkipFirstLine);
|
||||
Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, TelnetPrompt, TelnetSkipFirstLine, CameraCfg.DisplayTerminal);
|
||||
|
||||
if (CameraCfg.DisplayTerminal)
|
||||
{
|
||||
|
||||
15
TestBenchFramework/BenchControl/Network/Telnet/DummyVT.cs
Normal file
15
TestBenchFramework/BenchControl/Network/Telnet/DummyVT.cs
Normal file
@ -0,0 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Network.Telnet
|
||||
{
|
||||
public class DummyVT : IVirtualTerminal
|
||||
{
|
||||
public DummyVT() { }
|
||||
|
||||
public void ClearScreen() { }
|
||||
public void WriteVt(char c) { }
|
||||
public void WriteVt(string txt) { }
|
||||
public string Text { get { return string.Empty; } }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Network.Telnet
|
||||
{
|
||||
public interface IVirtualTerminal
|
||||
{
|
||||
void ClearScreen();
|
||||
void WriteVt(char c);
|
||||
void WriteVt(string txt);
|
||||
string Text { get; }
|
||||
}
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
/// Private fields
|
||||
///
|
||||
object objRef; /// Reference to object to be included in info sent by event handlers
|
||||
VirtualTerminal vt; /// Virtual terminal
|
||||
IVirtualTerminal vt; /// Virtual terminal
|
||||
string hostname; /// Telnet server host name or IP address.
|
||||
int portNr = DefaultTelnetPortNumber; /// Telnet server port number.
|
||||
TcpClient tcp = null; /// Reference to TcpClient
|
||||
@ -223,7 +223,7 @@ 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.
|
||||
/// </summary>
|
||||
public TelnetClient(object objRef, string threadId, string userName, string password, string defaultPrompt, bool skipFirstLine)
|
||||
public TelnetClient(object objRef, string threadId, string userName, string password, string defaultPrompt, bool skipFirstLine, bool useVT)
|
||||
{
|
||||
this.objRef = objRef;
|
||||
this.telnetUserName = userName;
|
||||
@ -232,7 +232,17 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
this.skipFirstLine = skipFirstLine;
|
||||
|
||||
state = TelnetState.Inactive; /// Device's icon is being updated by HNIP
|
||||
vt = new VirtualTerminal(); /// TODO: pass a VirtualTerminal reference
|
||||
///
|
||||
if (useVT)
|
||||
{
|
||||
vt = new VirtualTerminal();
|
||||
}
|
||||
else
|
||||
{
|
||||
vt = new DummyVT();
|
||||
}
|
||||
|
||||
/// TODO: pass a VirtualTerminal reference
|
||||
this.portNr = DefaultTelnetPortNumber;
|
||||
queueEvent = new AutoResetEvent(false);
|
||||
disconnectDone = new AutoResetEvent(false);
|
||||
@ -986,7 +996,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
///
|
||||
/// Public properties (read only)
|
||||
///
|
||||
public VirtualTerminal Vt { get { return vt; } }
|
||||
public IVirtualTerminal Vt { get { return vt; } }
|
||||
public string Hostname { get { return hostname; } }
|
||||
public string NotificationText { get { return notificationText; } }
|
||||
public string ErrorText { get { return fatalErrorText; } }
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
/// - ClearScreen() and WriteVt() methods called from one thread only
|
||||
/// - properties Text, etc. can be safely read from an arbitrary thread
|
||||
/// </summary>
|
||||
public class VirtualTerminal
|
||||
public class VirtualTerminal : IVirtualTerminal
|
||||
{
|
||||
const uint DefaultVtRowsCount = 80; /// Default VT height (number of rows)
|
||||
const uint DefaultVtColumnsCount = 132; /// Default VT width (number of columns)
|
||||
|
||||
@ -618,7 +618,9 @@
|
||||
<Compile Include="BenchControl\Network\Camera\Roi\Factory.cs" />
|
||||
<Compile Include="BenchControl\Network\Camera\Roi\RoiDetectionOp.cs" />
|
||||
<Compile Include="BenchControl\Network\Telnet\Command.cs" />
|
||||
<Compile Include="BenchControl\Network\Telnet\DummyVT.cs" />
|
||||
<Compile Include="BenchControl\Network\Telnet\EventArgsClasses.cs" />
|
||||
<Compile Include="BenchControl\Network\Telnet\IVirtualTerminal.cs" />
|
||||
<Compile Include="BenchControl\Network\Telnet\TelnetClient.cs" />
|
||||
<Compile Include="BenchControl\Network\Telnet\VirtualTerminal.cs" />
|
||||
<Compile Include="BenchControl\Network\Tftp\TftpServer.cs" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user