From 76abd05830abe554d26fa0ab2dec83eef69309c2 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 13:55:37 -0500 Subject: [PATCH] Updated DmTx4k202CController #200 --- .../Transmitters/DmTx4k202CController.cs | 109 ++++++++---------- 1 file changed, 48 insertions(+), 61 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 460876b4..0f9fa19d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -98,38 +98,21 @@ namespace PepperDash.Essentials.DM Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; - Tx.BaseEvent += Tx_BaseEvent; + Tx.BaseEvent += Tx_BaseEvent; + + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); - HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => - { - return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback; - }); + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); - HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => - { - return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback; - }); + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - Hdmi1VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; - }); + Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); - Hdmi2VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; - }); + Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); var combinedFuncs = new VideoStatusFuncsWrapper { @@ -285,52 +268,56 @@ namespace PepperDash.Essentials.DM void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); + break; } } void Tx_BaseEvent(GenericBase device, BaseEventArgs args) - { - var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } + { + 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); + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } } /// /// Relays the input stream change to the appropriate RoutingInputPort. /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } + { + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + return; + } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } ///