mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 10:58:28 +00:00
feat: add DisableEcho property to GenericSshClient and integrate with CommFactory
This commit is contained in:
parent
9656e3c408
commit
42b358862f
2 changed files with 16 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using Crestron.SimplSharp;
|
||||
|
|
@ -137,6 +138,11 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
|
|||
|
||||
private bool DisconnectLogged = false;
|
||||
|
||||
/// <summary>
|
||||
/// When true, turns off echo for the SSH session
|
||||
/// </summary>
|
||||
public bool DisableEcho { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typical constructor.
|
||||
/// </summary>
|
||||
|
|
@ -250,7 +256,15 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
|
|||
try
|
||||
{
|
||||
Client.Connect();
|
||||
TheStream = Client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534);
|
||||
|
||||
var modes = new Dictionary<TerminalModes, uint>();
|
||||
|
||||
if (DisableEcho)
|
||||
{
|
||||
modes.Add(TerminalModes.ECHO, 0);
|
||||
}
|
||||
|
||||
TheStream = Client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534, modes);
|
||||
if (TheStream.DataAvailable)
|
||||
{
|
||||
// empty the buffer if there is data
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace PepperDash.Essentials.Core;
|
|||
{
|
||||
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||
ssh.AutoReconnect = c.AutoReconnect;
|
||||
ssh.DisableEcho = c.DisableSshEcho;
|
||||
if(ssh.AutoReconnect)
|
||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||
comm = ssh;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue