From 3e16cbb092421df55a2f2992e009b40b82e5d7f7 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Feb 2020 20:45:01 -0700 Subject: [PATCH] Adds VGA brightness and contrast feedback/control to DM-TX-201-C --- .../Transmitters/DmTx201CController.cs | 38 +++++++++++++++++-- .../{IFreeRunEnabled.cs => TxInterfaces.cs} | 12 ++++++ .../Essentials_DM/Essentials_DM.csproj | 2 +- 3 files changed, 48 insertions(+), 4 deletions(-) rename essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/{IFreeRunEnabled.cs => TxInterfaces.cs} (57%) 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 28c5611b..9195851e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -35,6 +35,9 @@ namespace PepperDash.Essentials.DM public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } + /// /// Helps get the "real" inputs, including when in Auto /// @@ -123,6 +126,11 @@ namespace PepperDash.Essentials.DM 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); + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; var combinedFuncs = new VideoStatusFuncsWrapper @@ -157,7 +165,7 @@ 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); HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, @@ -175,6 +183,21 @@ namespace PepperDash.Essentials.DM DmOutput.Port = Tx.DmOutput; } + 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(); + } + } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { ActiveVideoInputFeedback.FireUpdate(); @@ -184,8 +207,7 @@ namespace PepperDash.Essentials.DM } public override bool CustomActivate() - { - + { Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); @@ -212,6 +234,16 @@ namespace PepperDash.Essentials.DM } } + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + /// /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable) /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs similarity index 57% rename from essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs rename to essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs index 7410af9c..50955dda 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs @@ -17,4 +17,16 @@ namespace PepperDash.Essentials.DM void SetFreeRunEnabled(bool enable); } + + /// + /// Defines a device capable of adjusting VGA settings + /// + public interface IVgaBrightnessContrastControls + { + IntFeedback VgaBrightnessFeedback { get; } + IntFeedback VgaContrastFeedback { get; } + + void SetVgaBrightness(ushort level); + void SetVgaContrast(ushort level); + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj index 127a9e42..322cbdab 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -96,7 +96,7 @@ - +