mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 12:15:01 +00:00
Adds System Monitor program initialization feedback to startup procedure. Adds bridges for GenericRelayDevice and IDigitalInput device tyeps.
This commit is contained in:
@@ -11,6 +11,7 @@ using PepperDash.Core;
|
|||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
using PepperDash.Essentials.DM;
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Bridges
|
namespace PepperDash.Essentials.Bridges
|
||||||
@@ -94,6 +95,14 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
(device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as DmRmcControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (device is GenericRelayDevice)
|
||||||
|
{
|
||||||
|
(device as GenericRelayDevice).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
}
|
||||||
|
else if (device is IDigitalInput)
|
||||||
|
{
|
||||||
|
(device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
66
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
66
PepperDashEssentials/Bridges/GenericRelayDeviceBridge.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class GenericRelayDeviceApiExtensions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this GenericRelayDevice relay, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericRelayControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new GenericRelayControllerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
if (relay.RelayOutput == null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, relay, "Unable to link device '{0}'. Relay is null", relay.Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Console(1, relay, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
trilist.SetBoolSigAction(joinMap.Relay, new Action<bool>(b =>
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
relay.CloseRelay();
|
||||||
|
else
|
||||||
|
relay.OpenRelay();
|
||||||
|
}));
|
||||||
|
|
||||||
|
// feedback for relay state
|
||||||
|
|
||||||
|
relay.OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GenericRelayControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
public uint Relay { get; set; }
|
||||||
|
|
||||||
|
public GenericRelayControllerJoinMap()
|
||||||
|
{
|
||||||
|
Relay = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
Relay = Relay + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,13 +63,18 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
|
|
||||||
public class IBasicCommunicationJoinMap : JoinMapBase
|
public class IBasicCommunicationJoinMap : JoinMapBase
|
||||||
{
|
{
|
||||||
// Default joins
|
//Digital
|
||||||
|
public uint Connect { get; set; }
|
||||||
|
public uint Connected { get; set; }
|
||||||
|
|
||||||
|
//Analog
|
||||||
|
public uint Status { get; set; }
|
||||||
|
|
||||||
|
// Serial
|
||||||
public uint TextReceived { get; set; }
|
public uint TextReceived { get; set; }
|
||||||
public uint SendText { get; set; }
|
public uint SendText { get; set; }
|
||||||
public uint SetPortConfig { get; set; }
|
public uint SetPortConfig { get; set; }
|
||||||
public uint Connect { get; set; }
|
|
||||||
public uint Connected { get; set; }
|
|
||||||
public uint Status { get; set; }
|
|
||||||
|
|
||||||
public IBasicCommunicationJoinMap()
|
public IBasicCommunicationJoinMap()
|
||||||
{
|
{
|
||||||
@@ -94,38 +99,5 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///// <summary>
|
|
||||||
/////
|
|
||||||
///// </summary>
|
|
||||||
//public static class DmChassisControllerApiExtensions
|
|
||||||
//{
|
|
||||||
// public static void LinkToApi(this PepperDash.Essentials.DM.DmChassisController chassis,
|
|
||||||
// BasicTriList trilist, Dictionary<string,uint> map, uint joinstart)
|
|
||||||
// {
|
|
||||||
// uint joinOffset = joinstart - 1;
|
|
||||||
|
|
||||||
// uint videoSelectOffset = 0 + joinOffset;
|
|
||||||
// uint audioSelectOffset = 40 + joinOffset;
|
|
||||||
|
|
||||||
|
|
||||||
// // loop chassis number of inupts
|
|
||||||
// for (uint i = 1; i <= chassis.Chassis.NumberOfOutputs; i++)
|
|
||||||
// {
|
|
||||||
// trilist.SetUShortSigAction(videoSelectOffset + i, new Action<ushort>(u => chassis.ExecuteSwitch(u, i, eRoutingSignalType.Video)));
|
|
||||||
// trilist.SetUShortSigAction(audioSelectOffset + i, new Action<ushort>(u => chassis.ExecuteSwitch(u, i, eRoutingSignalType.Audio)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // wire up output change detection (try to add feedbacks or something to DMChassisController??
|
|
||||||
|
|
||||||
// // names?
|
|
||||||
|
|
||||||
// // HDCP?
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
59
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
59
PepperDashEssentials/Bridges/IDigitalInputBridge.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.CrestronIO;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class IDigitalInputApiExtenstions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this IDigitalInput input, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as IDigitalInputApiJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new IDigitalInputApiJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Debug.Console(1, input as Device, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// Link feedback for input state
|
||||||
|
input.InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, input as Device, "Unable to link device '{0}'. Input is null", (input as Device).Key);
|
||||||
|
Debug.Console(1, input as Device, "Error: {0}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IDigitalInputApiJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
//Digital
|
||||||
|
public uint InputState { get; set; }
|
||||||
|
|
||||||
|
public IDigitalInputApiJoinMap()
|
||||||
|
{
|
||||||
|
InputState = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
InputState = InputState + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.CrestronThread;
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
using Crestron.SimplSharpPro.Diagnostics;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
@@ -32,6 +34,8 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void InitializeSystem()
|
public override void InitializeSystem()
|
||||||
{
|
{
|
||||||
|
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
||||||
|
|
||||||
DeterminePlatform();
|
DeterminePlatform();
|
||||||
|
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file",
|
||||||
@@ -141,6 +145,8 @@ namespace PepperDash.Essentials
|
|||||||
"------------------------------------------------\r" +
|
"------------------------------------------------\r" +
|
||||||
"------------------------------------------------");
|
"------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -114,8 +114,10 @@
|
|||||||
<Compile Include="Bridges\BridgeFactory.cs" />
|
<Compile Include="Bridges\BridgeFactory.cs" />
|
||||||
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
||||||
<Compile Include="Bridges\DmTxControllerBridge.cs" />
|
<Compile Include="Bridges\DmTxControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\GenericRelayDeviceBridge.cs" />
|
||||||
<Compile Include="Bridges\IBasicCommunicationBridge.cs" />
|
<Compile Include="Bridges\IBasicCommunicationBridge.cs" />
|
||||||
<Compile Include="Bridges\DmRmcControllerBridge.cs" />
|
<Compile Include="Bridges\DmRmcControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\IDigitalInputBridge.cs" />
|
||||||
<Compile Include="Bridges\JoinMapBase.cs" />
|
<Compile Include="Bridges\JoinMapBase.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
<Compile Include="Configuration ORIGINAL\Builders\TPConfig.cs" />
|
||||||
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
<Compile Include="Configuration ORIGINAL\Configuration.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user