From 102535cd0436f099d24eabd3d8ff72c0f8d23899 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 13:42:39 -0500 Subject: [PATCH] Updated DmTx401CController #200 --- .../Transmitters/DmTx200Controller.cs | 7 +- .../Transmitters/DmTx201CController.cs | 2 +- .../Transmitters/DmTx201SController.cs | 2 +- .../Transmitters/DmTx401CController.cs | 255 ++++++++++-------- 4 files changed, 145 insertions(+), 121 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index e2c411eb..cbe3ebcc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -146,9 +146,10 @@ namespace PepperDash.Essentials.DM }; AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); - DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this); + DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, null, this); AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, @@ -324,7 +325,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - VgaVideoSyncFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); break; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 91a011d0..dcf5c068 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -342,7 +342,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - VgaVideoSyncFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); break; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs index fc7be4d9..27e78256 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -342,7 +342,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - VgaVideoSyncFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); break; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index 46cae247..c47dc4ac 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -19,12 +19,10 @@ namespace PepperDash.Essentials.DM { using eVst = DmTx401C.eSourceSelection; - public class DmTx401CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls + public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx401C Tx { get; private set; } - - public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; } public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; } public RoutingInputPortWithVideoStatuses VgaIn { get; private set; } @@ -114,53 +112,38 @@ namespace PepperDash.Essentials.DM VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this, - VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); + VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); + + Tx.HdmiInput.InputStreamChange += HdmiInputStreamChangeEvent; + Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChangeEvent; + Tx.BaseEvent += Tx_BaseEvent; + Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange; + tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange; - Tx.BaseEvent += Tx_BaseEvent; ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", - () => ActualVideoInput.ToString()); + () => ActualVideoInput.ToString()); + + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); + + HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0); - HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => - { - if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) - return 1; - else - return 0; - }); - - HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; - - DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => - { - return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; - }); - - HdmiVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; - }); - - VgaVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; - }); + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + + DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue); + + HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue); + + VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue); FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); - tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); var combinedFuncs = new VideoStatusFuncsWrapper { @@ -238,7 +221,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (HdmiVideoSyncFeedback != null) { @@ -298,86 +281,82 @@ namespace PepperDash.Essentials.DM Tx.VideoSource = (eVst)inputSelector; if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) Tx.AudioSource = (eVst)inputSelector; + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } + } + + void VideoControls_ControlChange(object sender, GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case VideoControlsEventIds.BrightnessFeedbackEventId: + VgaBrightnessFeedback.FireUpdate(); + break; + case VideoControlsEventIds.ContrastFeedbackEventId: + VgaContrastFeedback.FireUpdate(); + break; + } } - - void Tx_BaseEvent(GenericBase device, BaseEventArgs args) - { - var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } - } - - void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) - { - var id = args.EventId; - Debug.Console(2, this, "EventId {0}", args.EventId); - - if (id == VideoControlsEventIds.BrightnessFeedbackEventId) - { - VgaBrightnessFeedback.FireUpdate(); - } - else if (id == VideoControlsEventIds.ContrastFeedbackEventId) - { - VgaContrastFeedback.FireUpdate(); - } - } - - /// - /// Enables or disables free run - /// - /// - public void SetFreeRunEnabled(bool enable) - { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } - } - - /// - /// Sets the VGA brightness level - /// - /// - public void SetVgaBrightness(ushort level) - { - Tx.VgaInput.VideoControls.Brightness.UShortValue = level; - } - - /// - /// Sets the VGA contrast level - /// - /// - public void SetVgaContrast(ushort level) - { - Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; } /// /// Relays the input stream change to the appropriate RoutingInputPort. - /// - void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } - } + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + return; + } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } /// /// Relays the VideoAttributes change to a RoutingInputPort @@ -407,7 +386,51 @@ namespace PepperDash.Essentials.DM AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); break; } - } + } + + void HdmiInputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + HdmiVideoSyncFeedback.FireUpdate(); + break; + } + } + + void DisplayPortInputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + DisplayPortVideoSyncFeedback.FireUpdate(); + break; + } + } + + private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + switch (args.EventId) + { + case EndpointInputStreamEventIds.FreeRunFeedbackEventId: + FreeRunEnabledFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; + } + } + #region IIROutputPorts Members