Merge branch 'main' into feature/circuittype-property-versiport

This commit is contained in:
Andrew Welker 2026-02-09 14:58:06 -05:00 committed by GitHub
commit 3ed0bd52d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
251 changed files with 6998 additions and 1229 deletions

View file

@ -20,6 +20,13 @@ namespace PepperDash.Essentials.Core
{
GenericBase Device;
/// <summary>
/// Constructor for CrestronGenericBaseCommunicationMonitor
/// </summary>
/// <param name="parent">parent device</param>
/// <param name="device">device to monitor</param>
/// <param name="warningTime">time before warning status</param>
/// <param name="errorTime">time before error status</param>
public CrestronGenericBaseCommunicationMonitor(IKeyed parent, GenericBase device, long warningTime, long errorTime)
: base(parent, warningTime, errorTime)
{

View file

@ -12,6 +12,9 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class GenericCommunicationMonitor : StatusMonitorBase
{
/// <summary>
/// Gets the Client being monitored
/// </summary>
public IBasicCommunication Client { get; private set; }
/// <summary>
@ -281,17 +284,29 @@ namespace PepperDash.Essentials.Core
}
}
/// <summary>
/// Represents a CommunicationMonitorConfig
/// </summary>
/// <summary>
/// Represents a CommunicationMonitorConfig
/// </summary>
public class CommunicationMonitorConfig
{
/// <summary>
/// Gets or sets the PollInterval
/// </summary>
/// <summary>
/// Gets or sets the PollInterval
/// </summary>
public int PollInterval { get; set; }
/// <summary>
/// Gets or sets the TimeToWarning
/// </summary>
public int TimeToWarning { get; set; }
/// <summary>
/// Gets or sets the TimeToError
/// </summary>
public int TimeToError { get; set; }
/// <summary>
/// Gets or sets the PollString
/// </summary>
public string PollString { get; set; }
/// <summary>

View file

@ -11,12 +11,39 @@ namespace PepperDash.Essentials.Core
/// </summary>
public interface IStatusMonitor
{
/// <summary>
/// Gets the Parent
/// </summary>
IKeyed Parent { get; }
/// <summary>
/// Fires when the status changes
/// </summary>
event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
/// <summary>
/// Gets the Status
/// </summary>
MonitorStatus Status { get; }
/// <summary>
/// Gets the Message
/// </summary>
string Message { get; }
/// <summary>
/// Gets or sets the IsOnlineFeedback
/// </summary>
BoolFeedback IsOnlineFeedback { get; set; }
/// <summary>
/// Start method
/// </summary>
void Start();
/// <summary>
/// Stop method
/// </summary>
void Stop();
}
@ -26,6 +53,9 @@ namespace PepperDash.Essentials.Core
/// </summary>
public interface ICommunicationMonitor
{
/// <summary>
/// Gets the CommunicationMonitor
/// </summary>
StatusMonitorBase CommunicationMonitor { get; }
}
@ -34,29 +64,57 @@ namespace PepperDash.Essentials.Core
/// </summary>
public enum MonitorStatus
{
/// <summary>
/// Status Unknown
/// </summary>
StatusUnknown = 0,
IsOk = 1,
InWarning = 2,
/// <summary>
/// Is Ok
/// </summary>
IsOk = 1,
/// <summary>
/// In Warning
/// </summary>
InWarning = 2,
/// <summary>
/// In Error
/// </summary>
InError = 3
}
/// <summary>
/// Represents a MonitorStatusChangeEventArgs
/// </summary>
public class MonitorStatusChangeEventArgs : EventArgs
{
/// <summary>
/// Gets or sets the Status
/// </summary>
/// <summary>
/// Gets or sets the Status
/// </summary>
public MonitorStatus Status { get; private set; }
/// <summary>
/// Gets or sets the Message
/// </summary>
/// <summary>
/// Gets or sets the Message
/// </summary>
public string Message { get; private set; }
/// <summary>
/// Constructor for MonitorStatusChangeEventArgs
/// </summary>
/// <param name="status">monitor status</param>
public MonitorStatusChangeEventArgs(MonitorStatus status)
{
Status = status;
Message = status == MonitorStatus.IsOk ? "" : status.ToString();
}
/// <summary>
/// Constructor for MonitorStatusChangeEventArgs
/// </summary>
/// <param name="status">monitor status</param>
/// <param name="message">status message</param>
public MonitorStatusChangeEventArgs(MonitorStatus status, string message)
{
Status = status;

View file

@ -13,8 +13,14 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Base class for status monitors
/// </summary>
public abstract class StatusMonitorBase : IStatusMonitor, IKeyName
{
/// <summary>
/// Event fired when status changes
/// </summary>
public event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
/// <summary>
@ -27,15 +33,24 @@ namespace PepperDash.Essentials.Core
/// </summary>
public string Name { get { return "Comm. monitor"; } }
/// <summary>
/// Gets or sets the Parent
/// </summary>
/// <summary>
/// Gets or sets the Parent
/// </summary>
public IKeyed Parent { get; private set; }
/// <summary>
/// Bool feedback for online status
/// </summary>
public BoolFeedback IsOnlineFeedback { get; set; }
/// <summary>
/// Indicates whether the monitored device is online
/// </summary>
public bool IsOnline;
/// <summary>
/// Current monitor status
/// </summary>
public MonitorStatus Status
{
get { return _Status; }
@ -51,6 +66,9 @@ namespace PepperDash.Essentials.Core
}
MonitorStatus _Status;
/// <summary>
/// Current status message
/// </summary>
public string Message
{
get { return _Message; }
@ -69,6 +87,12 @@ namespace PepperDash.Essentials.Core
CTimer WarningTimer;
CTimer ErrorTimer;
/// <summary>
/// Constructor
/// </summary>
/// <param name="parent">parent device</param>
/// <param name="warningTime">time in milliseconds before warning status</param>
/// <param name="errorTime">time in milliseconds before error status</param>
public StatusMonitorBase(IKeyed parent, long warningTime, long errorTime)
{
Parent = parent;
@ -83,9 +107,20 @@ namespace PepperDash.Essentials.Core
ErrorTime = errorTime;
}
/// <summary>
/// Starts the monitor
/// </summary>
public abstract void Start();
/// <summary>
/// Stops the monitor
/// </summary>
public abstract void Stop();
/// <summary>
/// Fires the StatusChange event
/// </summary>
/// <param name="status">monitor status</param>
protected void OnStatusChange(MonitorStatus status)
{
if (_Status == MonitorStatus.IsOk)
@ -98,6 +133,11 @@ namespace PepperDash.Essentials.Core
handler(this, new MonitorStatusChangeEventArgs(status));
}
/// <summary>
/// Fires the StatusChange event with message
/// </summary>
/// <param name="status">monitor status</param>
/// <param name="message">status message</param>
protected void OnStatusChange(MonitorStatus status, string message)
{
if (_Status == MonitorStatus.IsOk)
@ -110,12 +150,18 @@ namespace PepperDash.Essentials.Core
handler(this, new MonitorStatusChangeEventArgs(status, message));
}
/// <summary>
/// Starts the error timers
/// </summary>
protected void StartErrorTimers()
{
if (WarningTimer == null) WarningTimer = new CTimer(o => { Status = MonitorStatus.InWarning; }, WarningTime);
if (ErrorTimer == null) ErrorTimer = new CTimer(o => { Status = MonitorStatus.InError; }, ErrorTime);
}
/// <summary>
/// Stops the error timers
/// </summary>
protected void StopErrorTimers()
{
if (WarningTimer != null) WarningTimer.Stop();
@ -124,6 +170,9 @@ namespace PepperDash.Essentials.Core
ErrorTimer = null;
}
/// <summary>
/// Resets the error timers
/// </summary>
protected void ResetErrorTimers()
{
if(WarningTimer != null)

View file

@ -14,41 +14,51 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// Collection class for multiple status monitors
/// </summary>
public class StatusMonitorCollection : IStatusMonitor
{
/// <summary>
/// Gets or sets the Parent
/// </summary>
public IKeyed Parent { get; private set; }
List<IStatusMonitor> Monitors = new List<IStatusMonitor>();
#region IStatusMonitor Members
/// <summary>
/// Event fired when status changes
/// </summary>
public event EventHandler<MonitorStatusChangeEventArgs> StatusChange;
/// <summary>
/// Gets or sets the Status
/// </summary>
/// <summary>
/// Gets or sets the Status
/// </summary>
public MonitorStatus Status { get; protected set; }
/// <summary>
/// Gets or sets the Message
/// </summary>
/// <summary>
/// Gets or sets the Message
/// </summary>
public string Message { get; private set; }
/// <summary>
/// Gets or sets the IsOnlineFeedback
/// </summary>
/// <summary>
/// Gets or sets the IsOnlineFeedback
/// </summary>
public BoolFeedback IsOnlineFeedback { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="parent">parent device</param>
public StatusMonitorCollection(IKeyed parent)
{
Parent = parent;
}
/// <summary>
/// Start method
/// </summary>
/// <summary>
/// Start method
/// </summary>
public void Start()
{
foreach (var mon in Monitors)
@ -145,7 +155,11 @@ namespace PepperDash.Essentials.Core
Monitors.Add(monitor);
}
/// <summary>
/// Fires the StatusChange event
/// </summary>
/// <param name="status">monitor status</param>
/// <param name="message">status message</param>
protected void OnStatusChange(MonitorStatus status, string message)
{
var handler = StatusChange;

View file

@ -26,15 +26,26 @@ namespace PepperDash.Essentials.Core.Monitoring
private string _uptime;
private string _lastStart;
/// <summary>
/// Event fired when any SystemMonitor property changes
/// </summary>
public event EventHandler<EventArgs> SystemMonitorPropertiesChanged;
/// <summary>
/// Gets or sets the ProgramStatusFeedbackCollection
/// </summary>
public Dictionary<uint, ProgramStatusFeedbacks> ProgramStatusFeedbackCollection;
/// <summary>
/// Gets or sets the EthernetStatusFeedbackCollection
/// </summary>
public Dictionary<short, EthernetStatusFeedbacks> EthernetStatusFeedbackCollection;
/// <summary>
/// Gets or sets the TimeZoneFeedback
/// </summary>
public IntFeedback TimeZoneFeedback { get; protected set; }
/// <summary>
/// Gets or sets the TimeZoneTextFeedback
/// </summary>
@ -44,14 +55,17 @@ namespace PepperDash.Essentials.Core.Monitoring
/// Gets or sets the IoControllerVersionFeedback
/// </summary>
public StringFeedback IoControllerVersionFeedback { get; protected set; }
/// <summary>
/// Gets or sets the SnmpVersionFeedback
/// </summary>
public StringFeedback SnmpVersionFeedback { get; protected set; }
/// <summary>
/// Gets or sets the BaCnetAppVersionFeedback
/// </summary>
public StringFeedback BaCnetAppVersionFeedback { get; protected set; }
/// <summary>
/// Gets or sets the ControllerVersionFeedback
/// </summary>
@ -62,6 +76,7 @@ namespace PepperDash.Essentials.Core.Monitoring
/// Gets or sets the SerialNumberFeedback
/// </summary>
public StringFeedback SerialNumberFeedback { get; protected set; }
/// <summary>
/// Gets or sets the ModelFeedback
/// </summary>
@ -71,30 +86,34 @@ namespace PepperDash.Essentials.Core.Monitoring
/// Gets or sets the UptimeFeedback
/// </summary>
public StringFeedback UptimeFeedback { get; set; }
/// <summary>
/// Gets or sets the LastStartFeedback
/// </summary>
public StringFeedback LastStartFeedback { get; set; }
/// <summary>
/// Gets or sets the IsApplianceFeedback
/// </summary>
/// <summary>
/// Gets or sets the IsApplianceFeedback
/// </summary>
public BoolFeedback IsApplianceFeedback { get; protected set; }
private bool _isApplianceFb
{
get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance; }
}
/// <summary>
/// Gets or sets the IsServerFeedback
/// </summary>
/// <summary>
/// Gets or sets the IsServerFeedback
/// </summary>
public BoolFeedback IsServerFeedback { get; protected set; }
private bool _isServerFb
{
get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Server; }
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="key">device key</param>
public SystemMonitorController(string key)
: base(key)
{
@ -464,55 +483,71 @@ namespace PepperDash.Essentials.Core.Monitoring
OnSystemMonitorPropertiesChanged();
}
/// <summary>
/// Represents an EthernetStatusFeedbacks
/// </summary>
public class EthernetStatusFeedbacks
{
/// <summary>
/// Gets or sets the HostNameFeedback
/// </summary>
public StringFeedback HostNameFeedback { get; protected set; }
/// <summary>
/// Gets or sets the DnsServerFeedback
/// </summary>
public StringFeedback DnsServerFeedback { get; protected set; }
/// <summary>
/// Gets or sets the DomainFeedback
/// </summary>
public StringFeedback DomainFeedback { get; protected set; }
/// <summary>
/// Gets or sets the MacAddressFeedback
/// </summary>
public StringFeedback MacAddressFeedback { get; protected set; }
/// <summary>
/// Gets or sets the DhcpStatusFeedback
/// </summary>
public StringFeedback DhcpStatusFeedback { get; protected set; }
/// <summary>
/// Gets or sets the CurrentIpAddressFeedback
/// </summary>
public StringFeedback CurrentIpAddressFeedback { get; protected set; }
/// <summary>
/// Gets or sets the CurrentSubnetMaskFeedback
/// </summary>
public StringFeedback CurrentSubnetMaskFeedback { get; protected set; }
/// <summary>
/// Gets or sets the CurrentDefaultGatewayFeedback
/// </summary>
public StringFeedback CurrentDefaultGatewayFeedback { get; protected set; }
/// <summary>
/// Gets or sets the StaticIpAddressFeedback
/// </summary>
public StringFeedback StaticIpAddressFeedback { get; protected set; }
/// <summary>
/// Gets or sets the StaticSubnetMaskFeedback
/// </summary>
public StringFeedback StaticSubnetMaskFeedback { get; protected set; }
/// <summary>
/// Gets or sets the StaticDefaultGatewayFeedback
/// </summary>
public StringFeedback StaticDefaultGatewayFeedback { get; protected set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="adapterIndex">index of the ethernet addapter</param>
public EthernetStatusFeedbacks(short adapterIndex)
{
Debug.LogMessage(LogEventLevel.Verbose, "Ethernet Information for interface {0}", adapterIndex);
@ -621,6 +656,9 @@ namespace PepperDash.Essentials.Core.Monitoring
/// </summary>
public class ProgramStatusFeedbacks
{
/// <summary>
/// Event fired when ProgramInfo changes
/// </summary>
public event EventHandler<ProgramInfoEventArgs> ProgramInfoChanged;
/// <summary>
@ -637,14 +675,17 @@ namespace PepperDash.Essentials.Core.Monitoring
/// Gets or sets the ProgramStartedFeedback
/// </summary>
public BoolFeedback ProgramStartedFeedback;
/// <summary>
/// Gets or sets the ProgramStoppedFeedback
/// </summary>
public BoolFeedback ProgramStoppedFeedback;
/// <summary>
/// Gets or sets the ProgramRegisteredFeedback
/// </summary>
public BoolFeedback ProgramRegisteredFeedback;
/// <summary>
/// Gets or sets the ProgramUnregisteredFeedback
/// </summary>
@ -654,24 +695,32 @@ namespace PepperDash.Essentials.Core.Monitoring
/// Gets or sets the ProgramNameFeedback
/// </summary>
public StringFeedback ProgramNameFeedback;
/// <summary>
/// Gets or sets the ProgramCompileTimeFeedback
/// </summary>
public StringFeedback ProgramCompileTimeFeedback;
/// <summary>
/// Gets or sets the CrestronDataBaseVersionFeedback
/// </summary>
public StringFeedback CrestronDataBaseVersionFeedback;
// SIMPL windows version
/// <summary>
/// Gets or sets the EnvironmentVersionFeedback
/// </summary>
public StringFeedback EnvironmentVersionFeedback;
/// <summary>
/// Gets or sets the AggregatedProgramInfoFeedback
/// </summary>
public StringFeedback AggregatedProgramInfoFeedback;
/// <summary>
/// Constructor
/// </summary>
/// <param name="program">program to get status about</param>
public ProgramStatusFeedbacks(Program program)
{
ProgramInfo = new ProgramInfo(program.Number);
@ -863,38 +912,47 @@ namespace PepperDash.Essentials.Core.Monitoring
{
// Shared properties
/// <summary>
/// Gets the ProgramNumber
/// </summary>
[JsonProperty("programNumber")]
public uint ProgramNumber { get; private set; }
/// <summary>
/// Gets or sets the OperatingState
/// </summary>
[JsonConverter(typeof (StringEnumConverter))]
[JsonProperty("operatingState")]
public eProgramOperatingState OperatingState { get; set; }
[JsonConverter(typeof (StringEnumConverter))]
[JsonProperty("registrationState")]
/// <summary>
/// Gets or sets the RegistrationState
/// </summary>
[JsonConverter(typeof (StringEnumConverter))]
[JsonProperty("registrationState")]
public eProgramRegistrationState RegistrationState { get; set; }
[JsonProperty("programFile")]
/// <summary>
/// Gets or sets the ProgramFile
/// </summary>
[JsonProperty("programFile")]
public string ProgramFile { get; set; }
[JsonProperty("friendlyName")]
/// <summary>
/// Gets or sets the FriendlyName
/// </summary>
[JsonProperty("friendlyName")]
public string FriendlyName { get; set; }
[JsonProperty("compilerRevision")]
/// <summary>
/// Gets or sets the CompilerRevision
/// </summary>
[JsonProperty("compilerRevision")]
public string CompilerRevision { get; set; }
/// <summary>
/// Gets the CompilerRevisionInfo
/// </summary>
[JsonIgnore]
public Version CompilerRevisionInfo
{
@ -904,69 +962,75 @@ namespace PepperDash.Essentials.Core.Monitoring
}
}
[JsonProperty("compileTime")]
/// <summary>
/// Gets or sets the CompileTime
/// </summary>
[JsonProperty("compileTime")]
public string CompileTime { get; set; }
[JsonProperty("include4Dat")]
/// <summary>
/// Gets or sets the Include4Dat
/// </summary>
[JsonProperty("include4Dat")]
public string Include4Dat { get; set; }
// SIMPL Windows properties
[JsonProperty("systemName")]
/// <summary>
/// Gets or sets the SystemName
/// </summary>
[JsonProperty("systemName")]
public string SystemName { get; set; }
[JsonProperty("crestronDb")]
/// <summary>
/// Gets or sets the CrestronDb
/// </summary>
[JsonProperty("crestronDb")]
public string CrestronDb { get; set; }
[JsonProperty("environment")]
/// <summary>
/// Gets or sets the Environment
/// </summary>
[JsonProperty("environment")]
public string Environment { get; set; }
[JsonProperty("programmer")]
/// <summary>
/// Gets or sets the Programmer
/// </summary>
[JsonProperty("programmer")]
public string Programmer { get; set; }
// SSP Properties
[JsonProperty("applicationName")]
/// <summary>
/// Gets or sets the ApplicationName
/// </summary>
[JsonProperty("applicationName")]
public string ApplicationName { get; set; }
[JsonProperty("programTool")]
/// <summary>
/// Gets or sets the ProgramTool
/// </summary>
[JsonProperty("programTool")]
public string ProgramTool { get; set; }
[JsonProperty("minFirmwareVersion")]
/// <summary>
/// Gets or sets the MinFirmwareVersion
/// </summary>
[JsonProperty("minFirmwareVersion")]
public string MinFirmwareVersion { get; set; }
[JsonProperty("plugInVersion")]
/// <summary>
/// Gets or sets the PlugInVersion
/// </summary>
[JsonProperty("plugInVersion")]
public string PlugInVersion { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="number">program slot to get info about</param>
public ProgramInfo(uint number)
{
ProgramNumber = number;
@ -999,6 +1063,10 @@ namespace PepperDash.Essentials.Core.Monitoring
/// </summary>
public ProgramInfo ProgramInfo;
/// <summary>
/// Constructor
/// </summary>
/// <param name="progInfo">program info</param>
public ProgramInfoEventArgs(ProgramInfo progInfo)
{
ProgramInfo = progInfo;