feat: add IDspPresetsDirectRecall interface to define preset recall functionality

This commit is contained in:
Neil Dorin 2026-07-21 11:21:22 -06:00
parent 6852f47ce2
commit f971a3adff
2 changed files with 39 additions and 0 deletions

View file

@ -306,6 +306,27 @@ public class GenericSshClient : Device, ISocketStatusWithStreamDebugging, IAutoR
ReconnectTimer.Start();
}
}
catch (System.Net.Sockets.SocketException e)
{
// SSH.NET only wraps socket failures in SshConnectionException once the SSH
// protocol handshake begins - a failure before that (e.g. DNS resolution failure,
// "Name or service not known", or connection refused) surfaces as a raw
// SocketException here instead. This is an expected/routine "device offline"
// condition (same as the SshConnectionException case above), so log it at Warning
// instead of falling through to the generic handler's LogException/Error-level
// stack trace dump.
this.LogWarning("Connection failure: Cannot reach {host} on {port} ({message})", Hostname, Port, e.Message);
DisconnectLogged = true;
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
if (AutoReconnect)
{
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs);
ReconnectTimer.Stop();
ReconnectTimer.Interval = AutoReconnectIntervalMs;
ReconnectTimer.Start();
}
}
catch (Exception e)
{
this.LogException(e, "Unhandled exception on connect");

View file

@ -0,0 +1,18 @@
using PepperDash.Core;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core;
/// <summary>
/// Defines the contract for IDspPresetsDirectRecall
/// </summary>
public interface IDspPresetsDirectRecall : IKeyed
{
/// <summary>
/// Recalls the preset by name
/// </summary>
/// <param name="name"></param>
void RunPreset(string name);
}