Updated DmTx201CController

This commit is contained in:
Trevor Payne
2020-05-20 12:50:44 -05:00
parent 496b70f73f
commit a657525562

View File

@@ -21,7 +21,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 DmTx201CController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
{ {
public DmTx201C Tx { get; private set; } // uses the 201S class as it is the base class for the 201C public DmTx201C Tx { get; private set; } // uses the 201S class as it is the base class for the 201C
@@ -107,43 +107,29 @@ namespace PepperDash.Essentials.DM
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString()); () => ActualActiveVideoInput.ToString());
Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
Tx.BaseEvent += Tx_BaseEvent; Tx.BaseEvent += Tx_BaseEvent;
Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange);
VideoSourceNumericFeedback = new IntFeedback(() => VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
{
return (int)Tx.VideoSourceFeedback;
});
AudioSourceNumericFeedback = new IntFeedback(() =>
{
return (int)Tx.AudioSourceFeedback;
});
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
{
if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
return 1; (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
else
return 0;
});
HdmiVideoSyncFeedback = new BoolFeedback(() => HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
{
return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue;
});
VgaVideoSyncFeedback = new BoolFeedback(() => VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
{
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); tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
@@ -152,22 +138,18 @@ namespace PepperDash.Essentials.DM
HdcpActiveFeedbackFunc = () => HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
&& tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () => HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ?
{ tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () => VideoResolutionFeedbackFunc = () =>
{ {
if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
return tx.HdmiInput.VideoAttributes.GetVideoResolutionString(); return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ?
return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
return "";
}, },
VideoSyncFeedbackFunc = () => VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
&& tx.HdmiInput.SyncDetectedFeedback.BoolValue) && tx.HdmiInput.SyncDetectedFeedback.BoolValue)
@@ -201,15 +183,16 @@ namespace PepperDash.Essentials.DM
void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{ {
var id = args.EventId; var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId); Debug.Console(2, this, "EventId {0}", args.EventId);
if (id == VideoControlsEventIds.BrightnessFeedbackEventId) switch (id)
{ {
VgaBrightnessFeedback.FireUpdate(); case VideoControlsEventIds.BrightnessFeedbackEventId:
} VgaBrightnessFeedback.FireUpdate();
else if (id == VideoControlsEventIds.ContrastFeedbackEventId) break;
{ case VideoControlsEventIds.ContrastFeedbackEventId:
VgaContrastFeedback.FireUpdate(); VgaContrastFeedback.FireUpdate();
break;
} }
} }
@@ -219,6 +202,19 @@ namespace PepperDash.Essentials.DM
VideoSourceNumericFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate(); AudioSourceNumericFeedback.FireUpdate();
}
private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
switch (args.EventId)
{
case EndpointInputStreamEventIds.FreeRunFeedbackEventId:
FreeRunEnabledFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
VgaVideoSyncFeedback.FireUpdate();
break;
}
} }
public override bool CustomActivate() public override bool CustomActivate()
@@ -235,7 +231,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)
{ {
@@ -254,15 +250,8 @@ namespace PepperDash.Essentials.DM
/// </summary> /// </summary>
/// <param name="enable"></param> /// <param name="enable"></param>
public void SetFreeRunEnabled(bool enable) public void SetFreeRunEnabled(bool enable)
{ {
if (enable) Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
{
Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled;
}
else
{
Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled;
}
} }
/// <summary> /// <summary>
@@ -329,40 +318,40 @@ namespace PepperDash.Essentials.DM
void Tx_BaseEvent(GenericBase device, BaseEventArgs args) void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{ {
var id = args.EventId; var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId); Debug.Console(2, this, "EventId {0}", args.EventId);
if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) switch (id)
{ {
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); case EndpointTransmitterBase.VideoSourceFeedbackEventId:
VideoSourceNumericFeedback.FireUpdate(); Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
ActiveVideoInputFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate();
} VideoSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
// ------------------------------ incomplete ----------------------------------------- break;
else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) case EndpointTransmitterBase.AudioSourceFeedbackEventId:
{ Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate(); break;
} }
} }
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{ {
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); 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:
VgaVideoSyncFeedback.FireUpdate();
break;
}
if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId)
{
HdmiInHdcpCapabilityFeedback.FireUpdate();
}
else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId)
{
HdmiInHdcpCapabilityFeedback.FireUpdate();
}
else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId)
{
FreeRunEnabledFeedback.FireUpdate();
}
} }
/// <summary> /// <summary>
@@ -370,11 +359,12 @@ namespace PepperDash.Essentials.DM
/// </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>