mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Merge pull request #1070 from PepperDash/feature/system-monitor-bridge-updates
System Monitor Bridge updates
This commit is contained in:
@@ -132,6 +132,23 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
public JoinDataComplete DhcpStatus = new JoinDataComplete(new JoinData { JoinNumber = 86, JoinSpan = 1 },
|
public JoinDataComplete DhcpStatus = new JoinDataComplete(new JoinData { JoinNumber = 86, JoinSpan = 1 },
|
||||||
new JoinMetadata { Description = "Processor Ethernet Dhcp Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
new JoinMetadata { Description = "Processor Ethernet Dhcp Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||||
|
|
||||||
|
[JoinName("ProcessorRebot")]
|
||||||
|
public JoinDataComplete ProcessorReboot = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Reboot processor", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IsAppliance")]
|
||||||
|
public JoinDataComplete IsAppliance = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Is appliance Fb", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("IsServer")]
|
||||||
|
public JoinDataComplete IsServer = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Is server Fb", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
[JoinName("ProgramReset")]
|
||||||
|
public JoinDataComplete ProgramReset = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
|
||||||
|
new JoinMetadata { Description = "Resets the program", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -43,7 +43,20 @@ namespace PepperDash.Essentials.Core.Monitoring
|
|||||||
public StringFeedback UptimeFeedback { get; set; }
|
public StringFeedback UptimeFeedback { get; set; }
|
||||||
public StringFeedback LastStartFeedback { get; set; }
|
public StringFeedback LastStartFeedback { get; set; }
|
||||||
|
|
||||||
public SystemMonitorController(string key)
|
public BoolFeedback IsApplianceFeedback { get; protected set; }
|
||||||
|
private bool _isApplianceFb
|
||||||
|
{
|
||||||
|
get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoolFeedback IsServerFeedback { get; protected set; }
|
||||||
|
private bool _isServerFb
|
||||||
|
{
|
||||||
|
get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Server; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SystemMonitorController(string key)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Adding SystemMonitorController.");
|
Debug.Console(2, this, "Adding SystemMonitorController.");
|
||||||
@@ -63,6 +76,9 @@ namespace PepperDash.Essentials.Core.Monitoring
|
|||||||
UptimeFeedback = new StringFeedback(() => _uptime);
|
UptimeFeedback = new StringFeedback(() => _uptime);
|
||||||
LastStartFeedback = new StringFeedback(()=> _lastStart);
|
LastStartFeedback = new StringFeedback(()=> _lastStart);
|
||||||
|
|
||||||
|
IsApplianceFeedback = new BoolFeedback(() => _isApplianceFb);
|
||||||
|
IsServerFeedback = new BoolFeedback(() => _isServerFb);
|
||||||
|
|
||||||
ProgramStatusFeedbackCollection = new Dictionary<uint, ProgramStatusFeedbacks>();
|
ProgramStatusFeedbackCollection = new Dictionary<uint, ProgramStatusFeedbacks>();
|
||||||
|
|
||||||
foreach (var prog in SystemMonitor.ProgramCollection)
|
foreach (var prog in SystemMonitor.ProgramCollection)
|
||||||
@@ -123,6 +139,26 @@ namespace PepperDash.Essentials.Core.Monitoring
|
|||||||
_uptime = uptimeRaw.Substring(forIndex + 4);
|
_uptime = uptimeRaw.Substring(forIndex + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ProcessorReboot()
|
||||||
|
{
|
||||||
|
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) return;
|
||||||
|
|
||||||
|
var response = string.Empty;
|
||||||
|
CrestronConsole.SendControlSystemCommand("reboot", ref response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProgramReset(uint index)
|
||||||
|
{
|
||||||
|
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) return;
|
||||||
|
|
||||||
|
if (index <= 0 || index > 10) return;
|
||||||
|
|
||||||
|
var cmd = string.Format("progreset -p:{0}", index);
|
||||||
|
|
||||||
|
var response = string.Empty;
|
||||||
|
CrestronConsole.SendControlSystemCommand(cmd, ref response);
|
||||||
|
}
|
||||||
|
|
||||||
private void CrestronEnvironmentOnEthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
private void CrestronEnvironmentOnEthernetEventHandler(EthernetEventArgs ethernetEventArgs)
|
||||||
{
|
{
|
||||||
if (ethernetEventArgs.EthernetEventType != eEthernetEventType.LinkUp) return;
|
if (ethernetEventArgs.EthernetEventType != eEthernetEventType.LinkUp) return;
|
||||||
@@ -185,6 +221,9 @@ namespace PepperDash.Essentials.Core.Monitoring
|
|||||||
SerialNumberFeedback.FireUpdate();
|
SerialNumberFeedback.FireUpdate();
|
||||||
ModelFeedback.FireUpdate();
|
ModelFeedback.FireUpdate();
|
||||||
|
|
||||||
|
IsApplianceFeedback.FireUpdate();
|
||||||
|
IsServerFeedback.FireUpdate();
|
||||||
|
|
||||||
OnSystemMonitorPropertiesChanged();
|
OnSystemMonitorPropertiesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +276,11 @@ namespace PepperDash.Essentials.Core.Monitoring
|
|||||||
UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime.JoinNumber]);
|
UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime.JoinNumber]);
|
||||||
LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot.JoinNumber]);
|
LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot.JoinNumber]);
|
||||||
|
|
||||||
|
trilist.SetSigHeldAction(joinMap.ProcessorReboot.JoinNumber, 10000, ProcessorReboot);
|
||||||
|
|
||||||
|
IsApplianceFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsAppliance.JoinNumber]);
|
||||||
|
IsServerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsServer.JoinNumber]);
|
||||||
|
|
||||||
// iterate the program status feedback collection and map all the joins
|
// iterate the program status feedback collection and map all the joins
|
||||||
LinkProgramInfoJoins(this, trilist, joinMap);
|
LinkProgramInfoJoins(this, trilist, joinMap);
|
||||||
|
|
||||||
@@ -301,11 +345,13 @@ namespace PepperDash.Essentials.Core.Monitoring
|
|||||||
p.Value.AggregatedProgramInfoFeedback.LinkInputSig(
|
p.Value.AggregatedProgramInfoFeedback.LinkInputSig(
|
||||||
trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo.JoinNumber]);
|
trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo.JoinNumber]);
|
||||||
|
|
||||||
|
trilist.SetSigHeldAction(programSlotJoinStart + joinMap.ProgramReset.JoinNumber, 10000, () => ProgramReset(programNumber));
|
||||||
|
|
||||||
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin.JoinSpan;
|
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin.JoinSpan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Sets the time zone
|
//// Sets the time zone
|
||||||
//public void SetTimeZone(int timeZone)
|
//public void SetTimeZone(int timeZone)
|
||||||
//{
|
//{
|
||||||
// SystemMonitor.TimeZoneInformation.TimeZoneNumber = timeZone;
|
// SystemMonitor.TimeZoneInformation.TimeZoneNumber = timeZone;
|
||||||
|
|||||||
Reference in New Issue
Block a user