diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 57cd454e..fb10a055 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -91,6 +91,9 @@ namespace PepperDash.Essentials }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts, + "getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator); + if (!Debug.DoNotLoadOnNextBoot) { GoWithLoad(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index dfc63911..d50de428 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -337,7 +337,36 @@ namespace PepperDash.Essentials.Core return; } com.SimulateReceive(match.Groups[2].Value); - } + } + + /// + /// Prints a list of routing inputs and outputs by device key. + /// + /// Device key from which to report data + public static void GetRoutingPorts(string s) + { + var device = GetDeviceForKey(s); + + if (device == null) return; + var inputPorts = (device as IRoutingInputsOutputs).InputPorts; + var outputPorts = (device as IRoutingInputsOutputs).OutputPorts; + if (inputPorts != null) + { + Debug.Console(0, "Device {0} has {1} Input Ports:", s, inputPorts.Count); + foreach (var routingInputPort in inputPorts) + { + Debug.Console(0, "{0}", routingInputPort.Key); + } + } + if (outputPorts != null) + { + Debug.Console(0, "Device {0} has {1} Output Ports:", s, outputPorts.Count); + foreach (var routingOutputPort in outputPorts) + { + Debug.Console(0, "{0}", routingOutputPort.Key); + } + } + } /// /// Attempts to set the debug level of a device diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index b523d2c8..eadaab12 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -1,5 +1,6 @@ using System; -using System.Collections.Generic; +using System.Collections.Generic; +using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.Diagnostics; @@ -100,25 +101,28 @@ namespace PepperDash.Essentials.Core.Monitoring UptimeFeedback.FireUpdate(); LastStartFeedback.FireUpdate(); - } - - private void ParseUptime(string response) - { - var splitString = response.Trim().Split('\r', '\n'); - - var lastStartRaw = splitString[2]; - var lastStartIndex = lastStartRaw.IndexOf(':'); - - _lastStart = lastStartRaw.Substring(lastStartIndex + 1).Trim(); - - var uptimeRaw = splitString[0]; - - var forIndex = uptimeRaw.IndexOf("for", StringComparison.Ordinal); - - //4 => "for " to get what's on the right - _uptime = uptimeRaw.Substring(forIndex + 4); - } - + } + + private void ParseUptime(string response) + { + var splitString = response.Trim().Split('\r', '\n'); + + var lastStartRaw = splitString.FirstOrDefault(o => o.Contains("started")); + var uptimeRaw = splitString.FirstOrDefault(o => o.Contains("running")); + + if (!String.IsNullOrEmpty(lastStartRaw)) + { + var lastStartIndex = lastStartRaw.IndexOf(':'); + _lastStart = lastStartRaw.Substring(lastStartIndex + 1).Trim(); + } + + if (String.IsNullOrEmpty(uptimeRaw)) return; + var forIndex = uptimeRaw.IndexOf("for", StringComparison.Ordinal); + + //4 => "for " to get what's on the right + _uptime = uptimeRaw.Substring(forIndex + 4); + } + private void CrestronEnvironmentOnEthernetEventHandler(EthernetEventArgs ethernetEventArgs) { if (ethernetEventArgs.EthernetEventType != eEthernetEventType.LinkUp) return; diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index b64665a6..18cb0c27 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit b64665a60ebfa8cd4dc680acccb3ef0d94cbbf82 +Subproject commit 18cb0c273eb8b750f657d74160ad82eff1b24bca