diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs index e4ccdfbd..894b7fd3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GenericRelayControllerJoinMap.cs @@ -7,25 +7,17 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core.Bridges { - public class GenericRelayControllerJoinMap : JoinMapBase + public class GenericRelayControllerJoinMap : JoinMapBaseAdvanced { - #region Digitals - /// - /// Sets and reports the state of the relay (High = closed, Low = Open) - /// - public uint Relay { get; set; } - #endregion - public GenericRelayControllerJoinMap() - { - Relay = 1; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - Relay = Relay + joinOffset; + [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)) + { } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index aac9de44..5f03c27d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -70,16 +70,14 @@ namespace PepperDash.Essentials.Core.CrestronIO #endregion 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); if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - joinMap.OffsetJoinNumbers(joinStart); - if (RelayOutput == null) { 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")); - trilist.SetBoolSigAction(joinMap.Relay, b => + trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b => { if (b) CloseRelay(); @@ -98,7 +96,7 @@ namespace PepperDash.Essentials.Core.CrestronIO // feedback for relay state - OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay]); + OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); } }