From f0942a39327159b088f93fdf98a587df23c064a2 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Fri, 17 Sep 2021 09:46:20 -0400 Subject: [PATCH 01/14] Fixes for DM endpoints on DMPS3 non-4k types --- PepperDashEssentials/ControlSystem.cs | 5 ++- .../Chassis/DmpsRoutingController.cs | 10 +++-- .../Endpoints/Receivers/DmRmcHelper.cs | 43 ++++++++++++++++--- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 0717bd80..04f9571c 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -343,7 +343,7 @@ namespace PepperDash.Essentials { var prompt = Global.ControlSystem.ControllerPrompt; - var typeMatch = String.Equals(devConf.Type, prompt, StringComparison.OrdinalIgnoreCase) && + var typeMatch = String.Equals(devConf.Type, prompt, StringComparison.OrdinalIgnoreCase) || String.Equals(devConf.Type, prompt.Replace("-", ""), StringComparison.OrdinalIgnoreCase); if (!typeMatch) @@ -361,7 +361,8 @@ namespace PepperDash.Essentials if(propertiesConfig == null) propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig(); - var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig); + bool dmps4kType = this.ControllerPrompt.IndexOf("4k", StringComparison.OrdinalIgnoreCase) > -1; + var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig, dmps4kType); DeviceManager.AddDevice(dmpsRoutingController); } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 484293eb..5cdfee79 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -25,6 +25,9 @@ namespace PepperDash.Essentials.DM public CrestronControlSystem Dmps { get; set; } public ISystemControl SystemControl { get; private set; } + + //Check if DMPS is a DMPS3-4K type for endpoint creation + public bool Dmps4kType { get; private set; } //IroutingNumericEvent public event EventHandler NumericSwitchChange; @@ -73,7 +76,7 @@ namespace PepperDash.Essentials.DM public static DmpsRoutingController GetDmpsRoutingController(string key, string name, - DmpsRoutingPropertiesConfig properties) + DmpsRoutingPropertiesConfig properties, bool dmps4kType) { try { @@ -84,7 +87,7 @@ namespace PepperDash.Essentials.DM return null; } - var controller = new DmpsRoutingController(key, name, systemControl) + var controller = new DmpsRoutingController(key, name, systemControl, dmps4kType) { InputNames = properties.InputNames, OutputNames = properties.OutputNames @@ -110,12 +113,13 @@ namespace PepperDash.Essentials.DM /// /// /// - public DmpsRoutingController(string key, string name, ISystemControl systemControl) + public DmpsRoutingController(string key, string name, ISystemControl systemControl, bool dmps4kType) : base(key, name) { Dmps = Global.ControlSystem; SystemControl = systemControl; + Dmps4kType = dmps4kType; InputPorts = new RoutingPortCollection(); OutputPorts = new RoutingPortCollection(); 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 83c386bc..9043d514 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -329,7 +329,14 @@ namespace PepperDash.Essentials.DM var parentDev = DeviceManager.GetDeviceForKey(pKey); if (parentDev is DmpsRoutingController) { - return GetDmRmcControllerForDmps(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber); + if ((parentDev as DmpsRoutingController).Dmps4kType) + { + return GetDmRmcControllerForDmps4k(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber); + } + else + { + return GetDmRmcControllerForDmps(key, name, typeName, ipid, parentDev as DmpsRoutingController, props.ParentOutputNumber); + } } if (!(parentDev is IDmSwitch)) { @@ -395,25 +402,47 @@ namespace PepperDash.Essentials.DM return null; } - private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName, + private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName, + uint ipid, DmpsRoutingController controller, uint num) + { + Func dmpsHandler; + if (ChassisDict.TryGetValue(typeName.ToLower(), out dmpsHandler)) + { + var output = controller.Dmps.SwitcherOutputs[num] as DMOutput; + + if (output != null) + { + return dmpsHandler(key, name, ipid, 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 GetDmRmcControllerForDmps4k(string key, string name, string typeName, DmpsRoutingController controller, uint num) { - Func dmpsHandler; - if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmpsHandler)) + Func dmps4kHandler; + if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmps4kHandler)) { var output = controller.Dmps.SwitcherOutputs[num] as DMOutput; if (output != null) { - return dmpsHandler(key, name, output); + return dmps4kHandler(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.", + "Cannot attach DM-RMC of type '{0}' to output {1} on DMPS-4K 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); + Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS-4K chassis", typeName, num); return null; } From 9c22c4cb5f5c34605711c1049bc9c124c43ac86d Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Fri, 17 Sep 2021 09:47:06 -0400 Subject: [PATCH 02/14] Fixes adding a DM-TX to a DMPS system --- .../Endpoints/Transmitters/DmTxHelpers.cs | 207 +++++++++++------- 1 file changed, 122 insertions(+), 85 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 4d8e41f6..3ff14dba 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -65,99 +65,136 @@ namespace PepperDash.Essentials.DM { Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); } + return null; } - else - { - var parentDev = DeviceManager.GetDeviceForKey(pKey); - if (!(parentDev is IDmSwitch)) - { - Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", - key, pKey); - return null; - } + var parentDev = DeviceManager.GetDeviceForKey(pKey); + DMInput dmInput; + bool noIpId = false; + + if (parentDev is IDmSwitch) + { // Get the Crestron chassis and link stuff up - var switchDev = (parentDev as IDmSwitch); - var chassis = switchDev.Chassis; + var switchDev = (parentDev as IDmSwitch); + var chassis = switchDev.Chassis; - var num = props.ParentInputNumber; - if (num <= 0 || num > chassis.NumberOfInputs) - { - Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range", - key, num); - return null; - } - else + //Check that the input is within range of this chassis' possible inputs + var num = props.ParentInputNumber; + if (num <= 0 || num > chassis.NumberOfInputs) + { + Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range", + key, num); + return null; + } + + switchDev.TxDictionary.Add(num, key); + dmInput = chassis.Inputs[num]; + + //Determine if IpId is needed for this chassis type + if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || + chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || + chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || + chassis is DmMd128x128 || chassis is DmMd64x64) { - var controller = (parentDev as IDmSwitch); - controller.TxDictionary.Add(num, key); + noIpId = true; } - // Catch constructor failures, mainly dues to IPID - try - { - // Must use different constructor for CPU3 chassis types. No IPID - if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || - chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || - chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps|| - chassis is DmMd128x128 || chassis is DmMd64x64) - { - if (typeName.StartsWith("dmtx200")) - return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201c")) - return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201s")) - return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4k100")) - return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4kz100")) - return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4k202")) - return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4kz202")) - return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4k302")) - return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4kz302")) - return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num])); - if (typeName.StartsWith("dmtx401")) - return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num])); - if (typeName.StartsWith("hdbasettx")) - return new HDBaseTTxController(key, name, new HDTx3CB(chassis.Inputs[num])); - } - else - { - if (typeName.StartsWith("dmtx200")) - return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201c")) - return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx201s")) - return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4k100")) - return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4kz100")) - return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4k202")) - return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4kz202")) - return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4k302")) - return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx4kz302")) - return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("dmtx401")) - return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num])); - if (typeName.StartsWith("hdbasettx")) - return new HDBaseTTxController(key, name, new HDTx3CB(ipid, chassis.Inputs[num])); - } - } - catch (Exception e) - { - Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); - } + } + else if(parentDev is DmpsRoutingController) + { + // Get the DMPS chassis and link stuff up + var dmpsDev = (parentDev as DmpsRoutingController); + var chassis = dmpsDev.Dmps; + + //Check that the input is within range of this chassis' possible inputs + var num = props.ParentInputNumber; + if (num <= 0 || num > chassis.SwitcherInputs.Count) + { + Debug.Console(0, "Cannot create DMPS device '{0}'. Input number '{1}' is out of range", + key, num); + return null; + } + + dmpsDev.TxDictionary.Add(num, key); + noIpId = dmpsDev.Dmps4kType; + + try + { + dmInput = chassis.SwitcherInputs[num] as DMInput; + } + catch + { + Debug.Console(0, "Cannot create DMPS device '{0}'. Input number '{1}' is not a DM input", key, num); + return null; + } + } + + else + { + Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a processor, DM Chassis or DMPS.", key, pKey); + return null; } - - return null; + + try + { + // Must use different constructor for CPU3 or DMPS3-4K types. No IPID + if (noIpId) + { + if (typeName.StartsWith("dmtx200")) + return new DmTx200Controller(key, name, new DmTx200C2G(dmInput)); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(dmInput)); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(dmInput)); + if (typeName.StartsWith("dmtx4k100")) + return new DmTx4k100Controller(key, name, new DmTx4K100C1G(dmInput)); + if (typeName.StartsWith("dmtx4kz100")) + return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(dmInput)); + if (typeName.StartsWith("dmtx4k202")) + return new DmTx4k202CController(key, name, new DmTx4k202C(dmInput)); + if (typeName.StartsWith("dmtx4kz202")) + return new DmTx4kz202CController(key, name, new DmTx4kz202C(dmInput)); + if (typeName.StartsWith("dmtx4k302")) + return new DmTx4k302CController(key, name, new DmTx4k302C(dmInput)); + if (typeName.StartsWith("dmtx4kz302")) + return new DmTx4kz302CController(key, name, new DmTx4kz302C(dmInput)); + if (typeName.StartsWith("dmtx401")) + return new DmTx401CController(key, name, new DmTx401C(dmInput)); + if (typeName.StartsWith("hdbasettx")) + return new HDBaseTTxController(key, name, new HDTx3CB(dmInput)); + } + else + { + if (typeName.StartsWith("dmtx200")) + return new DmTx200Controller(key, name, new DmTx200C2G(ipid, dmInput)); + if (typeName.StartsWith("dmtx201c")) + return new DmTx201CController(key, name, new DmTx201C(ipid, dmInput)); + if (typeName.StartsWith("dmtx201s")) + return new DmTx201SController(key, name, new DmTx201S(ipid, dmInput)); + if (typeName.StartsWith("dmtx4k100")) + return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, dmInput)); + if (typeName.StartsWith("dmtx4kz100")) + return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, dmInput)); + if (typeName.StartsWith("dmtx4k202")) + return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, dmInput)); + if (typeName.StartsWith("dmtx4kz202")) + return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, dmInput)); + if (typeName.StartsWith("dmtx4k302")) + return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, dmInput)); + if (typeName.StartsWith("dmtx4kz302")) + return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, dmInput)); + if (typeName.StartsWith("dmtx401")) + return new DmTx401CController(key, name, new DmTx401C(ipid, dmInput)); + if (typeName.StartsWith("hdbasettx")) + return new HDBaseTTxController(key, name, new HDTx3CB(ipid, dmInput)); + } + } + catch (Exception e) + { + Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); + } + + return null; } } From 3d543dfd0955be9e223b4a8c2d94c7b05da0006b Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Fri, 17 Sep 2021 15:05:59 -0400 Subject: [PATCH 03/14] Fixes odd error where dm event comes in with input xx name even though input xx doesn't exist on the dmps --- .../Chassis/DmpsRoutingController.cs | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 5cdfee79..ca1a9463 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -723,28 +723,36 @@ namespace PepperDash.Essentials.DM void Dmps_DMInputChange(Switch device, DMInputEventArgs args) { - //Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString()); - - switch (args.EventId) + try { - case (DMInputEventIds.OnlineFeedbackEventId): - { - Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback); - InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); - break; - } - case (DMInputEventIds.VideoDetectedEventId): - { - Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); - VideoInputSyncFeedbacks[args.Number].FireUpdate(); - break; - } - case (DMInputEventIds.InputNameEventId): - { - Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number); - InputNameFeedbacks[args.Number].FireUpdate(); - break; - } + switch (args.EventId) + { + case (DMInputEventIds.OnlineFeedbackEventId): + { + Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback); + InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); + break; + } + case (DMInputEventIds.VideoDetectedEventId): + { + Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); + VideoInputSyncFeedbacks[args.Number].FireUpdate(); + break; + } + case (DMInputEventIds.InputNameEventId): + { + Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number); + if(InputNameFeedbacks.ContainsKey(args.Number)) + { + InputNameFeedbacks[args.Number].FireUpdate(); + } + break; + } + } + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "DMSwitch Input Change:{0} Input:{1} Event:{2}\rException: {3}", this.Name, args.Number, args.EventId.ToString(), e.ToString()); } } void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args) From bead782bd5a78d2bf2959e89a027c1d1f9af2c8b Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 23 Sep 2021 12:01:15 -0400 Subject: [PATCH 04/14] Waits to return InitializeSystem until devices are registered. Adds DMPS system power on/off to device bridge. --- PepperDashEssentials/ControlSystem.cs | 12 +- .../JoinMaps/DmpsRoutingControllerJoinMap.cs | 18 ++- .../Devices/DeviceManager.cs | 3 + .../Chassis/DmpsRoutingController.cs | 110 ++++++++++++++++-- 4 files changed, 124 insertions(+), 19 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 04f9571c..f3674b41 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -46,6 +46,13 @@ namespace PepperDash.Essentials public override void InitializeSystem() { _startTimer = new CTimer(StartSystem,StartupTime); + ushort count = 0; + while (!DeviceManager.AllDevicesActivatedFb && count < 60) + { + //Wait for devices to register before returning, as required by DMPS. Max wait is 60 seconds. + CrestronEnvironment.Sleep(1000); + count++; + } } private void StartSystem(object obj) @@ -361,10 +368,7 @@ namespace PepperDash.Essentials if(propertiesConfig == null) propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig(); - bool dmps4kType = this.ControllerPrompt.IndexOf("4k", StringComparison.OrdinalIgnoreCase) > -1; - var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig, dmps4kType); - - DeviceManager.AddDevice(dmpsRoutingController); + DeviceManager.AddDevice(DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig)); } else if (this.ControllerPrompt.IndexOf("mpc3", StringComparison.OrdinalIgnoreCase) > -1) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs index 11385916..80975338 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmpsRoutingControllerJoinMap.cs @@ -1,9 +1,17 @@ using System; -namespace PepperDash.Essentials.Core.Bridges -{ - public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced - { +namespace PepperDash.Essentials.Core.Bridges +{ + public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("SystemPowerOn")] + public JoinDataComplete SystemPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata { Description = "DMPS System Power On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("SystemPowerOff")] + public JoinDataComplete SystemPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata { Description = "DMPS System Power Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("VideoSyncStatus")] public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 }, new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); @@ -61,5 +69,5 @@ namespace PepperDash.Essentials.Core.Bridges protected DmpsRoutingControllerJoinMap(uint joinStart, Type type) : base(joinStart, type) { } - } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index df864550..c5363a00 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -28,9 +28,11 @@ namespace PepperDash.Essentials.Core public static List AllDevices { get { return new List(Devices.Values); } } public static bool AddDeviceEnabled; + public static bool AllDevicesActivatedFb; public static void Initialize(CrestronControlSystem cs) { + AllDevicesActivatedFb = false; AddDeviceEnabled = true; CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices", ConsoleAccessLevelEnum.AccessOperator); @@ -122,6 +124,7 @@ namespace PepperDash.Essentials.Core private static void OnAllDevicesActivated() { + AllDevicesActivatedFb = true; var handler = AllDevicesActivated; if (handler != null) { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index ca1a9463..9a8742a4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -31,6 +31,10 @@ namespace PepperDash.Essentials.DM //IroutingNumericEvent public event EventHandler NumericSwitchChange; + + //Feedback for DMPS System Power + public BoolFeedback SystemPowerOnFeedback { get; private set; } + public BoolFeedback SystemPowerOffFeedback { get; private set; } // Feedbacks for EssentialDM public Dictionary VideoOutputFeedbacks { get; private set; } @@ -76,7 +80,7 @@ namespace PepperDash.Essentials.DM public static DmpsRoutingController GetDmpsRoutingController(string key, string name, - DmpsRoutingPropertiesConfig properties, bool dmps4kType) + DmpsRoutingPropertiesConfig properties) { try { @@ -87,7 +91,7 @@ namespace PepperDash.Essentials.DM return null; } - var controller = new DmpsRoutingController(key, name, systemControl, dmps4kType) + var controller = new DmpsRoutingController(key, name, systemControl) { InputNames = properties.InputNames, OutputNames = properties.OutputNames @@ -113,13 +117,31 @@ namespace PepperDash.Essentials.DM /// /// /// - public DmpsRoutingController(string key, string name, ISystemControl systemControl, bool dmps4kType) + public DmpsRoutingController(string key, string name, ISystemControl systemControl) : base(key, name) - { - + { Dmps = Global.ControlSystem; - SystemControl = systemControl; - Dmps4kType = dmps4kType; + + switch (name.Replace("-", "").Replace("c", "").Replace("C", "")) + { + case "dmps34k50": + case "dmps34k100": + case "dmps34k150": + SystemControl = systemControl as Dmps34K150CSystemControl; + Dmps4kType = true; + break; + case "dmps34k200": + case "dmps34k250": + case "dmps34k300": + case "dmps34k350": + SystemControl = systemControl as Dmps34K300CSystemControl; + Dmps4kType = true; + break; + default: + SystemControl = systemControl as Dmps3SystemControl; + Dmps4kType = false; + break; + } InputPorts = new RoutingPortCollection(); OutputPorts = new RoutingPortCollection(); @@ -127,6 +149,29 @@ namespace PepperDash.Essentials.DM TxDictionary = new Dictionary(); RxDictionary = new Dictionary(); + SystemPowerOnFeedback = new BoolFeedback(() => + { + if (SystemControl is Dmps3SystemControl) + { + return ((Dmps3SystemControl)SystemControl).SystemPowerOnFeedBack.BoolValue; + } + else + { + return false; + } + }); + SystemPowerOffFeedback = new BoolFeedback(() => + { + if (SystemControl is Dmps3SystemControl) + { + return ((Dmps3SystemControl)SystemControl).SystemPowerOffFeedBack.BoolValue; + } + else + { + return false; + } + }); + VideoOutputFeedbacks = new Dictionary(); AudioOutputFeedbacks = new Dictionary(); VideoInputSyncFeedbacks = new Dictionary(); @@ -158,6 +203,7 @@ namespace PepperDash.Essentials.DM // Subscribe to events Dmps.DMInputChange += Dmps_DMInputChange; Dmps.DMOutputChange += Dmps_DMOutputChange; + Dmps.DMSystemChange += Dmps_DMSystemChange; return base.CustomActivate(); } @@ -195,6 +241,22 @@ namespace PepperDash.Essentials.DM } } + public void SetPowerOn(bool a) + { + if (SystemControl is Dmps3SystemControl) + { + ((Dmps3SystemControl)SystemControl).SystemPowerOn(); + } + } + + public void SetPowerOff(bool a) + { + if (SystemControl is Dmps3SystemControl) + { + ((Dmps3SystemControl)SystemControl).SystemPowerOff(); + } + } + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmpsRoutingControllerJoinMap(joinStart); @@ -215,9 +277,22 @@ namespace PepperDash.Essentials.DM Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + //Link up system + trilist.SetBoolSigAction(joinMap.SystemPowerOn.JoinNumber, SetPowerOn); + trilist.SetBoolSigAction(joinMap.SystemPowerOff.JoinNumber, SetPowerOff); + if (SystemPowerOnFeedback != null) + { + SystemPowerOnFeedback.LinkInputSig( + trilist.BooleanInput[joinMap.SystemPowerOn.JoinNumber]); + } + if (SystemPowerOffFeedback != null) + { + SystemPowerOffFeedback.LinkInputSig( + trilist.BooleanInput[joinMap.SystemPowerOff.JoinNumber]); + } + // Link up outputs LinkInputsToApi(trilist, joinMap); - LinkOutputsToApi(trilist, joinMap); } @@ -824,6 +899,23 @@ namespace PepperDash.Essentials.DM } + void Dmps_DMSystemChange(Switch device, DMSystemEventArgs args) + { + switch (args.EventId) + { + case DMSystemEventIds.SystemPowerOnEventId: + { + SystemPowerOnFeedback.FireUpdate(); + break; + } + case DMSystemEventIds.SystemPowerOffEventId: + { + SystemPowerOffFeedback.FireUpdate(); + break; + } + } + } + /// /// /// @@ -891,7 +983,6 @@ namespace PepperDash.Essentials.DM // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) { - output.VideoOut = input; } @@ -915,7 +1006,6 @@ namespace PepperDash.Essentials.DM if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) { - output.USBRoutedTo = input; } From 35edbeacfcf1fda4efdbedc7b43bea76da15b2af Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 23 Sep 2021 16:01:07 -0400 Subject: [PATCH 05/14] Fix join map details for DMPS --- .../Bridges/JoinMaps/DmChassisControllerJoinMap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index ee04bd45..60973801 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -10,7 +10,7 @@ namespace PepperDash.Essentials.Core.Bridges new JoinMetadata { Description = "DM Chassis enable audio breakaway routing", - JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); @@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core.Bridges new JoinMetadata { Description = "DM Chassis enable USB breakaway routing", - JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital }); From fd232beae1df4b25f5a335b268df940aa5659232 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 24 Sep 2021 15:26:45 -0600 Subject: [PATCH 06/14] feat(essentails): #830 Adds EnteringStandbyModeFeedback to IHasHalfWakeMode --- .../VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs | 14 ++++++++++++++ .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 7 ++++++- .../VideoCodec/Interfaces/IHasStandbyMode.cs | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs index 8caeaf3e..e4945ce8 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoCodecJoinMap.cs @@ -93,6 +93,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco JoinType = eJoinType.Digital }); + [JoinName("EnteringStandbyMode")] + public JoinDataComplete EnteringStandbyMode = new JoinDataComplete( + new JoinData + { + JoinNumber = 229, + JoinSpan = 1 + }, + new JoinMetadata + { + Description = "High to indicate that the codec is entering standby mode", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + #endregion diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index d625637c..020eec7d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -319,7 +319,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco SupportsCameraOff = true; DoNotDisturbModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Conference.DoNotDisturb.BoolValue); - HalfWakeModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value == "Halfwake"); + HalfWakeModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value.ToLower() == "halfwake"); + EnteringStandbyModeFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value.ToLower() == "enteringstandby"); PresentationViewMaximizedFeedback = new BoolFeedback(() => CurrentPresentationView == "Maximized"); @@ -422,6 +423,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { StandbyIsOnFeedback.FireUpdate(); HalfWakeModeIsOnFeedback.FireUpdate(); + EnteringStandbyModeFeedback.FireUpdate(); }); CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate; CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate; @@ -1546,6 +1548,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco halfwakeCodec.StandbyIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateStandby.JoinNumber]); halfwakeCodec.StandbyIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.DeactivateStandby.JoinNumber]); halfwakeCodec.HalfWakeModeIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateHalfWakeMode.JoinNumber]); + halfwakeCodec.EnteringStandbyModeFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnteringStandbyMode.JoinNumber]); trilist.SetSigFalseAction(joinMap.ActivateStandby.JoinNumber, () => halfwakeCodec.StandbyActivate()); trilist.SetSigFalseAction(joinMap.DeactivateStandby.JoinNumber, () => halfwakeCodec.StandbyDeactivate()); @@ -2157,6 +2160,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public BoolFeedback HalfWakeModeIsOnFeedback { get; private set; } + public BoolFeedback EnteringStandbyModeFeedback { get; private set; } + public void HalfwakeActivate() { SendText("xCommand Standby Halfwake"); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasStandbyMode.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasStandbyMode.cs index 55dcd081..cc9dcd3d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasStandbyMode.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasStandbyMode.cs @@ -27,6 +27,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec { BoolFeedback HalfWakeModeIsOnFeedback { get; } + BoolFeedback EnteringStandbyModeFeedback { get; } + void HalfwakeActivate(); } } \ No newline at end of file From 1e9139f38edab12096712dbcaec7fae4f3cd8dbc Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 24 Sep 2021 17:25:14 -0600 Subject: [PATCH 07/14] feat(essentials): Reworks logic in InitializeSystem() to be a bit cleaner using a CEvent and the existing AllDeviceActivated event --- PepperDashEssentials/ControlSystem.cs | 19 ++++++++++++++----- .../Devices/DeviceManager.cs | 3 --- .../PepperDashEssentialsBase/Global/Global.cs | 10 ++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index f3674b41..51aa1353 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -28,6 +28,7 @@ namespace PepperDash.Essentials HttpLogoServer LogoServer; private CTimer _startTimer; + private CEvent _initializeEvent; private const long StartupTime = 500; public ControlSystem() @@ -46,12 +47,20 @@ namespace PepperDash.Essentials public override void InitializeSystem() { _startTimer = new CTimer(StartSystem,StartupTime); - ushort count = 0; - while (!DeviceManager.AllDevicesActivatedFb && count < 60) + + + // If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate + // to allow any HD-BaseT DM endpoints to register first. + if (Global.ControlSystemIsDmpsType) { - //Wait for devices to register before returning, as required by DMPS. Max wait is 60 seconds. - CrestronEnvironment.Sleep(1000); - count++; + _initializeEvent = new CEvent(); + + DeviceManager.AllDevicesActivated += (o, a) => + { + _initializeEvent.Set(); + }; + + _initializeEvent.Wait(20000); } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index c5363a00..df864550 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -28,11 +28,9 @@ namespace PepperDash.Essentials.Core public static List AllDevices { get { return new List(Devices.Values); } } public static bool AddDeviceEnabled; - public static bool AllDevicesActivatedFb; public static void Initialize(CrestronControlSystem cs) { - AllDevicesActivatedFb = false; AddDeviceEnabled = true; CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices", ConsoleAccessLevelEnum.AccessOperator); @@ -124,7 +122,6 @@ namespace PepperDash.Essentials.Core private static void OnAllDevicesActivated() { - AllDevicesActivatedFb = true; var handler = AllDevicesActivated; if (handler != null) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 121bc9b7..0365b209 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -32,6 +32,16 @@ namespace PepperDash.Essentials.Core // TODO: consider making this configurable later public static IFormatProvider Culture = CultureInfo.CreateSpecificCulture("en-US"); + /// + /// True when the processor type is a DMPS variant + /// + public static bool ControlSystemIsDmpsType + { + get + { + return ControlSystem.ControllerPrompt.ToLower().IndexOf("dmps") > -1; + } + } /// /// The file path prefix to the folder containing configuration files From 5f50f14a71bd0e892749270385e70b4c6dc2d7d5 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 24 Sep 2021 17:26:13 -0600 Subject: [PATCH 08/14] feat(essentials): Updates timeout to 30s --- PepperDashEssentials/ControlSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 51aa1353..9afa210d 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -60,7 +60,7 @@ namespace PepperDash.Essentials _initializeEvent.Set(); }; - _initializeEvent.Wait(20000); + _initializeEvent.Wait(30000); } } From 66ecf435086d3451da113d01718b1bc6e563b12b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 23 Jul 2021 16:53:11 -0600 Subject: [PATCH 09/14] chore: Update PD Core to 1.0.48 --- packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.config b/packages.config index 3876040a..3494f2eb 100644 --- a/packages.config +++ b/packages.config @@ -1,3 +1,3 @@ - + \ No newline at end of file From 10445508b20db6a90f44e94f40cfcb72698269e1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 23 Jul 2021 16:53:36 -0600 Subject: [PATCH 10/14] feat: Update `Essentials Device` to call `Initialize` method --- .../Devices/EssentialsDevice.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs index 781101d4..00624007 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs @@ -27,6 +27,27 @@ namespace PepperDash.Essentials.Core { } + + private void SubscribeToActivateComplete() + { + DeviceManager.AllDevicesActivated += DeviceManagerOnAllDevicesActivated; + } + + private void DeviceManagerOnAllDevicesActivated(object sender, EventArgs eventArgs) + { + CrestronInvoke.BeginInvoke((o) => + { + try + { + Initialize(); + } + catch (Exception ex) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Exception initializing device: {0}", ex.Message); + Debug.Console(1, this, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace); + } + }); + } } [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)] From 5940ec17c27d5bd43f7bca143af2c5e67ab22bc1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 23 Jul 2021 19:44:41 -0600 Subject: [PATCH 11/14] feat: Add method call to constructor for EssentialsDevice --- .../PepperDashEssentialsBase/Devices/EssentialsDevice.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs index 00624007..46fa819b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs @@ -19,13 +19,13 @@ namespace PepperDash.Essentials.Core protected EssentialsDevice(string key) : base(key) { - + SubscribeToActivateComplete(); } protected EssentialsDevice(string key, string name) : base(key, name) { - + SubscribeToActivateComplete(); } private void SubscribeToActivateComplete() From b71c83bac093786294bf2bb6b280c8a8d77583ec Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 23 Jul 2021 19:56:29 -0600 Subject: [PATCH 12/14] feat: Update some internal Essentials devices to use Initialize method --- .../MicrophonePrivacyController.cs | 14 +++++++++----- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 19 +++++++++++++------ .../VideoCodec/ZoomRoom/ZoomRoom.cs | 17 +++++++++++++---- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs index 0f15a02d..55b458a7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs @@ -88,11 +88,6 @@ namespace PepperDash.Essentials.Core.Privacy else Debug.Console(0, this, "Unable to add Red LED device"); - DeviceManager.AllDevicesActivated += (o, a) => - { - CheckPrivacyMode(); - }; - AddPostActivationAction(() => { PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange; PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange; @@ -103,6 +98,15 @@ namespace PepperDash.Essentials.Core.Privacy return base.CustomActivate(); } + #region Overrides of Device + + public override void Initialize() + { + CheckPrivacyMode(); + } + + #endregion + public void SetPrivacyDevice(IPrivacy privacyDevice) { PrivacyDevice = privacyDevice; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index 4db4084c..f894141c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -551,6 +551,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco CrestronConsole.AddNewConsoleCommand(GetPhonebook, "GetCodecPhonebook", "Triggers a refresh of the codec phonebook", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(GetBookings, "GetCodecBookings", "Triggers a refresh of the booking data for today", ConsoleAccessLevelEnum.AccessOperator); + return base.CustomActivate(); + } + + #region Overrides of Device + + public override void Initialize() + { var socket = Communication as ISocketStatus; if (socket != null) { @@ -559,9 +566,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco Communication.Connect(); - CommunicationMonitor.Start(); + CommunicationMonitor.Start(); - string prefix = "xFeedback register "; + const string prefix = "xFeedback register "; CliFeedbackRegistrationExpression = prefix + "/Configuration" + Delimiter + @@ -576,14 +583,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco prefix + "/Status/Video/Layout" + Delimiter + prefix + "/Status/Video/Input/MainVideoMute" + Delimiter + prefix + "/Bookings" + Delimiter + - prefix + "/Event/CallDisconnect" + Delimiter + + prefix + "/Event/CallDisconnect" + Delimiter + prefix + "/Event/Bookings" + Delimiter + prefix + "/Event/CameraPresetListUpdated" + Delimiter + - prefix + "/Event/UserInterface/Presentation/ExternalSource/Selected/SourceIdentifier" + Delimiter; - - return base.CustomActivate(); + prefix + "/Event/UserInterface/Presentation/ExternalSource/Selected/SourceIdentifier" + Delimiter; } + #endregion + /// /// Fires when initial codec sync is completed. Used to then send commands to get call history, phonebook, bookings, etc. /// diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index e4a724a2..32a24a28 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -791,7 +791,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom CrestronConsole.AddNewConsoleCommand(s => GetBookings(), "GetZoomRoomBookings", "Triggers a refresh of the booking data for today", ConsoleAccessLevelEnum.AccessOperator); - var socket = Communication as ISocketStatus; + + + return base.CustomActivate(); + } + + #region Overrides of Device + + public override void Initialize() + { + var socket = Communication as ISocketStatus; if (socket != null) { socket.ConnectionChange += socket_ConnectionChange; @@ -802,11 +811,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom Communication.Connect(); CommunicationMonitor.Start(); + } - return base.CustomActivate(); - } + #endregion - public void SetCommDebug(string s) + public void SetCommDebug(string s) { if (s == "1") { From a6430a7bfe0386f309930b6d41339018bbe82d64 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 Sep 2021 11:05:05 -0600 Subject: [PATCH 13/14] chore: Update PD Core to 1.1.0 --- packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.config b/packages.config index 3494f2eb..10124bbd 100644 --- a/packages.config +++ b/packages.config @@ -1,3 +1,3 @@ - + \ No newline at end of file From 5442a1db48f8c141a7f46eeb8286d3a287df784f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 29 Sep 2021 15:14:07 -0600 Subject: [PATCH 14/14] fix(essentials): #842 Adds back in code to register Crestron devices under normal circumstances --- PepperDashEssentials/ControlSystem.cs | 3 +++ .../Crestron/CrestronGenericBaseDevice.cs | 27 ++++++++++++------- .../PepperDashEssentialsBase/Global/Global.cs | 11 ++++++++ .../Endpoints/Transmitters/DmTxHelpers.cs | 20 +++++++------- 4 files changed, 42 insertions(+), 19 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 9afa210d..b454cec9 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -53,11 +53,14 @@ namespace PepperDash.Essentials // to allow any HD-BaseT DM endpoints to register first. if (Global.ControlSystemIsDmpsType) { + Debug.Console(2, "******************* InitializeSystem() Entering **********************"); + _initializeEvent = new CEvent(); DeviceManager.AllDevicesActivated += (o, a) => { _initializeEvent.Set(); + Debug.Console(2, "******************* InitializeSystem() Exiting **********************"); }; _initializeEvent.Wait(30000); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index df2c3c56..b7534087 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -69,19 +69,28 @@ namespace PepperDash.Essentials.Core public override bool CustomActivate() { Debug.Console(0, this, "Activating"); - if (!PreventRegistration) - { + if (!PreventRegistration) + { //Debug.Console(1, this, " Does not require registration. Skipping"); - var response = Hardware.RegisterWithLogging(Key); - if (response != eDeviceRegistrationUnRegistrationResponse.Success) - { - //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); - return false; - } + var response = Hardware.RegisterWithLogging(Key); + if (response != eDeviceRegistrationUnRegistrationResponse.Success) + { + //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); + return false; + } IsRegistered.FireUpdate(); - } + } + else + { + AddPostActivationAction(() => + { + var response = Hardware.RegisterWithLogging(Key); + + IsRegistered.FireUpdate(); + }); + } foreach (var f in Feedbacks) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 0365b209..9d792437 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -43,6 +43,17 @@ namespace PepperDash.Essentials.Core } } + /// + /// True when the processor type is a DMPS 4K variant + /// + public static bool ControlSystemIsDmps4kType + { + get + { + return ControlSystemIsDmpsType && ControlSystem.ControllerPrompt.ToLower().IndexOf("4k") > -1; + } + } + /// /// The file path prefix to the folder containing configuration files /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 3ff14dba..fcec7fa4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -36,7 +36,7 @@ namespace PepperDash.Essentials.DM var ipid = props.Control.IpIdInt; var pKey = props.ParentDeviceKey.ToLower(); - if (pKey == "processor") + if (pKey == "processor") { // Catch constructor failures, mainly dues to IPID try @@ -70,7 +70,7 @@ namespace PepperDash.Essentials.DM var parentDev = DeviceManager.GetDeviceForKey(pKey); DMInput dmInput; - bool noIpId = false; + bool isCpu3 = false; if (parentDev is IDmSwitch) { @@ -96,7 +96,7 @@ namespace PepperDash.Essentials.DM chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || chassis is DmMd128x128 || chassis is DmMd64x64) { - noIpId = true; + isCpu3 = true; } } @@ -116,7 +116,6 @@ namespace PepperDash.Essentials.DM } dmpsDev.TxDictionary.Add(num, key); - noIpId = dmpsDev.Dmps4kType; try { @@ -138,7 +137,7 @@ namespace PepperDash.Essentials.DM try { // Must use different constructor for CPU3 or DMPS3-4K types. No IPID - if (noIpId) + if (isCpu3 || Global.ControlSystemIsDmps4kType) { if (typeName.StartsWith("dmtx200")) return new DmTx200Controller(key, name, new DmTx200C2G(dmInput)); @@ -222,11 +221,12 @@ namespace PepperDash.Essentials.DM protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware) : base(key, name, hardware) { - // if wired to a chassis, skip registration step in base class - if (hardware.DMInput != null) - { - this.PreventRegistration = true; - } + // if wired to a chassis or DMPS, skip registration step in base class + if (hardware.DMInput != null || (Global.ControlSystemIsDmpsType && hardware.DMInput != null)) + { + this.PreventRegistration = true; + } + AddToFeedbackList(ActiveVideoInputFeedback); }