mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-17 21:54:54 +00:00
Testing SystemMonitorBridge
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -75,7 +75,12 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
|
|
||||||
if (device != null)
|
if (device != null)
|
||||||
{
|
{
|
||||||
if (device is GenericComm)
|
if (device is PepperDash.Essentials.Core.Monitoring.SystemMonitorController)
|
||||||
|
{
|
||||||
|
(device as PepperDash.Essentials.Core.Monitoring.SystemMonitorController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (device is GenericComm)
|
||||||
{
|
{
|
||||||
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
continue;
|
continue;
|
||||||
@@ -98,10 +103,12 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
else if (device is GenericRelayDevice)
|
else if (device is GenericRelayDevice)
|
||||||
{
|
{
|
||||||
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (device is IDigitalInput)
|
else if (device is IDigitalInput)
|
||||||
{
|
{
|
||||||
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,6 +144,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
[JsonProperty("devices")]
|
[JsonProperty("devices")]
|
||||||
public List<ApiDevice> Devices { get; set; }
|
public List<ApiDevice> Devices { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public class ApiDevice
|
public class ApiDevice
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey")]
|
[JsonProperty("deviceKey")]
|
||||||
@@ -152,108 +160,4 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// API class for IBasicCommunication devices
|
|
||||||
///// </summary>
|
|
||||||
//public class IBasicCommunicationApi : DeviceApiBase
|
|
||||||
//{
|
|
||||||
// public IBasicCommunication Device { get; set; }
|
|
||||||
|
|
||||||
// SerialFeedback TextReceivedFeedback;
|
|
||||||
|
|
||||||
// public IBasicCommunicationApi(IBasicCommunication dev)
|
|
||||||
// {
|
|
||||||
// TextReceivedFeedback = new SerialFeedback();
|
|
||||||
|
|
||||||
// Device = dev;
|
|
||||||
|
|
||||||
// SetupFeedbacks();
|
|
||||||
|
|
||||||
// ActionApi = new Dictionary<string, Object>
|
|
||||||
// {
|
|
||||||
// { "connect", new Action(Device.Connect) },
|
|
||||||
// { "disconnect", new Action(Device.Disconnect) },
|
|
||||||
// { "connectstate", new Action<bool>( b => ConnectByState(b) ) },
|
|
||||||
// { "sendtext", new Action<string>( s => Device.SendText(s) ) }
|
|
||||||
|
|
||||||
// };
|
|
||||||
|
|
||||||
// FeedbackApi = new Dictionary<string, Feedback>
|
|
||||||
// {
|
|
||||||
// { "isconnected", new BoolFeedback( () => Device.IsConnected ) },
|
|
||||||
// { "textrecieved", TextReceivedFeedback }
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Controls connection based on state of input
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="state"></param>
|
|
||||||
// void ConnectByState(bool state)
|
|
||||||
// {
|
|
||||||
// if (state)
|
|
||||||
// Device.Connect();
|
|
||||||
// else
|
|
||||||
// Device.Disconnect();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void SetupFeedbacks()
|
|
||||||
// {
|
|
||||||
// Device.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Device_TextReceived);
|
|
||||||
|
|
||||||
// if(Device is ISocketStatus)
|
|
||||||
// (Device as ISocketStatus).ConnectionChange += new EventHandler<GenericSocketStatusChageEventArgs>(IBasicCommunicationApi_ConnectionChange);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e)
|
|
||||||
// {
|
|
||||||
// FeedbackApi["isconnected"].FireUpdate();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
|
||||||
// {
|
|
||||||
// TextReceivedFeedback.FireUpdate(e.Text);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Each flavor of API is a static class with static properties and a static constructor that
|
|
||||||
///// links up the things to do.
|
|
||||||
///// </summary>
|
|
||||||
//public class DmChassisControllerApi : DeviceApiBase
|
|
||||||
//{
|
|
||||||
// IntFeedback Output1Feedback;
|
|
||||||
// IntFeedback Output2Feedback;
|
|
||||||
|
|
||||||
// public DmChassisControllerApi(DmChassisController dev)
|
|
||||||
// {
|
|
||||||
// Output1Feedback = new IntFeedback( new Func<int>(() => 1));
|
|
||||||
// Output2Feedback = new IntFeedback( new Func<int>(() => 2));
|
|
||||||
|
|
||||||
// ActionApi = new Dictionary<string, Object>
|
|
||||||
// {
|
|
||||||
|
|
||||||
// };
|
|
||||||
|
|
||||||
// FeedbackApi = new Dictionary<string, Feedback>
|
|
||||||
// {
|
|
||||||
// { "Output-1/fb", Output1Feedback },
|
|
||||||
// { "Output-2/fb", Output2Feedback }
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Factory method
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="dev"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public static DmChassisControllerApi GetActionApiForDevice(DmChassisController dev)
|
|
||||||
// {
|
|
||||||
// return new DmChassisControllerApi(dev);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,6 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||||
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,23 +23,79 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
|
|
||||||
joinMap.OffsetJoinNumbers(joinStart);
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, systemMonitorController, "Linking API starting at join: {0}", joinStart);
|
||||||
|
|
||||||
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
|
systemMonitorController.TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone]);
|
||||||
trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
|
//trilist.SetUShortSigAction(joinMap.TimeZone, new Action<ushort>(u => systemMonitorController.SetTimeZone(u)));
|
||||||
systemMonitorController.TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName]);
|
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.SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion]);
|
||||||
|
systemMonitorController.BACnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
|
||||||
|
systemMonitorController.ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion]);
|
||||||
|
|
||||||
|
|
||||||
foreach (var p in SystemMonitor.ProgramCollection)
|
// iterate the program status feedback collection and map all the joins
|
||||||
|
var programSlotJoinStart = joinMap.ProgramStartJoin;
|
||||||
|
|
||||||
|
foreach (var p in systemMonitorController.ProgramStatusFeedbackCollection)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO: link feedbacks for each program slot
|
||||||
|
var programNumber = p.Value.Program.Number;
|
||||||
|
|
||||||
|
Debug.Console(1, systemMonitorController, "Linking API for Program Slot: {0} starting at join: {1}", programNumber, programSlotJoinStart);
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(programSlotJoinStart + joinMap.ProgramStart, new Action<bool>
|
||||||
|
(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));
|
||||||
|
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.ProgramUnregister, new Action<bool>
|
||||||
|
(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(trilist.StringInput[programSlotJoinStart + joinMap.ProgramCompiledTime]);
|
||||||
|
p.Value.CrestronDataBaseVersionFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramCrestronDatabaseVersion]);
|
||||||
|
p.Value.EnvironmentVersionFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramEnvironmentVersion]);
|
||||||
|
p.Value.AggregatedProgramInfoFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo]);
|
||||||
|
|
||||||
|
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, systemMonitorController, "*****************************Manually Firing Feedback Updates....*****************************");
|
||||||
|
|
||||||
|
systemMonitorController.ControllerVersionFeedback.FireUpdate();
|
||||||
|
systemMonitorController.TimeZoneFeedback.FireUpdate();
|
||||||
|
systemMonitorController.TimeZoneTextFeedback.FireUpdate();
|
||||||
|
systemMonitorController.IOControllerVersionFeedback.FireUpdate();
|
||||||
|
systemMonitorController.SnmpVersionFeedback.FireUpdate();
|
||||||
|
systemMonitorController.BACnetAppVersionFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SystemMonitorJoinMap : JoinMapBase
|
public class SystemMonitorJoinMap : JoinMapBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Offset to indicate where the range of iterated program joins will start
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramStartJoin { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Offset between each program join set
|
||||||
|
/// </summary>
|
||||||
|
public uint ProgramOffsetJoin { get; set; }
|
||||||
|
|
||||||
//Digital
|
//Digital
|
||||||
public uint ProgramStart { get; set; }
|
public uint ProgramStart { get; set; }
|
||||||
public uint ProgramStop { get; set; }
|
public uint ProgramStop { get; set; }
|
||||||
@@ -60,7 +116,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
public uint ProgramCompiledTime { get; set; }
|
public uint ProgramCompiledTime { get; set; }
|
||||||
public uint ProgramCrestronDatabaseVersion { get; set; }
|
public uint ProgramCrestronDatabaseVersion { get; set; }
|
||||||
public uint ProgramEnvironmentVersion { get; set; }
|
public uint ProgramEnvironmentVersion { get; set; }
|
||||||
|
public uint AggregatedProgramInfo { get; set; }
|
||||||
|
|
||||||
public SystemMonitorJoinMap()
|
public SystemMonitorJoinMap()
|
||||||
{
|
{
|
||||||
@@ -72,15 +128,22 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
BACnetAppVersion = 4;
|
BACnetAppVersion = 4;
|
||||||
ControllerVersion = 5;
|
ControllerVersion = 5;
|
||||||
|
|
||||||
ProgramStart = 11;
|
|
||||||
ProgramStop = 12;
|
ProgramStartJoin = 10;
|
||||||
ProgramRegister = 13;
|
|
||||||
ProgramUnregister = 14;
|
ProgramOffsetJoin = 5;
|
||||||
|
|
||||||
ProgramName = 11;
|
// Offset in groups of 5 joins
|
||||||
ProgramCompiledTime = 12;
|
ProgramStart = 1;
|
||||||
ProgramCrestronDatabaseVersion = 13;
|
ProgramStop = 2;
|
||||||
ProgramEnvironmentVersion = 14;
|
ProgramRegister = 3;
|
||||||
|
ProgramUnregister = 4;
|
||||||
|
|
||||||
|
ProgramName = 1;
|
||||||
|
ProgramCompiledTime = 2;
|
||||||
|
ProgramCrestronDatabaseVersion = 3;
|
||||||
|
ProgramEnvironmentVersion = 4;
|
||||||
|
AggregatedProgramInfo = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OffsetJoinNumbers(uint joinStart)
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
@@ -95,15 +158,8 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
BACnetAppVersion = BACnetAppVersion + joinOffset;
|
BACnetAppVersion = BACnetAppVersion + joinOffset;
|
||||||
ControllerVersion = ControllerVersion + joinOffset;
|
ControllerVersion = ControllerVersion + joinOffset;
|
||||||
|
|
||||||
ProgramStart = ProgramStart + joinOffset;
|
// Sets the initial join value where the iterated program joins will begin
|
||||||
ProgramStop = ProgramStop + joinOffset;
|
ProgramStartJoin = ProgramStartJoin + joinOffset;
|
||||||
ProgramRegister = ProgramRegister + joinOffset;
|
|
||||||
ProgramUnregister = ProgramUnregister;
|
|
||||||
|
|
||||||
ProgramName = ProgramName + joinOffset;
|
|
||||||
ProgramCompiledTime = ProgramCompiledTime + joinOffset;
|
|
||||||
ProgramCrestronDatabaseVersion = ProgramCrestronDatabaseVersion + joinOffset;
|
|
||||||
ProgramEnvironmentVersion = ProgramEnvironmentVersion + joinOffset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Submodule essentials-framework updated: 389352d4da...dc0b482acb
Reference in New Issue
Block a user