mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Updated GenericRelayControllerJoinMap and GenericRelayDevice
This commit is contained in:
@@ -7,25 +7,17 @@ using PepperDash.Essentials.Core;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Bridges
|
namespace PepperDash.Essentials.Core.Bridges
|
||||||
{
|
{
|
||||||
public class GenericRelayControllerJoinMap : JoinMapBase
|
public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced
|
||||||
{
|
{
|
||||||
#region Digitals
|
|
||||||
/// <summary>
|
|
||||||
/// Sets and reports the state of the relay (High = closed, Low = Open)
|
|
||||||
/// </summary>
|
|
||||||
public uint Relay { get; set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public GenericRelayControllerJoinMap()
|
[JoinName("Relay")]
|
||||||
|
public JoinDataComplete Relay = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
|
||||||
|
new JoinMetadata() { Label = "Device Relay State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||||
|
|
||||||
|
|
||||||
|
public GenericRelayControllerJoinMap(uint joinStart)
|
||||||
|
: base(joinStart, typeof(GenericRelayControllerJoinMap))
|
||||||
{
|
{
|
||||||
Relay = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OffsetJoinNumbers(uint joinStart)
|
|
||||||
{
|
|
||||||
var joinOffset = joinStart - 1;
|
|
||||||
|
|
||||||
Relay = Relay + joinOffset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,15 +71,13 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||||
{
|
{
|
||||||
var joinMap = new GenericRelayControllerJoinMap();
|
var joinMap = new GenericRelayControllerJoinMap(joinStart);
|
||||||
|
|
||||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
|
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
joinMap.OffsetJoinNumbers(joinStart);
|
|
||||||
|
|
||||||
if (RelayOutput == null)
|
if (RelayOutput == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Unable to link device '{0}'. Relay is null", Key);
|
Debug.Console(1, this, "Unable to link device '{0}'. Relay is null", Key);
|
||||||
@@ -88,7 +86,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
trilist.SetBoolSigAction(joinMap.Relay, b =>
|
trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b =>
|
||||||
{
|
{
|
||||||
if (b)
|
if (b)
|
||||||
CloseRelay();
|
CloseRelay();
|
||||||
@@ -98,7 +96,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
|
|||||||
|
|
||||||
// feedback for relay state
|
// feedback for relay state
|
||||||
|
|
||||||
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]);
|
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user