Merge pull request #44 from PepperDash/feature/dm-disable-free-run

Feature/dm disable free run
This commit is contained in:
Andrew Welker
2020-02-21 09:28:50 -07:00
committed by GitHub
6 changed files with 153 additions and 12 deletions

View File

@@ -57,7 +57,7 @@ namespace PepperDash.Essentials.Bridges
trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability;
if(txR.InputPorts[DmPortName.HdmiIn] != null) if (txR.InputPorts[DmPortName.HdmiIn] != null)
{ {
var inputPort = txR.InputPorts[DmPortName.HdmiIn]; var inputPort = txR.InputPorts[DmPortName.HdmiIn];
@@ -103,6 +103,22 @@ namespace PepperDash.Essentials.Bridges
} }
} }
var txFreeRun = tx as IHasFreeRun;
if (txFreeRun != null)
{
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]);
trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action<bool>(b => txFreeRun.SetFreeRunEnabled(b)));
}
var txVga = tx as IVgaBrightnessContrastControls;
{
txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]);
txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]);
trilist.SetUShortSigAction(joinMap.VgaBrightness, new Action<ushort>(u => txVga.SetVgaBrightness(u)));
trilist.SetUShortSigAction(joinMap.VgaContrast, new Action<ushort>(u => txVga.SetVgaContrast(u)));
}
} }
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)

View File

@@ -18,6 +18,10 @@ namespace PepperDash.Essentials.Bridges
/// High when video sync is detected /// High when video sync is detected
/// </summary> /// </summary>
public uint VideoSyncStatus { get; set; } public uint VideoSyncStatus { get; set; }
/// <summary>
///
/// </summary>
public uint FreeRunEnabled { get; set; }
#endregion #endregion
#region Analogs #region Analogs
@@ -41,6 +45,16 @@ namespace PepperDash.Essentials.Bridges
/// Sets and reports the current HDCP state for the corresponding input port /// Sets and reports the current HDCP state for the corresponding input port
/// </summary> /// </summary>
public uint Port2HdcpState { get; set; } public uint Port2HdcpState { get; set; }
/// <summary>
/// Sets and reports the current VGA Brightness level
/// </summary>
public uint VgaBrightness { get; set; }
/// <summary>
/// Sets and reports the current VGA Contrast level
/// </summary>
public uint VgaContrast { get; set; }
#endregion #endregion
#region Serials #region Serials
@@ -56,6 +70,7 @@ namespace PepperDash.Essentials.Bridges
// Digital // Digital
IsOnline = 1; IsOnline = 1;
VideoSyncStatus = 2; VideoSyncStatus = 2;
FreeRunEnabled = 3;
// Serial // Serial
CurrentInputResolution = 1; CurrentInputResolution = 1;
// Analog // Analog
@@ -64,6 +79,8 @@ namespace PepperDash.Essentials.Bridges
HdcpSupportCapability = 3; HdcpSupportCapability = 3;
Port1HdcpState = 4; Port1HdcpState = 4;
Port2HdcpState = 5; Port2HdcpState = 5;
VgaBrightness = 6;
VgaContrast = 7;
} }
public override void OffsetJoinNumbers(uint joinStart) public override void OffsetJoinNumbers(uint joinStart)
@@ -72,12 +89,15 @@ namespace PepperDash.Essentials.Bridges
IsOnline = IsOnline + joinOffset; IsOnline = IsOnline + joinOffset;
VideoSyncStatus = VideoSyncStatus + joinOffset; VideoSyncStatus = VideoSyncStatus + joinOffset;
FreeRunEnabled = FreeRunEnabled + joinOffset;
CurrentInputResolution = CurrentInputResolution + joinOffset; CurrentInputResolution = CurrentInputResolution + joinOffset;
VideoInput = VideoInput + joinOffset; VideoInput = VideoInput + joinOffset;
AudioInput = AudioInput + joinOffset; AudioInput = AudioInput + joinOffset;
HdcpSupportCapability = HdcpSupportCapability + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset;
Port1HdcpState = Port1HdcpState + joinOffset; Port1HdcpState = Port1HdcpState + joinOffset;
Port2HdcpState = Port2HdcpState + joinOffset; Port2HdcpState = Port2HdcpState + joinOffset;
VgaBrightness = VgaBrightness + joinOffset;
VgaContrast = VgaContrast + joinOffset;
} }
} }
} }

View File

@@ -23,6 +23,10 @@ namespace PepperDash.Essentials.Core
public StringFeedback TimeRemainingFeedback { get; private set; } public StringFeedback TimeRemainingFeedback { get; private set; }
public bool CountsDown { get; set; } public bool CountsDown { get; set; }
/// <summary>
/// The number of seconds to countdown
/// </summary>
public int SecondsToCount { get; set; } public int SecondsToCount { get; set; }
public DateTime StartTime { get; private set; } public DateTime StartTime { get; private set; }
@@ -31,7 +35,7 @@ namespace PepperDash.Essentials.Core
CTimer SecondTimer; CTimer SecondTimer;
/// <summary> /// <summary>
/// /// Constructor
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
public SecondsCountdownTimer(string key) public SecondsCountdownTimer(string key)
@@ -61,7 +65,7 @@ namespace PepperDash.Essentials.Core
} }
/// <summary> /// <summary>
/// /// Starts the Timer
/// </summary> /// </summary>
public void Start() public void Start()
{ {
@@ -82,7 +86,7 @@ namespace PepperDash.Essentials.Core
} }
/// <summary> /// <summary>
/// /// Restarts the timer
/// </summary> /// </summary>
public void Reset() public void Reset()
{ {
@@ -91,7 +95,7 @@ namespace PepperDash.Essentials.Core
} }
/// <summary> /// <summary>
/// /// Cancels the timer (without triggering it to finish)
/// </summary> /// </summary>
public void Cancel() public void Cancel()
{ {

View File

@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Controller class for all DM-TX-201C/S/F transmitters /// Controller class for all DM-TX-201C/S/F transmitters
/// </summary> /// </summary>
public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls
{ {
public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C
@@ -33,8 +33,10 @@ namespace PepperDash.Essentials.DM
public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; } public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
public IntFeedback VgaBrightnessFeedback { get; protected set; }
public IntFeedback VgaContrastFeedback { get; protected set; }
/// <summary> /// <summary>
/// Helps get the "real" inputs, including when in Auto /// Helps get the "real" inputs, including when in Auto
@@ -122,6 +124,13 @@ namespace PepperDash.Essentials.DM
return 0; return 0;
}); });
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; HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
var combinedFuncs = new VideoStatusFuncsWrapper var combinedFuncs = new VideoStatusFuncsWrapper
@@ -156,7 +165,7 @@ namespace PepperDash.Essentials.DM
}; };
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, 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);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
@@ -174,6 +183,21 @@ namespace PepperDash.Essentials.DM
DmOutput.Port = Tx.DmOutput; 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) void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{ {
ActiveVideoInputFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate();
@@ -184,7 +208,6 @@ namespace PepperDash.Essentials.DM
public override bool CustomActivate() public override bool CustomActivate()
{ {
Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
@@ -195,6 +218,46 @@ namespace PepperDash.Essentials.DM
return base.CustomActivate(); return base.CustomActivate();
} }
/// <summary>
/// Enables or disables free run
/// </summary>
/// <param name="enable"></param>
public void SetFreeRunEnabled(bool enable)
{
if (enable)
{
Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled;
}
else
{
Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled;
}
}
/// <summary>
/// Sets the VGA brightness level
/// </summary>
/// <param name="level"></param>
public void SetVgaBrightness(ushort level)
{
Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
}
/// <summary>
/// Sets the VGA contrast level
/// </summary>
/// <param name="level"></param>
public void SetVgaContrast(ushort level)
{
Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
}
/// <summary>
/// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable)
/// </summary>
/// <param name="input"></param>
/// <param name="output"></param>
/// <param name="type"></param>
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{ {
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
@@ -250,6 +313,7 @@ namespace PepperDash.Essentials.DM
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate(); AudioSourceNumericFeedback.FireUpdate();
} }
} }
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
@@ -264,6 +328,10 @@ namespace PepperDash.Essentials.DM
{ {
HdmiInHdcpCapabilityFeedback.FireUpdate(); HdmiInHdcpCapabilityFeedback.FireUpdate();
} }
else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId)
{
FreeRunEnabledFeedback.FireUpdate();
}
} }
/// <summary> /// <summary>

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Defines a device capable of setting the Free Run state of a VGA input and reporting feedback
/// </summary>
public interface IHasFreeRun
{
BoolFeedback FreeRunEnabledFeedback { get; }
void SetFreeRunEnabled(bool enable);
}
/// <summary>
/// Defines a device capable of adjusting VGA settings
/// </summary>
public interface IVgaBrightnessContrastControls
{
IntFeedback VgaBrightnessFeedback { get; }
IntFeedback VgaContrastFeedback { get; }
void SetVgaBrightness(ushort level);
void SetVgaContrast(ushort level);
}
}

View File

@@ -96,6 +96,7 @@
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" /> <Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
<Compile Include="Chassis\DmpsRoutingController.cs" /> <Compile Include="Chassis\DmpsRoutingController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" /> <Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Endpoints\Transmitters\TxInterfaces.cs" />
<Compile Include="IDmSwitch.cs" /> <Compile Include="IDmSwitch.cs" />
<Compile Include="Config\DmpsRoutingConfig.cs" /> <Compile Include="Config\DmpsRoutingConfig.cs" />
<Compile Include="Config\DmRmcConfig.cs" /> <Compile Include="Config\DmRmcConfig.cs" />