Updated dmTx402302CController

Updated DmTx4k202CController

#200
This commit is contained in:
Trevor Payne
2020-05-20 14:10:27 -05:00
parent 76abd05830
commit dd0a52c1a2
2 changed files with 139 additions and 156 deletions

View File

@@ -186,7 +186,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 (Hdmi1VideoSyncFeedback != null) if (Hdmi1VideoSyncFeedback != null)
{ {
@@ -200,64 +200,65 @@ namespace PepperDash.Essentials.DM
LinkDmTxToApi(this, trilist, joinMap, bridge); LinkDmTxToApi(this, trilist, joinMap, bridge);
} }
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);
if (type == eRoutingSignalType.Video) switch (type)
{ {
switch (input) case eRoutingSignalType.Video:
{ switch (input)
case 0: {
case 0:
{ {
ExecuteSwitch(eVst.Auto, null, type); ExecuteSwitch(eVst.Auto, null, type);
break; break;
} }
case 1: case 1:
{ {
ExecuteSwitch(HdmiIn1.Selector, null, type); ExecuteSwitch(HdmiIn1.Selector, null, type);
break; break;
} }
case 2: case 2:
{ {
ExecuteSwitch(HdmiIn2.Selector, null, type); ExecuteSwitch(HdmiIn2.Selector, null, type);
break; break;
} }
case 3: case 3:
{ {
ExecuteSwitch(eVst.AllDisabled, null, type); ExecuteSwitch(eVst.AllDisabled, null, type);
break; break;
} }
} }
} break;
else if (type == eRoutingSignalType.Audio) case eRoutingSignalType.Audio:
{ switch (input)
switch (input) {
{ case 0:
case 0:
{ {
ExecuteSwitch(eAst.Auto, null, type); ExecuteSwitch(eAst.Auto, null, type);
break; break;
} }
case 1: case 1:
{ {
ExecuteSwitch(eAst.Hdmi1, null, type); ExecuteSwitch(eAst.Hdmi1, null, type);
break; break;
} }
case 2: case 2:
{ {
ExecuteSwitch(eAst.Hdmi2, null, type); ExecuteSwitch(eAst.Hdmi2, null, type);
break; break;
} }
case 3: case 3:
{ {
ExecuteSwitch(eAst.AllDisabled, null, type); ExecuteSwitch(eAst.AllDisabled, null, type);
break; break;
} }
} }
} break;
} }
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{ {
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)

View File

@@ -105,44 +105,24 @@ namespace PepperDash.Essentials.DM
() => ActualActiveVideoInput.ToString()); () => ActualActiveVideoInput.ToString());
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
Tx.BaseEvent += Tx_BaseEvent; Tx.BaseEvent += Tx_BaseEvent;
VideoSourceNumericFeedback = new IntFeedback(() => VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
{ AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
return (int)Tx.VideoSourceFeedback;
});
AudioSourceNumericFeedback = new IntFeedback(() =>
{
return (int)Tx.AudioSourceFeedback;
});
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
{
return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback;
});
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
{
return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback;
});
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
{
return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue;
});
Hdmi2VideoSyncFeedback = new BoolFeedback(() => Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
{
return (bool)tx.HdmiInputs[2].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);
@@ -164,9 +144,7 @@ namespace PepperDash.Essentials.DM
{ {
if (ActualActiveVideoInput == eVst.Hdmi1) if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
if (ActualActiveVideoInput == eVst.Hdmi2) return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : "";
return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
return "";
}, },
VideoResolutionFeedbackFunc = () => VideoResolutionFeedbackFunc = () =>
@@ -175,9 +153,7 @@ namespace PepperDash.Essentials.DM
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2) if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Vga) return ActualActiveVideoInput == eVst.Vga ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
return tx.VgaInput.VideoAttributes.GetVideoResolutionString();
return "";
}, },
VideoSyncFeedbackFunc = () => VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1 (ActualActiveVideoInput == eVst.Hdmi1
@@ -209,20 +185,34 @@ namespace PepperDash.Essentials.DM
HdmiIn2.Port = Tx.HdmiInputs[2]; HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput; HdmiLoopOut.Port = Tx.HdmiOutput;
DmOut.Port = Tx.DmOutput; DmOut.Port = Tx.DmOutput;
} }
void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
switch (args.EventId)
{
case EndpointInputStreamEventIds.FreeRunFeedbackEventId:
FreeRunEnabledFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
VgaVideoSyncFeedback.FireUpdate();
break;
}
}
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;
} }
} }
@@ -246,7 +236,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 (Hdmi1VideoSyncFeedback != null) if (Hdmi1VideoSyncFeedback != null)
{ {
@@ -268,18 +258,11 @@ namespace PepperDash.Essentials.DM
/// Enables or disables free run /// Enables or disables free run
/// </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>
/// Sets the VGA brightness level /// Sets the VGA brightness level
/// </summary> /// </summary>
@@ -300,74 +283,75 @@ namespace PepperDash.Essentials.DM
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);
if (type == eRoutingSignalType.Video) switch (type)
{ {
switch (input) case eRoutingSignalType.Video:
{ switch (input)
case 0: {
case 0:
{ {
ExecuteSwitch(eVst.Auto, null, type); ExecuteSwitch(eVst.Auto, null, type);
break; break;
} }
case 1: case 1:
{ {
ExecuteSwitch(HdmiIn1.Selector, null, type); ExecuteSwitch(HdmiIn1.Selector, null, type);
break; break;
} }
case 2: case 2:
{ {
ExecuteSwitch(HdmiIn2.Selector, null, type); ExecuteSwitch(HdmiIn2.Selector, null, type);
break; break;
} }
case 3: case 3:
{ {
ExecuteSwitch(VgaIn.Selector, null, type); ExecuteSwitch(VgaIn.Selector, null, type);
break; break;
} }
case 4: case 4:
{ {
ExecuteSwitch(eVst.AllDisabled, null, type); ExecuteSwitch(eVst.AllDisabled, null, type);
break; break;
} }
} }
} break;
else if (type == eRoutingSignalType.Audio) case eRoutingSignalType.Audio:
{ switch (input)
switch (input) {
{ case 0:
case 0:
{ {
ExecuteSwitch(eAst.Auto, null, type); ExecuteSwitch(eAst.Auto, null, type);
break; break;
} }
case 1: case 1:
{ {
ExecuteSwitch(eAst.Hdmi1, null, type); ExecuteSwitch(eAst.Hdmi1, null, type);
break; break;
} }
case 2: case 2:
{ {
ExecuteSwitch(eAst.Hdmi2, null, type); ExecuteSwitch(eAst.Hdmi2, null, type);
break; break;
} }
case 3: case 3:
{ {
ExecuteSwitch(eAst.AudioIn, null, type); ExecuteSwitch(eAst.AudioIn, null, type);
break; break;
} }
case 4: case 4:
{ {
ExecuteSwitch(eAst.AllDisabled, null, type); ExecuteSwitch(eAst.AllDisabled, null, type);
break; break;
} }
} }
} break;
} }
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{ {
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
@@ -376,54 +360,52 @@ namespace PepperDash.Essentials.DM
Tx.AudioSource = (eAst)inputSelector; Tx.AudioSource = (eAst)inputSelector;
} }
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}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) switch (args.EventId)
{ {
if (inputStream == Tx.HdmiInputs[1]) case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
HdmiIn1HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1])
else if (inputStream == Tx.HdmiInputs[2]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
HdmiIn2HdcpCapabilityFeedback.FireUpdate(); else if (inputStream == Tx.HdmiInputs[2])
} HdmiIn2HdcpCapabilityFeedback.FireUpdate();
else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) break;
{ case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) if (inputStream == Tx.HdmiInputs[1])
HdmiIn1HdcpCapabilityFeedback.FireUpdate(); HdmiIn1HdcpCapabilityFeedback.FireUpdate();
else if (inputStream == Tx.HdmiInputs[2]) else if (inputStream == Tx.HdmiInputs[2])
HdmiIn2HdcpCapabilityFeedback.FireUpdate(); HdmiIn2HdcpCapabilityFeedback.FireUpdate();
} break;
} }
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
var id = args.EventId; {
if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) var id = args.EventId;
{ switch (id)
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); {
VideoSourceNumericFeedback.FireUpdate(); case EndpointTransmitterBase.VideoSourceFeedbackEventId:
ActiveVideoInputFeedback.FireUpdate(); Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
} 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;
} }
} }
/// <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) return;
{ inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
} }
/// <summary> /// <summary>