mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-27 19:34:51 +00:00
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
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 IDigitalInputJoinMap;
|
|
|
|
if (joinMap == null)
|
|
joinMap = new IDigitalInputJoinMap();
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
} |