mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +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;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
@ -137,6 +138,11 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
|
||||||
|
|
||||||
private bool DisconnectLogged = false;
|
private bool DisconnectLogged = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When true, turns off echo for the SSH session
|
||||||
|
/// </summary>
|
||||||
|
public bool DisableEcho { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Typical constructor.
|
/// Typical constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -250,7 +256,15 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Client.Connect();
|
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)
|
if (TheStream.DataAvailable)
|
||||||
{
|
{
|
||||||
// empty the buffer if there is data
|
// 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);
|
var ssh = new GenericSshClient(deviceConfig.Key + "-ssh", c.Address, c.Port, c.Username, c.Password);
|
||||||
ssh.AutoReconnect = c.AutoReconnect;
|
ssh.AutoReconnect = c.AutoReconnect;
|
||||||
|
ssh.DisableEcho = c.DisableSshEcho;
|
||||||
if(ssh.AutoReconnect)
|
if(ssh.AutoReconnect)
|
||||||
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
ssh.AutoReconnectIntervalMs = c.AutoReconnectIntervalMs;
|
||||||
comm = ssh;
|
comm = ssh;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue