Updated DmTx401CController

#200
This commit is contained in:
Trevor Payne
2020-05-20 13:42:39 -05:00
parent e0e9fc2ce4
commit 102535cd04
4 changed files with 145 additions and 121 deletions

View File

@@ -146,9 +146,10 @@ 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);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
@@ -324,7 +325,7 @@ namespace PepperDash.Essentials.DM
HdmiInHdcpCapabilityFeedback.FireUpdate(); HdmiInHdcpCapabilityFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
VgaVideoSyncFeedback.FireUpdate(); HdmiVideoSyncFeedback.FireUpdate();
break; break;
} }
} }

View File

@@ -342,7 +342,7 @@ namespace PepperDash.Essentials.DM
HdmiInHdcpCapabilityFeedback.FireUpdate(); HdmiInHdcpCapabilityFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
VgaVideoSyncFeedback.FireUpdate(); HdmiVideoSyncFeedback.FireUpdate();
break; break;
} }

View File

@@ -342,7 +342,7 @@ namespace PepperDash.Essentials.DM
HdmiInHdcpCapabilityFeedback.FireUpdate(); HdmiInHdcpCapabilityFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
VgaVideoSyncFeedback.FireUpdate(); HdmiVideoSyncFeedback.FireUpdate();
break; break;
} }

View File

@@ -19,12 +19,10 @@ namespace PepperDash.Essentials.DM
{ {
using eVst = DmTx401C.eSourceSelection; 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 DmTx401C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; } public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; }
public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; } public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; }
public RoutingInputPortWithVideoStatuses VgaIn { get; private set; } public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
@@ -114,53 +112,38 @@ namespace PepperDash.Essentials.DM
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput));
CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn, CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn,
eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this, 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", ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualVideoInput.ToString()); () => ActualVideoInput.ToString());
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
VideoSourceNumericFeedback = new IntFeedback(() => AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
{
return (int)Tx.VideoSourceFeedback; HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
});
AudioSourceNumericFeedback = new IntFeedback(() =>
{
return (int)Tx.AudioSourceFeedback;
});
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
{
if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue);
return 1;
else HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
return 0;
}); VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
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;
});
FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange);
var combinedFuncs = new VideoStatusFuncsWrapper var combinedFuncs = new VideoStatusFuncsWrapper
{ {
@@ -238,7 +221,7 @@ namespace PepperDash.Essentials.DM
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) 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) if (HdmiVideoSyncFeedback != null)
{ {
@@ -298,86 +281,82 @@ namespace PepperDash.Essentials.DM
Tx.VideoSource = (eVst)inputSelector; Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eVst)inputSelector; 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) /// <summary>
{ /// Enables or disables free run
var id = args.EventId; /// </summary>
if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) /// <param name="enable"></param>
{ public void SetFreeRunEnabled(bool enable)
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); {
VideoSourceNumericFeedback.FireUpdate(); Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
ActiveVideoInputFeedback.FireUpdate(); }
}
/// <summary>
// ------------------------------ incomplete ----------------------------------------- /// Sets the VGA brightness level
else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) /// </summary>
{ /// <param name="level"></param>
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); public void SetVgaBrightness(ushort level)
AudioSourceNumericFeedback.FireUpdate(); {
} Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
} }
void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) /// <summary>
{ /// Sets the VGA contrast level
var id = args.EventId; /// </summary>
Debug.Console(2, this, "EventId {0}", args.EventId); /// <param name="level"></param>
public void SetVgaContrast(ushort level)
if (id == VideoControlsEventIds.BrightnessFeedbackEventId) {
{ Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
VgaBrightnessFeedback.FireUpdate();
}
else if (id == VideoControlsEventIds.ContrastFeedbackEventId)
{
VgaContrastFeedback.FireUpdate();
}
}
/// <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> /// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort. /// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary> /// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{ {
if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{ {
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); return;
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); }
} inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
} AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary> /// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort /// Relays the VideoAttributes change to a RoutingInputPort
@@ -407,7 +386,51 @@ namespace PepperDash.Essentials.DM
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break; 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 #region IIROutputPorts Members