diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index 3c668804..a57353d7 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -76,13 +76,16 @@ namespace PepperDash.Essentials.Bridges { if (device is GenericComm) { - (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); } if (device is DmChassisController) { (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); } + if (device is DmTxControllerBase) + { + (device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + } } } @@ -132,69 +135,69 @@ namespace PepperDash.Essentials.Bridges } - /// - /// API class for IBasicCommunication devices - /// - public class IBasicCommunicationApi : DeviceApiBase - { - public IBasicCommunication Device { get; set; } + ///// + ///// API class for IBasicCommunication devices + ///// + //public class IBasicCommunicationApi : DeviceApiBase + //{ + // public IBasicCommunication Device { get; set; } - SerialFeedback TextReceivedFeedback; + // SerialFeedback TextReceivedFeedback; - public IBasicCommunicationApi(IBasicCommunication dev) - { - TextReceivedFeedback = new SerialFeedback(); + // public IBasicCommunicationApi(IBasicCommunication dev) + // { + // TextReceivedFeedback = new SerialFeedback(); - Device = dev; + // Device = dev; - SetupFeedbacks(); + // SetupFeedbacks(); - ActionApi = new Dictionary - { - { "connect", new Action(Device.Connect) }, - { "disconnect", new Action(Device.Disconnect) }, - { "connectstate", new Action( b => ConnectByState(b) ) }, - { "sendtext", new Action( s => Device.SendText(s) ) } + // ActionApi = new Dictionary + // { + // { "connect", new Action(Device.Connect) }, + // { "disconnect", new Action(Device.Disconnect) }, + // { "connectstate", new Action( b => ConnectByState(b) ) }, + // { "sendtext", new Action( s => Device.SendText(s) ) } - }; + // }; - FeedbackApi = new Dictionary - { - { "isconnected", new BoolFeedback( () => Device.IsConnected ) }, - { "textrecieved", TextReceivedFeedback } - }; - } + // FeedbackApi = new Dictionary + // { + // { "isconnected", new BoolFeedback( () => Device.IsConnected ) }, + // { "textrecieved", TextReceivedFeedback } + // }; + // } - /// - /// Controls connection based on state of input - /// - /// - void ConnectByState(bool state) - { - if (state) - Device.Connect(); - else - Device.Disconnect(); - } + // /// + // /// Controls connection based on state of input + // /// + // /// + // void ConnectByState(bool state) + // { + // if (state) + // Device.Connect(); + // else + // Device.Disconnect(); + // } - void SetupFeedbacks() - { - Device.TextReceived += new EventHandler(Device_TextReceived); + // void SetupFeedbacks() + // { + // Device.TextReceived += new EventHandler(Device_TextReceived); - if(Device is ISocketStatus) - (Device as ISocketStatus).ConnectionChange += new EventHandler(IBasicCommunicationApi_ConnectionChange); - } + // if(Device is ISocketStatus) + // (Device as ISocketStatus).ConnectionChange += new EventHandler(IBasicCommunicationApi_ConnectionChange); + // } - void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) - { - FeedbackApi["isconnected"].FireUpdate(); - } + // void IBasicCommunicationApi_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) + // { + // FeedbackApi["isconnected"].FireUpdate(); + // } - void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e) - { - TextReceivedFeedback.FireUpdate(e.Text); - } - } + // void Device_TextReceived(object sender, GenericCommMethodReceiveTextArgs e) + // { + // TextReceivedFeedback.FireUpdate(e.Text); + // } + //} diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index bf38c4f0..037a7a5b 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Bridges joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, dmChassis, "Linking device '{0}' to Trilist '{1}'", dmChassis.Key, trilist.ID); + Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); @@ -45,7 +45,8 @@ namespace PepperDash.Essentials.Bridges dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); - + dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); } @@ -63,7 +64,8 @@ namespace PepperDash.Essentials.Bridges public uint OutputCurrentVideoInputNames { get; set; } public uint OutputCurrentAudioInputNames { get; set; } public uint InputCurrentResolution { get; set; } - public uint InputSlotOnline { get; set; } + public uint InputEndpointOnline { get; set; } + public uint OutputEndpointOnline { get; set; } //public uint HdcpSupport { get; set; } //public uint HdcpSupportCapability { get; set; } @@ -79,7 +81,8 @@ namespace PepperDash.Essentials.Bridges OutputCurrentVideoInputNames = 2000; //2001-2199 OutputCurrentAudioInputNames = 2200; //2201-2399 InputCurrentResolution = 2400; // 2401-2599 - InputSlotOnline = 500; + InputEndpointOnline = 500; + OutputEndpointOnline = 700; //HdcpSupport = 1000; //1001-1199 //HdcpSupportCapability = 1200; //1201-1399 @@ -98,7 +101,8 @@ namespace PepperDash.Essentials.Bridges OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; InputCurrentResolution = InputCurrentResolution + joinOffset; - InputSlotOnline = InputSlotOnline + joinOffset; + InputEndpointOnline = InputEndpointOnline + joinOffset; + OutputEndpointOnline = OutputEndpointOnline + joinOffset; //HdcpSupport = HdcpSupport + joinOffset; //HdcpSupportCapability = HdcpSupportCapability + joinOffset; } diff --git a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs new file mode 100644 index 00000000..391850e2 --- /dev/null +++ b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs @@ -0,0 +1,88 @@ +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.DM; + +namespace PepperDash.Essentials.Bridges +{ + public static class DmTxControllerApiExtensions + { + public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey) + { + var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmTxControllerJoinMap; + + if (joinMap == null) + joinMap = new DmTxControllerJoinMap(); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]); + tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]); + tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState]); + trilist.SetBoolSigAction(joinMap.HdcpSupportOn, + new Action(b => tx.SetHdcpSupportAll(ePdtHdcpSupport.Auto))); + tx.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportOn]); + trilist.SetBoolSigAction(joinMap.HdcpSupportOff, + new Action(b => tx.SetHdcpSupportAll(ePdtHdcpSupport.HdcpOff))); + if (tx is ITxRouting) + { + trilist.SetUShortSigAction(joinMap.VideoInput, + new Action(i => (tx as ITxRouting).ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video))); + trilist.SetUShortSigAction(joinMap.AudioInput, + new Action(i => (tx as ITxRouting).ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio))); + +#warning Deal with how to get the same numeric feedback values out + (tx as ITxRouting).VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]); + (tx as ITxRouting).AudioSourceNumericFeedabck.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]); + } + } + + public class DmTxControllerJoinMap : JoinMapBase + { + public uint IsOnline { get; set; } + public uint VideoSyncStatus { get; set; } + public uint CurrentInputResolution { get; set; } + public uint HdcpSupportOn { get; set; } + public uint HdcpSupportOff { get; set; } + public uint HdcpSupportState { get; set; } + public uint VideoInput { get; set; } + public uint AudioInput { get; set; } + + public DmTxControllerJoinMap() + { + // Digital + IsOnline = 1; + VideoSyncStatus = 2; + HdcpSupportOn = 3; + HdcpSupportOff = 4; + // Serial + CurrentInputResolution = 1; + // Analog + VideoInput = 1; + AudioInput = 2; + HdcpSupportState = 3; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + CurrentInputResolution = CurrentInputResolution + joinOffset; + HdcpSupportOn = HdcpSupportOn + joinOffset; + HdcpSupportOff = HdcpSupportOff + joinOffset; + HdcpSupportState = HdcpSupportState + joinOffset; + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs b/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs index 51f7ee9f..230f7806 100644 --- a/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs +++ b/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs @@ -27,7 +27,7 @@ namespace PepperDash.Essentials.Bridges return; } - Debug.Console(1, comm, "Linking device '{0}' to Trilist '{1}'", comm.Key, trilist.ID); + Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // this is a permanent event handler. This cannot be -= from event comm.CommPort.TextReceived += (s, a) => trilist.SetString(joinMap.TextReceived, a.Text); diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 253a169e..d2b5ce32 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -113,6 +113,7 @@ + diff --git a/essentials-framework b/essentials-framework index 25af9c91..de097523 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 25af9c91a18fef1b0c287e4fcdfda4200cb24688 +Subproject commit de0975235d0996fb1980fd585cbda739aff89b56