Compare commits

...

12 Commits

Author SHA1 Message Date
Andrew Welker
534110cfbf updates XML comments for bool & string feedbacks 2020-03-25 15:07:47 -06:00
Andrew Welker
cbe96dbed9 Adds XML comments to constructors for Int, String, and Bool Feedbacks 2020-03-25 15:07:47 -06:00
Andrew Welker
e2fe8834c5 adds Uptime and LastBoot console parsing and reporting
* refactored ProgramInfo routine to not send console commands for unregistered or stopped programs and inverted some if statements
2020-03-25 15:07:47 -06:00
Andrew Welker
93e542befd adds bridging for all ethernet parameters 2020-03-25 15:07:47 -06:00
Andrew Welker
3852617270 adds DhcpEnabled feedback to SystemMonitor 2020-03-25 15:07:47 -06:00
Andrew Welker
d7a04e202b adds logic to get required parameters using built-in Crestron classes 2020-03-25 15:07:46 -06:00
Andrew Welker
abd6ab121e adding logic to get the requested data 2020-03-25 15:07:46 -06:00
Andrew Welker
0c274015dd created new feedback properties and intialized them 2020-03-25 15:07:46 -06:00
Andrew Welker
ffc0f8f58e cleans up formatting 2020-03-25 15:07:46 -06:00
Andrew Welker
c47f7ba7e3 code cleanup to match new standars 2020-03-25 15:07:46 -06:00
Neil Dorin
58c3c4fac7 Merge pull request #72 from PepperDash/feature/add-docker-build-action
adds logic to rename .cpz to add version...
2020-03-24 17:06:45 -06:00
Andrew Welker
82ddd40953 adds logic to rename .cpz to add version...
...& points to different repo for create release action
2020-03-24 16:55:20 -06:00
10 changed files with 582 additions and 206 deletions

View File

@@ -26,7 +26,7 @@ Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz
} | Copy-Item -Destination ($destination) -Force
Write-Host "Getting matching files..."
# Get any files from the output folder that match the following extensions
Get-ChildItem -Path $destination | Where-Object {($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz"))} | ForEach-Object {
Get-ChildItem -Path $destination | Where-Object { ($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz")) } | ForEach-Object {
# Replace the extensions with dll and xml and create an array
$filenames = @($($_ -replace "cpz|clz|cplz", "dll"), $($_ -replace "cpz|clz|cplz", "xml"))
Write-Host "Filenames:"
@@ -36,6 +36,8 @@ Get-ChildItem -Path $destination | Where-Object {($_.Extension -eq ".clz") -or (
Get-ChildItem -Recurse -Path "$($Env:GITHUB_WORKSPACE)" -include $filenames | Copy-Item -Destination ($destination) -Force
}
}
Get-ChildItem -Path $destination\*.cpz | Rename-Item -NewName { "$($_.BaseName)-$($Env:VERSION)$($_.Extension)" }
Compress-Archive -Path $destination -DestinationPath "$($Env:GITHUB_WORKSPACE)\$($Env:SOLUTION_FILE)-$($Env:VERSION).zip" -Force
Write-Host "Output Contents post Zip"
Get-ChildItem -Path $destination

View File

@@ -78,7 +78,8 @@ jobs:
# Create the release on the source repo
- name: Create Release
id: create_release
uses: actions/create-release@v1
# using contributor's version to allow for pointing at the right commit
uses: fleskesvor/create-release@feature/support-target-commitish
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}

View File

@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Monitoring;
@@ -23,11 +17,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
SysMon = sysMon;
SysMon.SystemMonitorPropertiesChanged += new EventHandler<EventArgs>(SysMon_SystemMonitorPropertiesChanged);
SysMon.SystemMonitorPropertiesChanged += SysMon_SystemMonitorPropertiesChanged;
foreach (var p in SysMon.ProgramStatusFeedbackCollection)
{
p.Value.ProgramInfoChanged += new EventHandler<ProgramInfoEventArgs>(ProgramInfoChanged);
p.Value.ProgramInfoChanged += ProgramInfoChanged;
}
CrestronConsole.AddNewConsoleCommand(s => SendFullStatusMessage(), "SendFullSysMonStatus", "Sends the full System Monitor Status", ConsoleAccessLevelEnum.AccessOperator);
@@ -72,18 +66,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
Debug.Console(1, "Posting System Monitor Status Message.");
// This takes a while, launch a new thread
CrestronInvoke.BeginInvoke((o) =>
CrestronInvoke.BeginInvoke(o => PostStatusMessage(new
{
PostStatusMessage(new
{
timeZone = SysMon.TimeZoneFeedback.IntValue,
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
ioControllerVersion = SysMon.IOControllerVersionFeedback.StringValue,
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
bacnetVersion = SysMon.BACnetAppVersionFeedback.StringValue,
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
});
});
timeZone = SysMon.TimeZoneFeedback.IntValue,
timeZoneName = SysMon.TimeZoneTextFeedback.StringValue,
ioControllerVersion = SysMon.IoControllerVersionFeedback.StringValue,
snmpVersion = SysMon.SnmpVersionFeedback.StringValue,
bacnetVersion = SysMon.BaCnetAppVersionFeedback.StringValue,
controllerVersion = SysMon.ControllerVersionFeedback.StringValue
}));
}
protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController)

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Bridges
{
@@ -14,11 +9,21 @@ namespace PepperDash.Essentials.Bridges
/// </summary>
public uint ProgramStartJoin { get; set; }
/// <summary>
/// Offset to indicate where the range of iterated Ethernet joins will start
/// </summary>
public uint EthernetStartJoin { get; set; }
/// <summary>
/// Offset between each program join set
/// </summary>
public uint ProgramOffsetJoin { get; set; }
/// <summary>
/// Offset between each Ethernet Interface join set
/// </summary>
public uint EthernetOffsetJoin { get; set; }
#region Digitals
/// <summary>
/// Range Sets and reports whether the corresponding program slot is started
@@ -87,6 +92,68 @@ namespace PepperDash.Essentials.Bridges
/// Serialized JSON output that aggregates the program info of the corresponding program
/// </summary>
public uint AggregatedProgramInfo { get; set; }
/// <summary>
/// Reports the controller serial number
/// </summary>
public uint SerialNumber { get; set; }
/// <summary>
/// Reports the controller model
/// </summary>
public uint Model { get; set; }
/// <summary>
/// Reports the Host name set on the corresponding interface
/// </summary>
public uint HostName { get; set; }
/// <summary>
/// Reports the Current IP address set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned address.
/// </summary>
public uint CurrentIpAddress { get; set; }
/// <summary>
/// Reporst the Current Default Gateway set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned gateway
/// </summary>
public uint CurrentDefaultGateway { get; set; }
/// <summary>
/// Reports the Current Subnet Mask set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned subnet mask
/// </summary>
public uint CurrentSubnetMask { get; set; }
/// <summary>
/// Reports the Static IP address set on the corresponding interface. If DHCP is disabled, this will match the Current IP address
/// </summary>
public uint StaticIpAddress { get; set; }
/// <summary>
/// Reporst the Static Default Gateway set on the corresponding interface. If DHCP is disabled, this will match the Current gateway
/// </summary>
public uint StaticDefaultGateway { get; set; }
/// <summary>
/// Reports the Current Subnet Mask set on the corresponding interface. If DHCP is enabled, this will be the DHCP assigned subnet mask
/// </summary>
public uint StaticSubnetMask { get; set; }
/// <summary>
/// Reports the current DomainFeedback on the corresponding interface
/// </summary>
public uint Domain { get; set; }
/// <summary>
/// Reports the current DNS Servers on the corresponding interface
/// </summary>
public uint DnsServer { get; set; }
/// <summary>
/// Reports the MAC Address of the corresponding interface
/// </summary>
public uint MacAddress { get; set; }
/// <summary>
/// Reports the DHCP Status of the corresponding interface
/// </summary>
public uint DhcpStatus { get; set; }
/// <summary>
/// Reports the current uptime. Updated in 5 minute intervals.
/// </summary>
public uint Uptime { get; set; }
/// <summary>
/// Reports the date of the last boot
/// </summary>
public uint LastBoot { get; set; }
#endregion
public SystemMonitorJoinMap()
@@ -98,6 +165,10 @@ namespace PepperDash.Essentials.Bridges
SnmpAppVersion = 3;
BACnetAppVersion = 4;
ControllerVersion = 5;
SerialNumber = 6;
Model = 7;
Uptime = 8;
LastBoot = 9;
ProgramStartJoin = 10;
@@ -115,6 +186,23 @@ namespace PepperDash.Essentials.Bridges
ProgramCrestronDatabaseVersion = 3;
ProgramEnvironmentVersion = 4;
AggregatedProgramInfo = 5;
EthernetStartJoin = 60;
EthernetOffsetJoin = 15;
// Offset in groups of 15
HostName = 1;
CurrentIpAddress = 2;
CurrentSubnetMask = 3;
CurrentDefaultGateway = 4;
StaticIpAddress = 5;
StaticSubnetMask = 6;
StaticDefaultGateway = 7;
Domain = 8;
DnsServer = 9;
MacAddress = 10;
DhcpStatus = 11;
}
public override void OffsetJoinNumbers(uint joinStart)
@@ -131,6 +219,7 @@ namespace PepperDash.Essentials.Bridges
// Sets the initial join value where the iterated program joins will begin
ProgramStartJoin = ProgramStartJoin + joinOffset;
EthernetStartJoin = EthernetStartJoin + joinOffset;
}
}
}

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.Diagnostics;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -17,7 +12,7 @@ namespace PepperDash.Essentials.Bridges
{
public static void LinkToApi(this SystemMonitorController systemMonitorController, BasicTriList trilist, uint joinStart, string joinMapKey)
{
SystemMonitorJoinMap joinMap = new SystemMonitorJoinMap();
var joinMap = new SystemMonitorJoinMap();
var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
@@ -30,36 +25,69 @@ namespace PepperDash.Essentials.Bridges
Debug.Console(2, systemMonitorController, "Linking API starting at join: {0}", joinStart);
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
systemMonitorController.TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]);
systemMonitorController.IOControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]);
systemMonitorController.IoControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion]);
systemMonitorController.SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]);
systemMonitorController.BACnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
systemMonitorController.BaCnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
systemMonitorController.ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion]);
systemMonitorController.SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumber]);
systemMonitorController.ModelFeedback.LinkInputSig(trilist.StringInput[joinMap.Model]);
systemMonitorController.UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime]);
systemMonitorController.LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot]);
// iterate the program status feedback collection and map all the joins
LinkProgramInfoJoins(systemMonitorController, trilist, joinMap);
LinkEthernetInfoJoins(systemMonitorController, trilist, joinMap);
}
private static void LinkEthernetInfoJoins(SystemMonitorController systemMonitorController, BasicTriList trilist, SystemMonitorJoinMap joinMap)
{
var ethernetSlotJoinStart = joinMap.EthernetStartJoin;
foreach (var fb in systemMonitorController.EthernetStatusFeedbackCollection)
{
fb.Value.CurrentIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentIpAddress]);
fb.Value.CurrentSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentSubnetMask]);
fb.Value.CurrentDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.CurrentDefaultGateway]);
fb.Value.StaticIpAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticIpAddress]);
fb.Value.StaticSubnetMaskFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticSubnetMask]);
fb.Value.StaticDefaultGatewayFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.StaticDefaultGateway]);
fb.Value.HostNameFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.HostName]);
fb.Value.MacAddressFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.MacAddress]);
fb.Value.DomainFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.Domain]);
fb.Value.DnsServerFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DnsServer]);
fb.Value.DhcpStatusFeedback.LinkInputSig(trilist.StringInput[ethernetSlotJoinStart + joinMap.DhcpStatus]);
}
}
private static void LinkProgramInfoJoins(SystemMonitorController systemMonitorController, BasicTriList trilist,
SystemMonitorJoinMap joinMap)
{
var programSlotJoinStart = joinMap.ProgramStartJoin;
foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection)
{
var programNumber = p.Value.Program.Number;
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start));
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart,
b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Start);
p.Value.ProgramStartedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStart]);
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop, new Action<bool>
(b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop));
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStop,
b => SystemMonitor.ProgramCollection[programNumber].OperatingState = eProgramOperatingState.Stop);
p.Value.ProgramStoppedFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramStop]);
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister, new Action<bool>
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register));
p.Value.ProgramRegisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]);
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramRegister,
b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Register);
p.Value.ProgramRegisteredFeedback.LinkInputSig(
trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramRegister]);
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister, new Action<bool>
(b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister));
p.Value.ProgramUnregisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]);
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramUnregister,
b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister);
p.Value.ProgramUnregisteredFeedback.LinkInputSig(
trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]);
p.Value.ProgramNameFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramName]);
p.Value.ProgramCompileTimeFeedback.LinkInputSig(

View File

@@ -34,18 +34,34 @@ namespace PepperDash.Essentials.Core
List<Crestron.SimplSharpPro.DeviceSupport.Feedback> LinkedCrestronFeedbacks = new List<Crestron.SimplSharpPro.DeviceSupport.Feedback>();
/// <summary>
/// Creates the feedback with the Func as described.
/// </summary>
/// <remarks>
/// While the linked sig value will be updated with the current value stored when it is linked to a EISC Bridge,
/// it will NOT reflect an actual value from a device until <seealso cref="FireUpdate"/> has been called
/// </remarks>
/// <param name="valueFunc">Delegate to invoke when this feedback needs to be updated</param>
public BoolFeedback(Func<bool> valueFunc)
: this(null, valueFunc)
{
}
/// <summary>
/// Creates the feedback with the Func as described.
/// </summary>
/// <remarks>
/// While the linked sig value will be updated with the current value stored when it is linked to a EISC Bridge,
/// it will NOT reflect an actual value from a device until <seealso cref="FireUpdate"/> has been called
/// </remarks>
/// <param name="key">Key to find this Feedback</param>
/// <param name="valueFunc">Delegate to invoke when this feedback needs to be updated</param>
public BoolFeedback(string key, Func<bool> valueFunc)
: base(key)
{
ValueFunc = valueFunc;
}
public override void FireUpdate()
{
bool newValue = InTestMode ? TestValue : ValueFunc.Invoke();

View File

@@ -23,11 +23,28 @@ namespace PepperDash.Essentials.Core
Func<int> ValueFunc;
List<UShortInputSig> LinkedInputSigs = new List<UShortInputSig>();
/// <summary>
/// Creates the feedback with the Func as described.
/// </summary>
/// <remarks>
/// While the linked sig value will be updated with the current value stored when it is linked to a EISC Bridge,
/// it will NOT reflect an actual value from a device until <seealso cref="FireUpdate"/> has been called
/// </remarks>
/// <param name="valueFunc">Delegate to invoke when this feedback needs to be updated</param>
public IntFeedback(Func<int> valueFunc)
: this(null, valueFunc)
{
}
/// <summary>
/// Creates the feedback with the Func as described.
/// </summary>
/// <remarks>
/// While the linked sig value will be updated with the current value stored when it is linked to a EISC Bridge,
/// it will NOT reflect an actual value from a device until <seealso cref="FireUpdate"/> has been called
/// </remarks>
/// <param name="key">Key to find this Feedback</param>
/// <param name="valueFunc">Delegate to invoke when this feedback needs to be updated</param>
public IntFeedback(string key, Func<int> valueFunc)
: base(key)
{

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharpPro;
namespace PepperDash.Essentials.Core
{
public class StringFeedback : Feedback
{
public override string StringValue { get { return _StringValue; } } // ValueFunc.Invoke(); } }
@@ -18,16 +19,33 @@ namespace PepperDash.Essentials.Core
public string TestValue { get; private set; }
/// <summary>
/// Evalutated on FireUpdate
/// Evaluated on FireUpdate
/// </summary>
public Func<string> ValueFunc { get; private set; }
List<StringInputSig> LinkedInputSigs = new List<StringInputSig>();
/// <summary>
/// Creates the feedback with the Func as described.
/// </summary>
/// <remarks>
/// While the linked sig value will be updated with the current value stored when it is linked to a EISC Bridge,
/// it will NOT reflect an actual value from a device until <seealso cref="FireUpdate"/> has been called
/// </remarks>
/// <param name="valueFunc">Delegate to invoke when this feedback needs to be updated</param>
public StringFeedback(Func<string> valueFunc)
: this(null, valueFunc)
{
}
/// <summary>
/// Creates the feedback with the Func as described.
/// </summary>
/// <remarks>
/// While the linked sig value will be updated with the current value stored when it is linked to a EISC Bridge,
/// it will NOT reflect an actual value from a device until <seealso cref="FireUpdate"/> has been called
/// </remarks>
/// <param name="key">Key to find this Feedback</param>
/// <param name="valueFunc">Delegate to invoke when this feedback needs to be updated</param>
public StringFeedback(string key, Func<string> valueFunc)
: base(key)
{

View File

@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.Diagnostics;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -19,18 +14,32 @@ namespace PepperDash.Essentials.Core.Monitoring
/// </summary>
public class SystemMonitorController : Device
{
private const long UptimePollTime = 300000;
private CTimer _uptimePollTimer;
private string _uptime;
private string _lastStart;
public event EventHandler<EventArgs> SystemMonitorPropertiesChanged;
public Dictionary<uint, ProgramStatusFeedbacks> ProgramStatusFeedbackCollection;
public Dictionary<short, EthernetStatusFeedbacks> EthernetStatusFeedbackCollection;
public IntFeedback TimeZoneFeedback { get; set; }
public StringFeedback TimeZoneTextFeedback { get; set; }
public IntFeedback TimeZoneFeedback { get; protected set; }
public StringFeedback TimeZoneTextFeedback { get; protected set; }
public StringFeedback IoControllerVersionFeedback { get; protected set; }
public StringFeedback SnmpVersionFeedback { get; protected set; }
public StringFeedback BaCnetAppVersionFeedback { get; protected set; }
public StringFeedback ControllerVersionFeedback { get; protected set; }
//new feedbacks. Issue #50
public StringFeedback SerialNumberFeedback { get; protected set; }
public StringFeedback ModelFeedback { get; set; }
public StringFeedback UptimeFeedback { get; set; }
public StringFeedback LastStartFeedback { get; set; }
public StringFeedback IOControllerVersionFeedback { get; set; }
public StringFeedback SnmpVersionFeedback { get; set; }
public StringFeedback BACnetAppVersionFeedback { get; set; }
public StringFeedback ControllerVersionFeedback { get; set; }
public SystemMonitorController(string key)
: base(key)
{
@@ -38,21 +47,18 @@ namespace PepperDash.Essentials.Core.Monitoring
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
//CrestronConsole.AddNewConsoleCommand(RefreshSystemMonitorData, "RefreshSystemMonitor", "Refreshes System Monitor Feedbacks", ConsoleAccessLevelEnum.AccessOperator);
TimeZoneFeedback = new IntFeedback(() => SystemMonitor.TimeZoneInformation.TimeZoneNumber);
TimeZoneTextFeedback = new StringFeedback(() => SystemMonitor.TimeZoneInformation.TimeZoneName);
TimeZoneFeedback = new IntFeedback(new Func<int>( () => SystemMonitor.TimeZoneInformation.TimeZoneNumber));
TimeZoneTextFeedback = new StringFeedback(new Func<string>( () => SystemMonitor.TimeZoneInformation.TimeZoneName));
IoControllerVersionFeedback = new StringFeedback(() => SystemMonitor.VersionInformation.IOPVersion);
SnmpVersionFeedback = new StringFeedback(() => SystemMonitor.VersionInformation.SNMPVersion);
BaCnetAppVersionFeedback = new StringFeedback(() => SystemMonitor.VersionInformation.BACNetVersion);
ControllerVersionFeedback = new StringFeedback(() => SystemMonitor.VersionInformation.ControlSystemVersion);
IOControllerVersionFeedback = new StringFeedback(new Func<string>( () => SystemMonitor.VersionInformation.IOPVersion));
SnmpVersionFeedback = new StringFeedback(new Func<string>( () => SystemMonitor.VersionInformation.SNMPVersion));
BACnetAppVersionFeedback = new StringFeedback(new Func<string>( () => SystemMonitor.VersionInformation.BACNetVersion));
ControllerVersionFeedback = new StringFeedback(new Func<string>( () => SystemMonitor.VersionInformation.ControlSystemVersion));
//var status = string.Format("System Monitor Status: \r TimeZone: {0}\rTimeZoneText: {1}\rIOControllerVersion: {2}\rSnmpAppVersionFeedback: {3}\rBACnetAppVersionFeedback: {4}\rControllerVersionFeedback: {5}",
// SystemMonitor.TimeZoneInformation.TimeZoneNumber, SystemMonitor.TimeZoneInformation.TimeZoneName, SystemMonitor.VersionInformation.IOPVersion, SystemMonitor.VersionInformation.SNMPVersion,
// SystemMonitor.VersionInformation.BACNetVersion, SystemMonitor.VersionInformation.ControlSystemVersion);
//Debug.Console(1, this, status);
SerialNumberFeedback = new StringFeedback(() => CrestronEnvironment.SystemInfo.SerialNumber);
ModelFeedback = new StringFeedback(() => InitialParametersClass.ControllerPromptName);
UptimeFeedback = new StringFeedback(() => _uptime);
LastStartFeedback = new StringFeedback(()=> _lastStart);
ProgramStatusFeedbackCollection = new Dictionary<uint, ProgramStatusFeedbacks>();
@@ -62,43 +68,129 @@ namespace PepperDash.Essentials.Core.Monitoring
ProgramStatusFeedbackCollection.Add(prog.Number, program);
}
SystemMonitor.ProgramChange += new ProgramStateChangeEventHandler(SystemMonitor_ProgramChange);
SystemMonitor.TimeZoneInformation.TimeZoneChange += new TimeZoneChangeEventHandler(TimeZoneInformation_TimeZoneChange);
CreateEthernetStatusFeedbacks();
UpdateEthernetStatusFeeedbacks();
_uptimePollTimer = new CTimer(PollUptime,null,0, UptimePollTime);
SystemMonitor.ProgramChange += SystemMonitor_ProgramChange;
SystemMonitor.TimeZoneInformation.TimeZoneChange += TimeZoneInformation_TimeZoneChange;
CrestronEnvironment.EthernetEventHandler += CrestronEnvironmentOnEthernetEventHandler;
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironmentOnProgramStatusEventHandler;
}
private void CrestronEnvironmentOnProgramStatusEventHandler(eProgramStatusEventType programEventType)
{
if (programEventType != eProgramStatusEventType.Stopping) return;
_uptimePollTimer.Stop();
_uptimePollTimer.Dispose();
_uptimePollTimer = null;
}
private void PollUptime(object obj)
{
var consoleResponse = string.Empty;
CrestronConsole.SendControlSystemCommand("uptime", ref consoleResponse);
ParseUptime(consoleResponse);
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 CrestronEnvironmentOnEthernetEventHandler(EthernetEventArgs ethernetEventArgs)
{
if (ethernetEventArgs.EthernetEventType != eEthernetEventType.LinkUp) return;
foreach (var fb in EthernetStatusFeedbackCollection)
{
fb.Value.UpdateEthernetStatus();
}
}
private void CreateEthernetStatusFeedbacks()
{
EthernetStatusFeedbackCollection = new Dictionary<short, EthernetStatusFeedbacks>();
for (short i = 0; i < InitialParametersClass.NumberOfEthernetInterfaces; i++)
{
var ethernetInterface = new EthernetStatusFeedbacks(i);
EthernetStatusFeedbackCollection.Add(i, ethernetInterface);
}
}
private void UpdateEthernetStatusFeeedbacks()
{
foreach (var iface in EthernetStatusFeedbackCollection)
{
iface.Value.CurrentIpAddressFeedback.FireUpdate();
iface.Value.CurrentSubnetMaskFeedback.FireUpdate();
iface.Value.CurrentDefaultGatewayFeedback.FireUpdate();
iface.Value.StaticIpAddressFeedback.FireUpdate();
iface.Value.StaticSubnetMaskFeedback.FireUpdate();
iface.Value.StaticDefaultGatewayFeedback.FireUpdate();
iface.Value.HostNameFeedback.FireUpdate();
iface.Value.DnsServerFeedback.FireUpdate();
iface.Value.DomainFeedback.FireUpdate();
iface.Value.DhcpStatusFeedback.FireUpdate();
iface.Value.MacAddressFeedback.FireUpdate();
}
}
/// <summary>
/// Gets data in separate thread
/// </summary>
/// <param name="command"></param>
void RefreshSystemMonitorData(string command)
private void RefreshSystemMonitorData()
{
// this takes a while, launch a new thread
CrestronInvoke.BeginInvoke((o) =>
{
TimeZoneFeedback.FireUpdate();
TimeZoneTextFeedback.FireUpdate();
IOControllerVersionFeedback.FireUpdate();
SnmpVersionFeedback.FireUpdate();
BACnetAppVersionFeedback.FireUpdate();
ControllerVersionFeedback.FireUpdate();
OnSystemMonitorPropertiesChanged();
}
);
CrestronInvoke.BeginInvoke(UpdateFeedback);
}
void OnSystemMonitorPropertiesChanged()
private void UpdateFeedback(object o)
{
TimeZoneFeedback.FireUpdate();
TimeZoneTextFeedback.FireUpdate();
IoControllerVersionFeedback.FireUpdate();
SnmpVersionFeedback.FireUpdate();
BaCnetAppVersionFeedback.FireUpdate();
ControllerVersionFeedback.FireUpdate();
SerialNumberFeedback.FireUpdate();
ModelFeedback.FireUpdate();
OnSystemMonitorPropertiesChanged();
}
private void OnSystemMonitorPropertiesChanged()
{
var handler = SystemMonitorPropertiesChanged;
if (handler != null)
{
handler(this, new EventArgs());
handler(this, new EventArgs());
}
}
public override bool CustomActivate()
{
RefreshSystemMonitorData(null);
RefreshSystemMonitorData();
return base.CustomActivate();
}
@@ -114,46 +206,41 @@ namespace PepperDash.Essentials.Core.Monitoring
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void SystemMonitor_ProgramChange(Program sender, ProgramEventArgs args)
private void SystemMonitor_ProgramChange(Program sender, ProgramEventArgs args)
{
Debug.Console(2, this, "Program Change Detected for slot: {0}", sender.Number);
Debug.Console(2, this, "Event Type: {0}", args.EventType);
var program = ProgramStatusFeedbackCollection[sender.Number];
if (args.EventType == eProgramChangeEventType.OperatingState)
switch (args.EventType)
{
program.ProgramStartedFeedback.FireUpdate();
program.ProgramStoppedFeedback.FireUpdate();
program.ProgramInfo.OperatingState = args.OperatingState;
//program.GetProgramInfo();
if (args.OperatingState == eProgramOperatingState.Start)
program.GetProgramInfo();
else
{
program.AggregatedProgramInfoFeedback.FireUpdate();
program.OnProgramInfoChanged();
}
case eProgramChangeEventType.OperatingState:
program.ProgramStartedFeedback.FireUpdate();
program.ProgramStoppedFeedback.FireUpdate();
program.ProgramInfo.OperatingState = args.OperatingState;
if (args.OperatingState == eProgramOperatingState.Start)
program.GetProgramInfo();
else
{
program.AggregatedProgramInfoFeedback.FireUpdate();
program.OnProgramInfoChanged();
}
break;
case eProgramChangeEventType.RegistrationState:
program.ProgramRegisteredFeedback.FireUpdate();
program.ProgramUnregisteredFeedback.FireUpdate();
program.ProgramInfo.RegistrationState = args.RegistrationState;
program.GetProgramInfo();
break;
}
else if (args.EventType == eProgramChangeEventType.RegistrationState)
{
program.ProgramRegisteredFeedback.FireUpdate();
program.ProgramUnregisteredFeedback.FireUpdate();
program.ProgramInfo.RegistrationState = args.RegistrationState;
program.GetProgramInfo();
}
}
/// <summary>
/// Responds to time zone changes and updates the appropriate feedbacks
/// </summary>
/// <param name="args"></param>
void TimeZoneInformation_TimeZoneChange(TimeZoneEventArgs args)
private void TimeZoneInformation_TimeZoneChange(TimeZoneEventArgs args)
{
Debug.Console(2, this, "Time Zone Change Detected.");
TimeZoneFeedback.FireUpdate();
@@ -162,6 +249,98 @@ namespace PepperDash.Essentials.Core.Monitoring
OnSystemMonitorPropertiesChanged();
}
public class EthernetStatusFeedbacks
{
public StringFeedback HostNameFeedback { get; protected set; }
public StringFeedback DnsServerFeedback { get; protected set; }
public StringFeedback DomainFeedback { get; protected set; }
public StringFeedback MacAddressFeedback { get; protected set; }
public StringFeedback DhcpStatusFeedback { get; protected set; }
public StringFeedback CurrentIpAddressFeedback { get; protected set; }
public StringFeedback CurrentSubnetMaskFeedback { get; protected set; }
public StringFeedback CurrentDefaultGatewayFeedback { get; protected set; }
public StringFeedback StaticIpAddressFeedback { get; protected set; }
public StringFeedback StaticSubnetMaskFeedback { get; protected set; }
public StringFeedback StaticDefaultGatewayFeedback { get; protected set; }
public EthernetStatusFeedbacks(short adapterIndex)
{
HostNameFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, adapterIndex));
CurrentIpAddressFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, adapterIndex));
CurrentDefaultGatewayFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, adapterIndex));
CurrentSubnetMaskFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, adapterIndex));
StaticIpAddressFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, adapterIndex));
StaticDefaultGatewayFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, adapterIndex));
StaticSubnetMaskFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, adapterIndex));
DomainFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DOMAIN_NAME, adapterIndex));
DnsServerFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DNS_SERVER, adapterIndex));
MacAddressFeedback =
new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, adapterIndex));
DhcpStatusFeedback = new StringFeedback(
() =>
CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_DHCP_STATE, adapterIndex));
}
public void UpdateEthernetStatus()
{
HostNameFeedback.FireUpdate();
CurrentIpAddressFeedback.FireUpdate();
CurrentSubnetMaskFeedback.FireUpdate();
CurrentDefaultGatewayFeedback.FireUpdate();
StaticIpAddressFeedback.FireUpdate();
StaticSubnetMaskFeedback.FireUpdate();
StaticDefaultGatewayFeedback.FireUpdate();
DomainFeedback.FireUpdate();
DnsServerFeedback.FireUpdate();
MacAddressFeedback.FireUpdate();
DhcpStatusFeedback.FireUpdate();
}
}
public class ProgramStatusFeedbacks
{
@@ -192,17 +371,19 @@ namespace PepperDash.Essentials.Core.Monitoring
ProgramInfo.OperatingState = Program.OperatingState;
ProgramInfo.RegistrationState = Program.RegistrationState;
ProgramStartedFeedback = new BoolFeedback(new Func<bool>( () => Program.OperatingState == eProgramOperatingState.Start));
ProgramStoppedFeedback = new BoolFeedback(new Func<bool>( () => Program.OperatingState == eProgramOperatingState.Stop));
ProgramRegisteredFeedback = new BoolFeedback(new Func<bool>( () => Program.RegistrationState == eProgramRegistrationState.Register));
ProgramUnregisteredFeedback = new BoolFeedback(new Func<bool>( () => Program.RegistrationState == eProgramRegistrationState.Unregister));
ProgramStartedFeedback = new BoolFeedback(() => Program.OperatingState == eProgramOperatingState.Start);
ProgramStoppedFeedback = new BoolFeedback(() => Program.OperatingState == eProgramOperatingState.Stop);
ProgramRegisteredFeedback =
new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Register);
ProgramUnregisteredFeedback =
new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Unregister);
ProgramNameFeedback = new StringFeedback(new Func<string>(() => ProgramInfo.ProgramFile));
ProgramCompileTimeFeedback = new StringFeedback(new Func<string>(() => ProgramInfo.CompileTime));
CrestronDataBaseVersionFeedback = new StringFeedback(new Func<string>(() => ProgramInfo.CrestronDB));
EnvironmentVersionFeedback = new StringFeedback(new Func<string>(() => ProgramInfo.Environment));
ProgramNameFeedback = new StringFeedback(() => ProgramInfo.ProgramFile);
ProgramCompileTimeFeedback = new StringFeedback(() => ProgramInfo.CompileTime);
CrestronDataBaseVersionFeedback = new StringFeedback(() => ProgramInfo.CrestronDb);
EnvironmentVersionFeedback = new StringFeedback(() => ProgramInfo.Environment);
AggregatedProgramInfoFeedback = new StringFeedback(new Func<string>(() => JsonConvert.SerializeObject(ProgramInfo)));
AggregatedProgramInfoFeedback = new StringFeedback(() => JsonConvert.SerializeObject(ProgramInfo));
GetProgramInfo();
}
@@ -212,74 +393,99 @@ namespace PepperDash.Essentials.Core.Monitoring
/// </summary>
public void GetProgramInfo()
{
CrestronInvoke.BeginInvoke((o) =>
CrestronInvoke.BeginInvoke(GetProgramInfo);
}
private void GetProgramInfo(object o)
{
Debug.Console(2, "Attempting to get program info for slot: {0}", Program.Number);
string response = null;
if (Program.RegistrationState == eProgramRegistrationState.Unregister || Program.OperatingState == eProgramOperatingState.Stop)
{
Debug.Console(2, "Attempting to get program info for slot: {0}", Program.Number);
Debug.Console(2, "Program {0} not registered. Setting default values for program information.",
Program.Number);
string response = null;
var success = CrestronConsole.SendControlSystemCommand(string.Format("progcomments:{0}", Program.Number), ref response);
if (success)
ProgramInfo = new ProgramInfo(Program.Number)
{
//Debug.Console(2, "Progcomments Response: \r{0}", response);
OperatingState = Program.OperatingState,
RegistrationState = Program.RegistrationState
};
if (!response.ToLower().Contains("bad or incomplete"))
{
// Shared properteis
ProgramInfo.ProgramFile = ParseConsoleData(response, "Program File", ": ", "\n");
ProgramInfo.CompilerRevision = ParseConsoleData(response, "Compiler Rev", ": ", "\n");
ProgramInfo.CompileTime = ParseConsoleData(response, "Compiled On", ": ", "\n");
ProgramInfo.Include4Dat = ParseConsoleData(response, "Include4.dat", ": ", "\n");
return;
}
var success = CrestronConsole.SendControlSystemCommand(
string.Format("progcomments:{0}", Program.Number), ref response);
if (!success)
{
Debug.Console(2, "Progcomments Attempt Unsuccessful for slot: {0}", Program.Number);
UpdateFeedbacks();
return;
}
if (ProgramInfo.ProgramFile.Contains(".dll"))
{
// SSP Program
ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ": ", "\n");
ProgramInfo.ApplicationName = ParseConsoleData(response, "Application Name", ": ", "\n");
ProgramInfo.ProgramTool = ParseConsoleData(response, "Program Tool", ": ", "\n");
ProgramInfo.MinFirmwareVersion = ParseConsoleData(response, "Min Firmware Version", ": ", "\n");
ProgramInfo.PlugInVersion = ParseConsoleData(response, "PlugInVersion", ": ", "\n");
}
else if (ProgramInfo.ProgramFile.Contains(".smw"))
{
// SIMPL Windows Program
ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ":", "\n");
ProgramInfo.SystemName = ParseConsoleData(response, "System Name", ": ", "\n");
ProgramInfo.CrestronDB = ParseConsoleData(response, "CrestronDB", ": ", "\n");
ProgramInfo.Environment = ParseConsoleData(response, "Source Env", ": ", "\n");
ProgramInfo.Programmer = ParseConsoleData(response, "Programmer", ": ", "\n");
if (response.ToLower().Contains("bad or incomplete"))
{
Debug.Console(2,
"Program in slot {0} not running. Setting default ProgramInfo for slot: {0}",
Program.Number);
}
//Debug.Console(2, "ProgramInfo: \r{0}", JsonConvert.SerializeObject(ProgramInfo));
}
else
{
Debug.Console(2, "Bad or incomplete console command response. Initializing ProgramInfo for slot: {0}", Program.Number);
// Assume no valid program info. Constructing a new object will wipe all properties
ProgramInfo = new ProgramInfo(Program.Number);
ProgramInfo.OperatingState = Program.OperatingState;
ProgramInfo.RegistrationState = Program.RegistrationState;
}
}
else
// Assume no valid program info. Constructing a new object will wipe all properties
ProgramInfo = new ProgramInfo(Program.Number)
{
Debug.Console(2, "Progcomments Attempt Unsuccessful for slot: {0}", Program.Number);
}
OperatingState = Program.OperatingState,
RegistrationState = Program.RegistrationState
};
ProgramNameFeedback.FireUpdate();
ProgramCompileTimeFeedback.FireUpdate();
CrestronDataBaseVersionFeedback.FireUpdate();
EnvironmentVersionFeedback.FireUpdate();
UpdateFeedbacks();
AggregatedProgramInfoFeedback.FireUpdate();
return;
}
OnProgramInfoChanged();
});
// Shared properteis
ProgramInfo.ProgramFile = ParseConsoleData(response, "Program File", ": ", "\n");
ProgramInfo.CompilerRevision = ParseConsoleData(response, "Compiler Rev", ": ", "\n");
ProgramInfo.CompileTime = ParseConsoleData(response, "Compiled On", ": ", "\n");
ProgramInfo.Include4Dat = ParseConsoleData(response, "Include4.dat", ": ", "\n");
if (ProgramInfo.ProgramFile.Contains(".dll"))
{
// SSP Program
ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ": ", "\n");
ProgramInfo.ApplicationName = ParseConsoleData(response, "Application Name", ": ", "\n");
ProgramInfo.ProgramTool = ParseConsoleData(response, "Program Tool", ": ", "\n");
ProgramInfo.MinFirmwareVersion = ParseConsoleData(response, "Min Firmware Version", ": ",
"\n");
ProgramInfo.PlugInVersion = ParseConsoleData(response, "PlugInVersion", ": ", "\n");
}
else if (ProgramInfo.ProgramFile.Contains(".smw"))
{
// SIMPL Windows Program
ProgramInfo.FriendlyName = ParseConsoleData(response, "Friendly Name", ":", "\n");
ProgramInfo.SystemName = ParseConsoleData(response, "System Name", ": ", "\n");
ProgramInfo.CrestronDb = ParseConsoleData(response, "CrestronDB", ": ", "\n");
ProgramInfo.Environment = ParseConsoleData(response, "Source Env", ": ", "\n");
ProgramInfo.Programmer = ParseConsoleData(response, "Programmer", ": ", "\n");
}
Debug.Console(2, "Program info for slot {0} successfully updated", Program.Number);
UpdateFeedbacks();
}
private void UpdateFeedbacks()
{
ProgramNameFeedback.FireUpdate();
ProgramCompileTimeFeedback.FireUpdate();
CrestronDataBaseVersionFeedback.FireUpdate();
EnvironmentVersionFeedback.FireUpdate();
AggregatedProgramInfoFeedback.FireUpdate();
OnProgramInfoChanged();
}
public void OnProgramInfoChanged()
@@ -294,30 +500,28 @@ namespace PepperDash.Essentials.Core.Monitoring
private string ParseConsoleData(string data, string line, string startString, string endString)
{
string outputData = "";
var outputData = "";
if (data.Length > 0)
if (data.Length <= 0) return outputData;
try
{
try
{
//Debug.Console(2, "ParseConsoleData Data: {0}, Line {1}, startStirng {2}, endString {3}", data, line, startString, endString);
var linePosition = data.IndexOf(line);
var startPosition = data.IndexOf(startString, linePosition) + startString.Length;
var endPosition = data.IndexOf(endString, startPosition);
outputData = data.Substring(startPosition, endPosition - startPosition).Trim();
//Debug.Console(2, "ParseConsoleData Return: {0}", outputData);
}
catch (Exception e)
{
Debug.Console(1, "Error Parsing Console Data:\r{0}", e);
}
//Debug.Console(2, "ParseConsoleData Data: {0}, Line {1}, startStirng {2}, endString {3}", data, line, startString, endString);
var linePosition = data.IndexOf(line, StringComparison.Ordinal);
var startPosition = data.IndexOf(startString, linePosition, StringComparison.Ordinal) +
startString.Length;
var endPosition = data.IndexOf(endString, startPosition, StringComparison.Ordinal);
outputData = data.Substring(startPosition, endPosition - startPosition).Trim();
//Debug.Console(2, "ParseConsoleData Return: {0}", outputData);
}
catch (Exception e)
{
Debug.Console(1, "Error Parsing Console Data:\r{0}", e);
}
return outputData;
}
}
}
/// <summary>
@@ -330,32 +534,39 @@ namespace PepperDash.Essentials.Core.Monitoring
[JsonProperty("programNumber")]
public uint ProgramNumber { get; private set; }
[JsonConverter(typeof(StringEnumConverter))]
[JsonConverter(typeof (StringEnumConverter))]
[JsonProperty("operatingState")]
public eProgramOperatingState OperatingState { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[JsonConverter(typeof (StringEnumConverter))]
[JsonProperty("registrationState")]
public eProgramRegistrationState RegistrationState { get; set; }
[JsonProperty("programFile")]
public string ProgramFile { get; set; }
[JsonProperty("friendlyName")]
public string FriendlyName { get; set; }
[JsonProperty("compilerRevision")]
public string CompilerRevision { get; set; }
[JsonProperty("compileTime")]
public string CompileTime { get; set; }
[JsonProperty("include4Dat")]
public string Include4Dat { get; set; }
// SIMPL Windows properties
[JsonProperty("systemName")]
public string SystemName { get; set; }
[JsonProperty("crestronDb")]
public string CrestronDB { get; set; }
public string CrestronDb { get; set; }
[JsonProperty("environment")]
public string Environment { get; set; }
[JsonProperty("programmer")]
public string Programmer { get; set; }
@@ -363,10 +574,13 @@ namespace PepperDash.Essentials.Core.Monitoring
// SSP Properties
[JsonProperty("applicationName")]
public string ApplicationName { get; set; }
[JsonProperty("programTool")]
public string ProgramTool { get; set; }
[JsonProperty("minFirmwareVersion")]
public string MinFirmwareVersion { get; set; }
[JsonProperty("plugInVersion")]
public string PlugInVersion { get; set; }
@@ -381,7 +595,7 @@ namespace PepperDash.Essentials.Core.Monitoring
Include4Dat = "";
SystemName = "";
CrestronDB = "";
CrestronDb = "";
Environment = "";
Programmer = "";

View File

@@ -84,7 +84,7 @@
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />