diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs index 0728cfc..02b42d5 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericSshClient.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; @@ -34,6 +35,8 @@ namespace PepperDash.Core /// public event EventHandler ConnectionChange; + private Dictionary _terminalModes = new Dictionary(); + ///// ///// ///// @@ -137,29 +140,53 @@ namespace PepperDash.Core private bool DisconnectLogged = false; - /// - /// Typical constructor. - /// - public GenericSshClient(string key, string hostname, int port, string username, string password) : - base(key) - { + /// + /// Typical constructor. + /// + public GenericSshClient(string key, string hostname, int port, string username, string password) : + base(key) + { StreamDebugging = new CommunicationStreamDebugging(key); - CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); - Key = key; - Hostname = hostname; - Port = port; - Username = username; - Password = password; - AutoReconnectIntervalMs = 5000; + CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); + Key = key; + Hostname = hostname; + Port = port; + Username = username; + Password = password; + AutoReconnectIntervalMs = 5000; ReconnectTimer = new CTimer(o => - { - if (ConnectEnabled) - { - Connect(); - } - }, Timeout.Infinite); - } + { + if (ConnectEnabled) + { + Connect(); + } + }, Timeout.Infinite); + } + /// + /// Constructor With Terminal Option \"Echo Off\". + /// + public GenericSshClient(string key, string hostname, int port, string username, string password, bool disableEcho) : + base(key) + { + StreamDebugging = new CommunicationStreamDebugging(key); + CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); + Key = key; + Hostname = hostname; + Port = port; + Username = username; + Password = password; + AutoReconnectIntervalMs = 5000; + if(disableEcho) _terminalModes.Add(TerminalModes.ECHO, 0); + + ReconnectTimer = new CTimer(o => + { + if (ConnectEnabled) + { + Connect(); + } + }, Timeout.Infinite); + } /// /// S+ Constructor - Must set all properties before calling Connect @@ -258,7 +285,7 @@ namespace PepperDash.Core try { Client.Connect(); - TheStream = Client.CreateShellStream("PDTShell", 100, 80, 100, 200, 65534); + TheStream = Client.CreateShellStream("PDTShell", 100, 80, 100, 200, 65534, _terminalModes); TheStream.DataReceived += Stream_DataReceived; Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Connected"); ClientStatus = SocketStatus.SOCKET_STATUS_CONNECTED; diff --git a/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs b/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs index 8cfaad2..23a8e86 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/GenericTcpIpClient.cs @@ -549,6 +549,11 @@ namespace PepperDash.Core /// public int AutoReconnectIntervalMs { get; set; } + /// + /// Used to set TerminalMode.Echo to 0 + /// + public bool DisableEcho { get; set; } + /// /// Default constructor ///