From 0fad667fabfc1fc5f1776cd6891c228254ed38e0 Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 13 Sep 2023 08:56:13 -0500 Subject: [PATCH 1/8] fix: adds additional debug statements when attempting to get feedback property for device --- .../Touchpanels/Mpc3Touchpanel.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Mpc3Touchpanel.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Mpc3Touchpanel.cs index f1153879..296965f9 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Mpc3Touchpanel.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/Mpc3Touchpanel.cs @@ -155,7 +155,7 @@ namespace PepperDash.Essentials.Core.Touchpanels return; } - Feedback deviceFeedback = null; + Feedback deviceFeedback; try { @@ -166,9 +166,16 @@ namespace PepperDash.Essentials.Core.Touchpanels key, buttonFeedback.DeviceKey); return; } + + deviceFeedback = device.GetFeedbackProperty(buttonFeedback.FeedbackName); + if (deviceFeedback == null) + { + Debug.Console(1, this, "Button '{0}' feedback failed to get feedback property for '{1}', feedback will not be implemented. Verify feedback deviceKey is properly configured.", + key, buttonFeedback.FeedbackName); + return; + } // TODO [ ] verify if this can replace the current method - deviceFeedback = device.GetFeedbackProperty(buttonFeedback.FeedbackName); //Debug.Console(0, this, "deviceFeedback.GetType().Name: '{0}'", deviceFeedback.GetType().Name); //switch (feedback.GetType().Name.ToLower()) //{ From 5a67a4060db2c715081f05cbb428218b919c9c76 Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 13 Sep 2023 09:31:25 -0500 Subject: [PATCH 2/8] feat: adds routing sync provider interface and delegate --- .../PepperDashEssentialsBase/Routing/RoutingInterfaces.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 467bf045..e24480ff 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -204,4 +204,11 @@ namespace PepperDash.Essentials.Core SigType = sigType; } } + + public interface IRoutingSyncProvider + { + event RoutingSyncProviderDelegate SyncChanged; + } + + public delegate void RoutingSyncProviderDelegate(uint inputNumber, bool hasSync); } \ No newline at end of file From 8b6a9db7e0a04aac3868e8b31d4883f52de7dc6c Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 13 Sep 2023 09:32:44 -0500 Subject: [PATCH 3/8] refactor: refactors GetCecPort method --- .../Comm and IR/CommFactory.cs | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs index 9667b5b9..fd5fcfe2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs @@ -117,39 +117,37 @@ namespace PepperDash.Essentials.Core { var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey); - if (dev != null) - { - if (!String.IsNullOrEmpty(config.ControlPortName)) - { + Debug.Console(0, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null + ? "is not valid, failed to create build cec port" + : "found in device manager, attempting to build cec port"); - var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName]; + if (dev == null) + return null; - if (inputPort != null) - { - if (inputPort.Port is ICec) - return inputPort.Port as ICec; - } + if (String.IsNullOrEmpty(config.ControlPortName)) + { + Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey); + return null; + } - var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName]; + var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName]; + if (inputPort != null) + { + if (inputPort.Port is ICec) + return inputPort.Port as ICec; + } - if (outputPort != null) - { - if (outputPort.Port is ICec) - return outputPort.Port as ICec; - } + var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName]; + if (outputPort != null) + { + if (outputPort.Port is ICec) + return outputPort.Port as ICec; + } - else - Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'", - config.ControlPortDevKey, config.ControlPortName); - } - else - { - Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey); - } - } - Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey); + Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'", + config.ControlPortDevKey, config.ControlPortName); - return null; + return null; } /// From 9fb16f30b06ec392aa7194dbbacd2a7177c8520a Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 13 Sep 2023 10:02:20 -0500 Subject: [PATCH 4/8] refactor: Changes IRoutingHasSync interface - Changed IRoutingHasSync interface to IRoutingHasVideoInputSyncFeedbacks. - Remvoed IRoutingHasSynDelegate - Added interface to HdPsXxxController class --- .../PepperDashEssentialsBase/Routing/RoutingInterfaces.cs | 8 +++----- .../Essentials_DM/Chassis/HdPsXxxController.cs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index e24480ff..45245066 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -205,10 +205,8 @@ namespace PepperDash.Essentials.Core } } - public interface IRoutingSyncProvider + public interface IRoutingHasVideoInputSyncFeedbacks { - event RoutingSyncProviderDelegate SyncChanged; - } - - public delegate void RoutingSyncProviderDelegate(uint inputNumber, bool hasSync); + FeedbackCollection VideoInputSyncFeedbacks { get; } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs index bba85d25..1bf40083 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs @@ -15,7 +15,7 @@ using PepperDash_Essentials_DM.Config; namespace PepperDash_Essentials_DM.Chassis { [Description("Wrapper class for all HdPsXxx switchers")] - public class HdPsXxxController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback + public class HdPsXxxController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IRoutingHasVideoInputSyncFeedbacks { private readonly HdPsXxx _chassis; //private byte[] _inputPriorityParams; From 393033b6c9c4a80778e2c68c3921f97bc592db9d Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 13 Sep 2023 10:13:39 -0500 Subject: [PATCH 5/8] refactor: Updates HdPsXxxController class - Modifies `SetupInput()` and `SetupOutput()` - Renames `GetInputPriorities()` to `SetInputPriorities()` --- .../Chassis/HdPsXxxController.cs | 106 ++++++++---------- 1 file changed, 46 insertions(+), 60 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs index 1bf40083..705061d2 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; @@ -18,7 +19,6 @@ namespace PepperDash_Essentials_DM.Chassis public class HdPsXxxController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IRoutingHasVideoInputSyncFeedbacks { private readonly HdPsXxx _chassis; - //private byte[] _inputPriorityParams; public RoutingPortCollection InputPorts { get; private set; } public RoutingPortCollection OutputPorts { get; private set; } @@ -41,6 +41,7 @@ namespace PepperDash_Essentials_DM.Chassis public event EventHandler NumericSwitchChange; public event EventHandler DmInputChange; + /// /// Constructor /// @@ -76,12 +77,6 @@ namespace PepperDash_Essentials_DM.Chassis if (_chassis.NumberOfOutputs == 1) AutoRouteFeedback = new BoolFeedback(() => _chassis.PriorityRouteOnFeedback.BoolValue); - //if (props.InputPriorities != null) - //{ - // _inputPriorityParams = new byte[_chassis.NumberOfInputs]; - // _inputPriorityParams = GetInputPriorities(props); - //} - InputNames = props.Inputs; SetupInputs(InputNames); @@ -90,7 +85,7 @@ namespace PepperDash_Essentials_DM.Chassis } // get input priorities - private byte[] GetInputPriorities(HdPsXxxPropertiesConfig props) + private byte[] SetInputPriorities(HdPsXxxPropertiesConfig props) { throw new NotImplementedException(); } @@ -103,52 +98,59 @@ namespace PepperDash_Essentials_DM.Chassis Debug.Console(1, this, "Failed to setup inputs, properties are null"); return; } - foreach (var kvp in dict) - { - Debug.Console(1, this, "props.Input[{0}]: {1}", kvp.Key, kvp.Value); - } - + + // iterate through HDMI inputs foreach (var item in _chassis.HdmiInputs) { var input = item; var index = item.Number; var key = string.Format("hdmiIn{0}", index); - var name = string.IsNullOrEmpty(InputNames[index]) ? string.Format("HDMI Input {0}", index) : InputNames[index]; + input.Name.StringValue = string.IsNullOrEmpty(InputNames[index]) + ? string.Format("HDMI Input {0}", index) + : InputNames[index]; - InputNameFeedbacks.Add(new StringFeedback(name, () => InputNames[index])); + InputNameFeedbacks.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), + () => InputNames[index])); var port = new RoutingInputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, input, this) { FeedbackMatchObject = input }; - Debug.Console(1, this, "Adding Input port: {0}", port.Key); + Debug.Console(1, this, "Adding Input port: {0} - {1}", port.Key, input.Name); InputPorts.Add(port); - InputHdcpEnableFeedback.Add(new BoolFeedback(name, () => input.InputPort.HdcpSupportOnFeedback.BoolValue)); + InputHdcpEnableFeedback.Add(new BoolFeedback(index.ToString(CultureInfo.InvariantCulture), + () => input.InputPort.HdcpSupportOnFeedback.BoolValue)); - VideoInputSyncFeedbacks.Add(new BoolFeedback(name, () => input.VideoDetectedFeedback.BoolValue)); + VideoInputSyncFeedbacks.Add(new BoolFeedback(index.ToString(CultureInfo.InvariantCulture), + () => input.VideoDetectedFeedback.BoolValue)); } + // iterate through DM Lite inputs foreach (var item in _chassis.DmLiteInputs) { var input = item; var index = item.Number; var key = string.Format("dmLiteIn{0}", index); - var name = string.IsNullOrEmpty(InputNames[index]) ? string.Format("DM Input {0}", index) : InputNames[index]; - input.Name.StringValue = name; + input.Name.StringValue = string.IsNullOrEmpty(InputNames[index]) + ? string.Format("DM Input {0}", index) + : InputNames[index]; - InputNameFeedbacks.Add(new StringFeedback(name, () => InputNames[index])); + InputNameFeedbacks.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), + () => InputNames[index])); var port = new RoutingInputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, input, this) { FeedbackMatchObject = input }; - Debug.Console(0, this, "Adding Input port: {0}", port.Key); + Debug.Console(0, this, "Adding Input port: {0} - {1}", port.Key, input.Name); InputPorts.Add(port); - InputHdcpEnableFeedback.Add(new BoolFeedback(name, () => input.InputPort.HdcpSupportOnFeedback.BoolValue)); + InputHdcpEnableFeedback.Add(new BoolFeedback(index.ToString(CultureInfo.InvariantCulture), + () => input.InputPort.HdcpSupportOnFeedback.BoolValue)); - VideoInputSyncFeedbacks.Add(new BoolFeedback(name, () => input.VideoDetectedFeedback.BoolValue)); + VideoInputSyncFeedbacks.Add(new BoolFeedback(index.ToString(CultureInfo.InvariantCulture), + () => input.VideoDetectedFeedback.BoolValue)); } _chassis.DMInputChange += _chassis_InputChange; @@ -162,54 +164,38 @@ namespace PepperDash_Essentials_DM.Chassis Debug.Console(1, this, "Failed to setup outputs, properties are null"); return; } - foreach (var kvp in dict) - { - Debug.Console(1, this, "props.Output[{0}]: {1}", kvp.Key, kvp.Value); - } foreach (var item in _chassis.HdmiDmLiteOutputs) { var output = item; var index = item.Number; var key = string.Format("hdmiDmLiteOut{0}", index); - var name = string.IsNullOrEmpty(OutputNames[index]) ? string.Format("Output {0}", index) : OutputNames[index]; - output.Name.StringValue = name; + + output.Name.StringValue = string.IsNullOrEmpty(OutputNames[index]) + ? string.Format("Output {0}", index) + : OutputNames[index]; - var port = new RoutingOutputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, output, this) + var hdmiPort = new RoutingOutputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, output, this) { FeedbackMatchObject = output, - // set port for CEC - Port = output + Port = output.HdmiOutput.HdmiOutputPort.StreamCec }; - Debug.Console(0, this, "Adding Output port: {0}", port.Key); - OutputPorts.Add(port); + Debug.Console(1, this, "Adding Output port: {0} - {1}", hdmiPort.Key, output.Name); + OutputPorts.Add(hdmiPort); - OutputRouteNameFeedback.Add(new StringFeedback(name, () => output.VideoOutFeedback.NameFeedback.StringValue)); + var dmLitePort = new RoutingOutputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, output, this) + { + FeedbackMatchObject = output, + Port = output.DmLiteOutput.DmLiteOutputPort.StreamCec + }; + Debug.Console(1, this, "Adding Output port: {0} - {1}", dmLitePort.Key, output.Name); + OutputPorts.Add(dmLitePort); - VideoOutputRouteFeedbacks.Add(new IntFeedback(name, + OutputRouteNameFeedback.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), + () => output.VideoOutFeedback.NameFeedback.StringValue)); + + VideoOutputRouteFeedbacks.Add(new IntFeedback(index.ToString(CultureInfo.InvariantCulture), () => output.VideoOutFeedback == null ? 0 : (int)output.VideoOutFeedback.Number)); - - // TODO [ ] Investigate setting input priorities per output - // {{in1-priority-level}, {in2-priority-level}, .... {in6-priority-level}} - // default priority level input 1-4 ascending - //if (_inputPriorityParams != null && _inputPriorityParams.Count() > 0) - // output.OutputPort.InputPriorities(_inputPriorityParams); - - if (port.Port == null) continue; - - var hdmiOutputStreamCec = output.HdmiOutput.HdmiOutputPort.StreamCec; - if (hdmiOutputStreamCec != null) - { - var streamCec = new StreamCecWrapper(string.Format("{0}-hdmiOut{1}-streamCec", Key, index), hdmiOutputStreamCec); - DeviceManager.AddDevice(streamCec); - } - - var dmLiteOutputStreamCec = output.DmLiteOutput.DmLiteOutputPort.StreamCec; - if (dmLiteOutputStreamCec != null) - { - var streamCec = new StreamCecWrapper(string.Format("{0}-dmLiteOut{1}-streamCec", Key, index), dmLiteOutputStreamCec); - DeviceManager.AddDevice(streamCec); - } } _chassis.DMOutputChange += _chassis_OutputChange; @@ -547,7 +533,7 @@ namespace PepperDash_Essentials_DM.Chassis } - #endregion + #endregion } From 7ecb2ecf6dfeadcf2191d49cca1be0a03e10b54d Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 13 Sep 2023 16:43:23 -0500 Subject: [PATCH 6/8] fix: updates SetupOutputs to create a hdmiOutX and dmLiteOutX port --- .../Chassis/HdPsXxxController.cs | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs index 705061d2..cbcf2a7c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs @@ -105,10 +105,12 @@ namespace PepperDash_Essentials_DM.Chassis var input = item; var index = item.Number; var key = string.Format("hdmiIn{0}", index); - input.Name.StringValue = string.IsNullOrEmpty(InputNames[index]) - ? string.Format("HDMI Input {0}", index) + var name = string.IsNullOrEmpty(InputNames[index]) + ? string.Format("HDMI Input {0}", index) : InputNames[index]; + input.Name.StringValue = name; + InputNameFeedbacks.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), () => InputNames[index])); @@ -116,7 +118,7 @@ namespace PepperDash_Essentials_DM.Chassis { FeedbackMatchObject = input }; - Debug.Console(1, this, "Adding Input port: {0} - {1}", port.Key, input.Name); + Debug.Console(1, this, "Adding Input port: {0} - {1}", port.Key, name); InputPorts.Add(port); InputHdcpEnableFeedback.Add(new BoolFeedback(index.ToString(CultureInfo.InvariantCulture), @@ -132,10 +134,12 @@ namespace PepperDash_Essentials_DM.Chassis var input = item; var index = item.Number; var key = string.Format("dmLiteIn{0}", index); - input.Name.StringValue = string.IsNullOrEmpty(InputNames[index]) + var name = string.IsNullOrEmpty(InputNames[index]) ? string.Format("DM Input {0}", index) : InputNames[index]; + input.Name.StringValue = name; + InputNameFeedbacks.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), () => InputNames[index])); @@ -143,7 +147,7 @@ namespace PepperDash_Essentials_DM.Chassis { FeedbackMatchObject = input }; - Debug.Console(0, this, "Adding Input port: {0} - {1}", port.Key, input.Name); + Debug.Console(0, this, "Adding Input port: {0} - {1}", port.Key, name); InputPorts.Add(port); InputHdcpEnableFeedback.Add(new BoolFeedback(index.ToString(CultureInfo.InvariantCulture), @@ -169,26 +173,28 @@ namespace PepperDash_Essentials_DM.Chassis { var output = item; var index = item.Number; - var key = string.Format("hdmiDmLiteOut{0}", index); - - output.Name.StringValue = string.IsNullOrEmpty(OutputNames[index]) + var name = string.IsNullOrEmpty(OutputNames[index]) ? string.Format("Output {0}", index) - : OutputNames[index]; + : OutputNames[index]; + + output.Name.StringValue = name; - var hdmiPort = new RoutingOutputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, output, this) + var hdmiKey = string.Format("hdmiOut{0}", index); + var hdmiPort = new RoutingOutputPort(hdmiKey, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, output, this) { FeedbackMatchObject = output, Port = output.HdmiOutput.HdmiOutputPort.StreamCec }; - Debug.Console(1, this, "Adding Output port: {0} - {1}", hdmiPort.Key, output.Name); + Debug.Console(1, this, "Adding Output port: {0} - {1}", hdmiPort.Key, name); OutputPorts.Add(hdmiPort); - var dmLitePort = new RoutingOutputPort(key, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, output, this) + var dmLiteKey = string.Format("dmLiteOut{0}", index); + var dmLitePort = new RoutingOutputPort(dmLiteKey, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, output, this) { FeedbackMatchObject = output, Port = output.DmLiteOutput.DmLiteOutputPort.StreamCec }; - Debug.Console(1, this, "Adding Output port: {0} - {1}", dmLitePort.Key, output.Name); + Debug.Console(1, this, "Adding Output port: {0} - {1}", dmLitePort.Key, name); OutputPorts.Add(dmLitePort); OutputRouteNameFeedback.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), From 6d020132cfb2283fbcd1fa3bee89f3f4081eedac Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 20 Sep 2023 15:38:25 -0500 Subject: [PATCH 7/8] refactor: GetCecPort method to handle exceptions --- .../Comm and IR/CommFactory.cs | 71 +++++++++++-------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs index fd5fcfe2..549404e0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs @@ -115,39 +115,54 @@ namespace PepperDash.Essentials.Core /// public static ICec GetCecPort(ControlPropertiesConfig config) { - var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey); - - Debug.Console(0, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null - ? "is not valid, failed to create build cec port" - : "found in device manager, attempting to build cec port"); - - if (dev == null) - return null; - - if (String.IsNullOrEmpty(config.ControlPortName)) + try { - Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey); - return null; + var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey); + + Debug.Console(0, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null + ? "is not valid, failed to get cec port" + : "found in device manager, attempting to get cec port"); + + if (dev == null) + return null; + + if (String.IsNullOrEmpty(config.ControlPortName)) + { + Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey); + return null; + } + + + var inputsOutputs = dev as IRoutingInputsOutputs; + if (inputsOutputs == null) + { + Debug.Console(0, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'", + config.ControlPortDevKey, config.ControlPortName); + + return null; + } + + var inputPort = inputsOutputs.InputPorts[config.ControlPortName]; + if (inputPort != null && inputPort.Port is ICec) + return inputPort.Port as ICec; + + + var outputPort = inputsOutputs.OutputPorts[config.ControlPortName]; + if (outputPort != null && outputPort.Port is ICec) + return outputPort.Port as ICec; + } + catch (Exception ex) + { + Debug.Console(1, "GetCecPort Exception Message: {0}", ex.Message); + Debug.Console(2, "GetCecPort Exception StackTrace: {0}", ex.StackTrace); + if (ex.InnerException != null) + Debug.Console(0, "GetCecPort Exception InnerException: {0}", ex.InnerException); } - var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName]; - if (inputPort != null) - { - if (inputPort.Port is ICec) - return inputPort.Port as ICec; - } - - var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName]; - if (outputPort != null) - { - if (outputPort.Port is ICec) - return outputPort.Port as ICec; - } - - Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'", + Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'", config.ControlPortDevKey, config.ControlPortName); - return null; + return null; } /// From 1569c12450a11c8b99b1b8f6f0d917b0d35a0dde Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 20 Sep 2023 15:41:06 -0500 Subject: [PATCH 8/8] fix: Updates SetupOutputs method Corrects the port referencece to exclude `.StreamCec` when building the port. --- .../Essentials_DM/Chassis/HdPsXxxController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs index cbcf2a7c..bf9f72cc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdPsXxxController.cs @@ -183,7 +183,7 @@ namespace PepperDash_Essentials_DM.Chassis var hdmiPort = new RoutingOutputPort(hdmiKey, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, output, this) { FeedbackMatchObject = output, - Port = output.HdmiOutput.HdmiOutputPort.StreamCec + Port = output.HdmiOutput.HdmiOutputPort }; Debug.Console(1, this, "Adding Output port: {0} - {1}", hdmiPort.Key, name); OutputPorts.Add(hdmiPort); @@ -192,13 +192,13 @@ namespace PepperDash_Essentials_DM.Chassis var dmLitePort = new RoutingOutputPort(dmLiteKey, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, output, this) { FeedbackMatchObject = output, - Port = output.DmLiteOutput.DmLiteOutputPort.StreamCec + Port = output.DmLiteOutput.DmLiteOutputPort }; Debug.Console(1, this, "Adding Output port: {0} - {1}", dmLitePort.Key, name); OutputPorts.Add(dmLitePort); - + OutputRouteNameFeedback.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture), - () => output.VideoOutFeedback.NameFeedback.StringValue)); + () => output.VideoOutFeedback.NameFeedback.StringValue)); VideoOutputRouteFeedbacks.Add(new IntFeedback(index.ToString(CultureInfo.InvariantCulture), () => output.VideoOutFeedback == null ? 0 : (int)output.VideoOutFeedback.Number));