From 061109c901b7e5aa33ee8f5ad0c613243f73c20d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 21 Oct 2020 10:05:19 -0600 Subject: [PATCH 1/5] add method to create a rmc for DMPS chassis --- .../Endpoints/Receivers/DmRmcHelper.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index b3d9b478..ef42891f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -221,6 +221,10 @@ namespace PepperDash.Essentials.DM DmRmcPropertiesConfig props, string pKey, uint ipid) { var parentDev = DeviceManager.GetDeviceForKey(pKey); + if (parentDev is DmpsRoutingController) + { + return GetDmRmcControllerForDmps(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber); + } if (!(parentDev is IDmSwitch)) { Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", @@ -285,6 +289,26 @@ namespace PepperDash.Essentials.DM return null; } + private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName, + DmpsRoutingController controller, uint num) + { + Func dmpsHandler; + if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmpsHandler)) + { + var output = controller.Dmps.SwitcherOutputs[num] as DMOutput; + + if (output != null) + { + return dmpsHandler(key, name, output); + } + Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot attach DM-RMC of type '{0}' to output {1} on DMPS chassis. Output is not a DM Output", typeName, num); + return null; + } + + Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS chassis", typeName, num); + return null; + } + private static CrestronGenericBaseDevice GetDmRmcControllerForProcessor(string key, string name, string typeName, uint ipid) { try @@ -305,6 +329,8 @@ namespace PepperDash.Essentials.DM return null; } } + + } public class DmRmcControllerFactory : EssentialsDeviceFactory From d8863142c71f686a0722058f2397258554f96be5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 21 Oct 2020 10:21:40 -0600 Subject: [PATCH 2/5] Refactor CustomActivate & LinkToApi --- .../Chassis/DmpsRoutingController.cs | 270 +++++++++++------- 1 file changed, 160 insertions(+), 110 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 8c36e209..55e0c037 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -128,32 +128,51 @@ namespace PepperDash.Essentials.DM public override bool CustomActivate() { // Set input and output names from config - if (InputNames != null) - { - foreach (var kvp in InputNames) - { - var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput); - if (input != null) - input.Name.StringValue = kvp.Value; - } - } - if (OutputNames != null) - { - foreach (var kvp in OutputNames) - { - var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput); - if (output != null) - output.Name.StringValue = kvp.Value; - } - } + SetInputNames(); + + SetOutputNames(); // Subscribe to events - Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange); - Dmps.DMOutputChange += new DMOutputEventHandler(Dmps_DMOutputChange); + Dmps.DMInputChange += Dmps_DMInputChange; + Dmps.DMOutputChange += Dmps_DMOutputChange; return base.CustomActivate(); - } - + } + + private void SetOutputNames() + { + if (OutputNames == null) + { + return; + } + + foreach (var kvp in OutputNames) + { + var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput); + if (output != null && output.Name != null) + { + + output.Name.StringValue = kvp.Value; + } + } + } + + private void SetInputNames() + { + if (InputNames == null) + { + return; + } + foreach (var kvp in InputNames) + { + var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput); + if (input != null && input.Name != null) + { + input.Name.StringValue = kvp.Value; + } + } + } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmpsRoutingControllerJoinMap(joinStart); @@ -175,105 +194,136 @@ namespace PepperDash.Essentials.DM Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // Link up outputs - for (uint i = 1; i <= Dmps.NumberOfSwitcherInputs; i++) - { - Debug.Console(2, this, "Linking Input Card {0}", i); + LinkInputsToApi(trilist, joinMap); - var ioSlot = i; - var ioSlotJoin = ioSlot - 1; - - //if (TxDictionary.ContainsKey(ioSlot)) - //{ - // Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); - // var TxKey = TxDictionary[ioSlot]; - // var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase; - // //TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - // // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - // // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u))); - // // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]); - // // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability; - //} - //else - //{ - // // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]); - //} - - if (VideoInputSyncFeedbacks[ioSlot] != null) - VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); - - if (InputNameFeedbacks[ioSlot] != null) - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); + LinkOutputsToApi(trilist, joinMap); + } + + private void LinkOutputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap) + { + for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++) + { + Debug.Console(2, this, "Linking Output Card {0}", i); - trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, new Action(s => - { - var inputCard = Dmps.SwitcherInputs[ioSlot] as DMInput; - - if (inputCard != null) - { - if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) && inputCard.NameFeedback.StringValue != s) - if (inputCard.Name != null) - inputCard.Name.StringValue = s; - } - })); - - - if (InputEndpointOnlineFeedbacks[ioSlot] != null) - InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); - } - - for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++) - { - Debug.Console(2, this, "Linking Output Card {0}", i); - var ioSlot = i; - var ioSlotJoin = ioSlot - 1; - + var ioSlotJoin = ioSlot - 1; + // Control - trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); - trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); + trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, + o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); + trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, + o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); - trilist.SetStringSigAction(joinMap.OutputNames.JoinNumber + ioSlotJoin, s => - { - var outputCard = Dmps.SwitcherOutputs[ioSlot] as DMOutput; - - //Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot); - - if (outputCard != null) - { - //Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType); - - if (!(outputCard is Card.Dmps3CodecOutput) && outputCard.NameFeedback != null) - { - if (!string.IsNullOrEmpty(outputCard.NameFeedback.StringValue)) - { - //Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue); - - if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null) - { - outputCard.Name.StringValue = s; - } - } - } - } - }); - - // Feedback + trilist.SetStringSigAction(joinMap.OutputNames.JoinNumber + ioSlotJoin, s => + { + var outputCard = Dmps.SwitcherOutputs[ioSlot] as DMOutput; + + //Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot); + + if (outputCard == null) + { + return; + } + //Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType); + + if (outputCard is Card.Dmps3CodecOutput || outputCard.NameFeedback == null) + { + return; + } + if (string.IsNullOrEmpty(outputCard.NameFeedback.StringValue)) + { + return; + } + //Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue); + + if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null) + { + outputCard.Name.StringValue = s; + } + }); + + // Feedback if (VideoOutputFeedbacks[ioSlot] != null) - VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]); + { + VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]); + } if (AudioOutputFeedbacks[ioSlot] != null) - AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]); + { + AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]); + } if (OutputNameFeedbacks[ioSlot] != null) - OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]); + { + OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]); + } if (OutputVideoRouteNameFeedbacks[ioSlot] != null) - OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]); + { + OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig( + trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]); + } if (OutputAudioRouteNameFeedbacks[ioSlot] != null) - OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]); + { + OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig( + trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]); + } if (OutputEndpointOnlineFeedbacks[ioSlot] != null) - OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); - } - } - - + { + OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig( + trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); + } + } + } + + private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap) + { + for (uint i = 1; i <= Dmps.NumberOfSwitcherInputs; i++) + { + Debug.Console(2, this, "Linking Input Card {0}", i); + + var ioSlot = i; + var ioSlotJoin = ioSlot - 1; + + if (VideoInputSyncFeedbacks[ioSlot] != null) + { + VideoInputSyncFeedbacks[ioSlot].LinkInputSig( + trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); + } + + if (InputNameFeedbacks[ioSlot] != null) + { + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); + } + + trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, s => + { + var inputCard = Dmps.SwitcherInputs[ioSlot] as DMInput; + + if (inputCard == null) + { + return; + } + + if (inputCard.NameFeedback == null || string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) || + inputCard.NameFeedback.StringValue == s) + { + return; + } + + if (inputCard.Name != null) + { + inputCard.Name.StringValue = s; + } + }); + + + if (InputEndpointOnlineFeedbacks[ioSlot] != null) + { + InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig( + trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); + } + } + } + + /// /// Iterate the SwitcherOutputs collection to setup feedbacks and add routing ports /// From 8feb7037aa455997d467edcf7e37a71e58ed2005 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 21 Oct 2020 11:53:32 -0600 Subject: [PATCH 3/5] Change cast to ACTUAL Dmps3Dmoutput --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index ef42891f..40c4b0aa 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Cards; using Crestron.SimplSharpPro.DM.Endpoints.Receivers; using Newtonsoft.Json; using PepperDash.Core; @@ -295,13 +296,15 @@ namespace PepperDash.Essentials.DM Func dmpsHandler; if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmpsHandler)) { - var output = controller.Dmps.SwitcherOutputs[num] as DMOutput; + var output = controller.Dmps.SwitcherOutputs[num] as Card.Dmps3DmOutput; if (output != null) { return dmpsHandler(key, name, output); } - Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot attach DM-RMC of type '{0}' to output {1} on DMPS chassis. Output is not a DM Output", typeName, num); + Debug.Console(0, Debug.ErrorLogLevel.Error, + "Cannot attach DM-RMC of type '{0}' to output {1} on DMPS chassis. Output is not a DM Output.", + typeName, num); return null; } From 36e8dc9fa59d4335f5166c1dcb9048124d53a1cf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 21 Oct 2020 11:53:52 -0600 Subject: [PATCH 4/5] Add check for NameSig Support --- .../Chassis/DmpsRoutingController.cs | 97 +++++++++---------- 1 file changed, 44 insertions(+), 53 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 55e0c037..061f7557 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -149,9 +149,8 @@ namespace PepperDash.Essentials.DM foreach (var kvp in OutputNames) { var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput); - if (output != null && output.Name != null) + if (output != null && output.Name.Type != eSigType.NA) { - output.Name.StringValue = kvp.Value; } } @@ -166,7 +165,7 @@ namespace PepperDash.Essentials.DM foreach (var kvp in InputNames) { var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput); - if (input != null && input.Name != null) + if (input != null && input.Name.Type != eSigType.NA) { input.Name.StringValue = kvp.Value; } @@ -331,65 +330,57 @@ namespace PepperDash.Essentials.DM { foreach (var card in Dmps.SwitcherOutputs) { - - var outputCard = card as DMOutput; - + var outputCard = card as DMOutput; + + if (outputCard == null) + { + continue; + } + Debug.Console(1, this, "Adding Output Card Number {0} Type: {1}", outputCard.Number, outputCard.CardInputOutputType.ToString()); - - if (outputCard != null) + VideoOutputFeedbacks[outputCard.Number] = new IntFeedback(() => { - VideoOutputFeedbacks[outputCard.Number] = new IntFeedback(() => - { - if (outputCard.VideoOutFeedback != null) { return (ushort)outputCard.VideoOutFeedback.Number; } - else { return 0; }; - }); - AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() => - { - if (outputCard.AudioOutFeedback != null) { return (ushort)outputCard.AudioOutFeedback.Number; } - else { return 0; }; - }); + if (outputCard.VideoOutFeedback != null) { return (ushort)outputCard.VideoOutFeedback.Number; } + return 0; + ; + }); + AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() => + { + if (outputCard.AudioOutFeedback != null) { return (ushort)outputCard.AudioOutFeedback.Number; } + return 0; + ; + }); - OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() => + OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() => + { + if (outputCard.NameFeedback != null && !string.IsNullOrEmpty(outputCard.NameFeedback.StringValue)) { - if (outputCard.NameFeedback != null && !string.IsNullOrEmpty(outputCard.NameFeedback.StringValue)) - { - Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue); - return outputCard.NameFeedback.StringValue; - } - else - { - return ""; - } - }); + Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue); + return outputCard.NameFeedback.StringValue; + } + return ""; + }); - OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => + OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => + { + if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null) { - if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null) - { - return outputCard.VideoOutFeedback.NameFeedback.StringValue; - } - else - { - return NoRouteText; - } - }); - OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => + return outputCard.VideoOutFeedback.NameFeedback.StringValue; + } + return NoRouteText; + }); + OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => + { + if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null) { - if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null) - { - return outputCard.AudioOutFeedback.NameFeedback.StringValue; - } - else - { - return NoRouteText; + return outputCard.AudioOutFeedback.NameFeedback.StringValue; + } + return NoRouteText; + }); - } - }); + OutputEndpointOnlineFeedbacks[outputCard.Number] = new BoolFeedback(() => outputCard.EndpointOnlineFeedback); - OutputEndpointOnlineFeedbacks[outputCard.Number] = new BoolFeedback(() => { return outputCard.EndpointOnlineFeedback; }); - - AddOutputCard(outputCard.Number, outputCard); - } + AddOutputCard(outputCard.Number, outputCard); } } From 4b537cb79d6ce3ea0ec88449deeda8ba1b343881 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 21 Oct 2020 13:00:12 -0600 Subject: [PATCH 5/5] Fixing some things for Essentials routing and linking to bridge --- .../Chassis/DmpsRoutingController.cs | 122 ++++++++++-------- .../Endpoints/Receivers/DmRmcHelper.cs | 2 +- 2 files changed, 67 insertions(+), 57 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 061f7557..adf73bde 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -118,7 +118,10 @@ namespace PepperDash.Essentials.DM OutputEndpointOnlineFeedbacks = new Dictionary(); Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.SwitcherInputs.Count); - Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count); + Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count); + + Debug.Console(1, this, "{0} Inputs in ControlSystem", Dmps.NumberOfSwitcherInputs); + Debug.Console(1, this, "{0} Outputs in ControlSystem", Dmps.NumberOfSwitcherOutputs); SetupOutputCards(); @@ -200,7 +203,7 @@ namespace PepperDash.Essentials.DM private void LinkOutputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap) { - for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++) + for (uint i = 1; i <= Dmps.SwitcherOutputs.Count; i++) { Debug.Console(2, this, "Linking Output Card {0}", i); @@ -274,7 +277,7 @@ namespace PepperDash.Essentials.DM private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap) { - for (uint i = 1; i <= Dmps.NumberOfSwitcherInputs; i++) + for (uint i = 1; i <= Dmps.SwitcherInputs.Count; i++) { Debug.Console(2, this, "Linking Input Card {0}", i); @@ -328,12 +331,15 @@ namespace PepperDash.Essentials.DM /// void SetupOutputCards() { - foreach (var card in Dmps.SwitcherOutputs) - { + foreach (var card in Dmps.SwitcherOutputs) + { + Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType); + var outputCard = card as DMOutput; if (outputCard == null) { + Debug.Console(1, this, "Output card {0} is not a DMOutput", card.CardInputOutputType); continue; } @@ -535,18 +541,23 @@ namespace PepperDash.Essentials.DM var cecPort = hdmiOutputCard.HdmiOutputPort; - AddHdmiOutputPort(number, cecPort); - - return; + AddHdmiOutputPort(number, cecPort); + } + else if (outputCard is Card.Dmps3HdmiOutputBackend) + { + var hdmiOutputCard = outputCard as Card.Dmps3HdmiOutputBackend; + + var cecPort = hdmiOutputCard.HdmiOutputPort; + + AddHdmiOutputPort(number, cecPort); } else if (outputCard is Card.Dmps3DmOutput) - { - var dmOutputCard = outputCard as Card.Dmps3DmOutput; - - var cecPort = dmOutputCard.DmOutputPort; - - AddDmOutputPort(number); - return; + { + AddDmOutputPort(number); + } + else if (outputCard is Card.Dmps3DmOutputBackend) + { + AddDmOutputPort(number); } else if (outputCard is Card.Dmps3ProgramOutput) { @@ -554,50 +565,51 @@ namespace PepperDash.Essentials.DM var programOutput = new DmpsAudioOutputController(string.Format("processor-programAudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase); - DeviceManager.AddDevice(programOutput); - - return; + DeviceManager.AddDevice(programOutput); } - else if (outputCard is Card.Dmps3AuxOutput) - { - if (outputCard.CardInputOutputType == eCardInputOutputType.Dmps3Aux1Output) - { - AddAudioOnlyOutputPort(number, "Aux1"); + else if (outputCard is Card.Dmps3AuxOutput) + { + switch (outputCard.CardInputOutputType) + { + case eCardInputOutputType.Dmps3Aux1Output: + { + AddAudioOnlyOutputPort(number, "Aux1"); - var aux1Output = new DmpsAudioOutputController(string.Format("processor-aux1AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase); + var aux1Output = new DmpsAudioOutputController(string.Format("processor-aux1AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase); - DeviceManager.AddDevice(aux1Output); - } - else if (outputCard.CardInputOutputType == eCardInputOutputType.Dmps3Aux2Output) - { - AddAudioOnlyOutputPort(number, "Aux2"); + DeviceManager.AddDevice(aux1Output); + } + break; + case eCardInputOutputType.Dmps3Aux2Output: + { + AddAudioOnlyOutputPort(number, "Aux2"); - var aux2Output = new DmpsAudioOutputController(string.Format("processor-aux2AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase); + var aux2Output = new DmpsAudioOutputController(string.Format("processor-aux2AudioOutput"), "Program Audio Output", outputCard as Card.Dmps3OutputBase); - DeviceManager.AddDevice(aux2Output); - } - return; - } - else if (outputCard is Card.Dmps3CodecOutput) - { - if (number == (uint)CrestronControlSystem.eDmps300cOutputs.Codec1 - || number == (uint)CrestronControlSystem.eDmps3200cOutputs.Codec1 - || number == (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec1 - || number == (uint)CrestronControlSystem.eDmps34K250COutputs.Codec1 - || number == (uint)CrestronControlSystem.eDmps34K350COutputs.Codec1) - AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec1.ToString()); - else if (number == (uint)CrestronControlSystem.eDmps300cOutputs.Codec2 - || number == (uint)CrestronControlSystem.eDmps3200cOutputs.Codec2 - || number == (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec2 - || number == (uint)CrestronControlSystem.eDmps34K250COutputs.Codec2 - || number == (uint)CrestronControlSystem.eDmps34K350COutputs.Codec2) - AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec2.ToString()); - return; - } + DeviceManager.AddDevice(aux2Output); + } + break; + } + } + else if (outputCard is Card.Dmps3CodecOutput) + { + switch (number) + { + case (uint)CrestronControlSystem.eDmps34K350COutputs.Codec1: + case (uint)CrestronControlSystem.eDmps34K250COutputs.Codec1: + case (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec1: + AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec1.ToString()); + break; + case (uint)CrestronControlSystem.eDmps34K350COutputs.Codec2: + case (uint)CrestronControlSystem.eDmps34K250COutputs.Codec2: + case (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec2: + AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec2.ToString()); + break; + } + } else if (outputCard is Card.Dmps3DialerOutput) { - AddAudioOnlyOutputPort(number, "Dialer"); - return; + AddAudioOnlyOutputPort(number, "Dialer"); } else if (outputCard is Card.Dmps3DigitalMixOutput) { @@ -608,13 +620,11 @@ namespace PepperDash.Essentials.DM if (number == (uint)CrestronControlSystem.eDmps34K250COutputs.Mix2 || number == (uint)CrestronControlSystem.eDmps34K300COutputs.Mix2 || number == (uint)CrestronControlSystem.eDmps34K350COutputs.Mix2) - AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix2.ToString()); - return; + AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix2.ToString()); } else if (outputCard is Card.Dmps3AecOutput) { - AddAudioOnlyOutputPort(number, "Aec"); - return; + AddAudioOnlyOutputPort(number, "Aec"); } else { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 40c4b0aa..7cc913e2 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -296,7 +296,7 @@ namespace PepperDash.Essentials.DM Func dmpsHandler; if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmpsHandler)) { - var output = controller.Dmps.SwitcherOutputs[num] as Card.Dmps3DmOutput; + var output = controller.Dmps.SwitcherOutputs[num] as DMOutput; if (output != null) {