From f33763ce43b91d50bbcf44a0f3de7757cdf90942 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 15 May 2020 15:20:27 -0600 Subject: [PATCH 1/6] fixes bitwise comparison for routing type --- .../Essentials_DM/Chassis/DmChassisController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 0af41f48..c6626d81 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -964,26 +964,26 @@ namespace PepperDash.Essentials.DM var outCard = input == 0 ? null : Chassis.Outputs[output]; // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES - if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) + if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) { Chassis.VideoEnter.BoolValue = true; Chassis.Outputs[output].VideoOut = inCard; } - if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) { (Chassis as DmMDMnxn).AudioEnter.BoolValue = true; Chassis.Outputs[output].AudioOut = inCard; } - if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) + if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) { Chassis.USBEnter.BoolValue = true; if (Chassis.Outputs[output] != null) Chassis.Outputs[output].USBRoutedTo = inCard; } - if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) + if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) { Chassis.USBEnter.BoolValue = true; if (Chassis.Inputs[input] != null) From c9d97e5caefdb79377cf666c815e4bfe4011e565 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 15 May 2020 15:36:32 -0600 Subject: [PATCH 2/6] Adds support for routing In to In or Out to Out for USB for DM Chassis --- .../Chassis/DmChassisController.cs | 61 ++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index c6626d81..ee76b979 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -944,6 +944,10 @@ namespace PepperDash.Essentials.DM var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail var output = Convert.ToUInt32(outputSelector); + var chassisSize = (uint) Chassis.NumberOfInputs; //need this to determine USB routing values 8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8 + //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16 + //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32 + // Check to see if there's an off timer waiting on this and if so, cancel var key = new PortNumberType(output, sigType); if (input == 0) @@ -978,16 +982,69 @@ namespace PepperDash.Essentials.DM if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) { + //using base here because USB can be routed between 2 output cards or 2 input cards + DMInputOutputBase dmCard; + + if (input > chassisSize) + { + //wanting to route an output to an output. Subtract chassis size and get output, unless it's 8x8 + //need this to determine USB routing values + //8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8 + //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16 + //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32 + uint outputIndex; + + if (chassisSize == 8) + { + outputIndex = input - 16; + } + else + { + outputIndex = input - chassisSize; + } + dmCard = Chassis.Outputs[outputIndex]; + } + else + { + dmCard = inCard; + } Chassis.USBEnter.BoolValue = true; if (Chassis.Outputs[output] != null) - Chassis.Outputs[output].USBRoutedTo = inCard; + Chassis.Outputs[output].USBRoutedTo = dmCard; } if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) { + //using base here because USB can be routed between 2 output cards or 2 input cards + DMInputOutputBase dmCard; + + if (input > chassisSize) + { + //wanting to route an input to an output. Subtract chassis size and get output, unless it's 8x8 + //need this to determine USB routing values + //8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8 + //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16 + //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32 + uint outputIndex; + + if (chassisSize == 8) + { + outputIndex = input - 16; + } + else + { + outputIndex = input - chassisSize; + } + dmCard = Chassis.Outputs[outputIndex]; + } + else + { + dmCard = Chassis.Inputs[input]; + } + Chassis.USBEnter.BoolValue = true; if (Chassis.Inputs[input] != null) - Chassis.Inputs[input].USBRoutedTo = outCard; + Chassis.Inputs[input].USBRoutedTo = dmCard; } } #endregion From 57f1db17c34022b6ce84a6857e333545d25b61ea Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 15 May 2020 15:45:37 -0600 Subject: [PATCH 3/6] Added some debug statements --- .../Chassis/DmChassisController.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index ee76b979..a9bd194a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -985,6 +985,8 @@ namespace PepperDash.Essentials.DM //using base here because USB can be routed between 2 output cards or 2 input cards DMInputOutputBase dmCard; + Debug.Console(2, this, "Executing USB Output switch.\r\n in:{0} output: {1}", input, output); + if (input > chassisSize) { //wanting to route an output to an output. Subtract chassis size and get output, unless it's 8x8 @@ -1010,7 +1012,10 @@ namespace PepperDash.Essentials.DM } Chassis.USBEnter.BoolValue = true; if (Chassis.Outputs[output] != null) + { + Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Outputs[input], dmCard); Chassis.Outputs[output].USBRoutedTo = dmCard; + } } if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) @@ -1018,6 +1023,8 @@ namespace PepperDash.Essentials.DM //using base here because USB can be routed between 2 output cards or 2 input cards DMInputOutputBase dmCard; + Debug.Console(2, this, "Executing USB Input switch.\r\n in:{0} output: {1}", input, output); + if (input > chassisSize) { //wanting to route an input to an output. Subtract chassis size and get output, unless it's 8x8 @@ -1042,9 +1049,16 @@ namespace PepperDash.Essentials.DM dmCard = Chassis.Inputs[input]; } + + Chassis.USBEnter.BoolValue = true; - if (Chassis.Inputs[input] != null) - Chassis.Inputs[input].USBRoutedTo = dmCard; + + if (Chassis.Inputs[input] == null) + { + return; + } + Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[input], dmCard); + Chassis.Inputs[input].USBRoutedTo = dmCard; } } #endregion From 19c4428dc854937e7c4d15b40ca033b69a526dea Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 10:21:46 -0600 Subject: [PATCH 4/6] adds feedback joins for Audio & USB Breakway --- .../JoinMaps/DmChassisControllerJoinMap.cs | 19 +++++++++++++++++++ .../Chassis/DmChassisController.cs | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index 9406678a..48c4b59e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -9,6 +9,25 @@ namespace PepperDash.Essentials.Core.Bridges { public class DmChassisControllerJoinMap : JoinMapBaseAdvanced { + [JoinName("EnableAudioBreakaway")] + public JoinDataComplete EnableAudioBreakaway = new JoinDataComplete( + new JoinData {JoinNumber = 4, JoinSpan = 1}, + new JoinMetadata + { + Label = "DM Chassis enable audio breakaway routing", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("EnableUsbBreakaway")] + public JoinDataComplete EnableUsbBreakaway = new JoinDataComplete( + new JoinData { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata + { + Label = "DM Chassis enable USB breakaway routing", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); [JoinName("SystemId")] public JoinDataComplete SystemId = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 }, diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index a9bd194a..91d35ac1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -42,6 +42,8 @@ namespace PepperDash.Essentials.DM public IntFeedback SystemIdFeebdack { get; private set; } public BoolFeedback SystemIdBusyFeedback { get; private set; } + public BoolFeedback EnableAudioBreakawayFeedback { get; private set; } + public BoolFeedback EnableUsbBreakawayFeedback { get; private set; } public Dictionary InputCardHdcpCapabilityFeedbacks { get; private set; } @@ -210,6 +212,11 @@ namespace PepperDash.Essentials.DM SystemIdFeebdack = new IntFeedback(() => { return (Chassis as DmMDMnxn).SystemIdFeedback.UShortValue; }); SystemIdBusyFeedback = new BoolFeedback(() => { return (Chassis as DmMDMnxn).SystemIdBusy.BoolValue; }); + EnableAudioBreakawayFeedback = + new BoolFeedback(() => (Chassis as DmMDMnxn).EnableAudioBreakawayFeedback.BoolValue); + EnableUsbBreakawayFeedback = + new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue); + InputCardHdcpCapabilityFeedbacks = new Dictionary(); InputCardHdcpCapabilityTypes = new Dictionary(); @@ -927,6 +934,10 @@ namespace PepperDash.Essentials.DM (Chassis as DmMDMnxn).EnableAudioBreakaway.BoolValue = true; (Chassis as DmMDMnxn).EnableUSBBreakaway.BoolValue = true; + + EnableAudioBreakawayFeedback.FireUpdate(); + EnableUsbBreakawayFeedback.FireUpdate(); + if (InputNames != null) foreach (var kvp in InputNames) Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value; From 46ecb676c0084a3b99c1025b7c1a8318f87e0daf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 11:32:44 -0600 Subject: [PATCH 5/6] Fixes USB Routing for routing via Inputs and input to input Also adds feedbacks for Audio Breakaway and USB Breakaway status --- .../StatusSign/StatusSignController.cs | 310 +++++++++--------- .../Chassis/DmChassisController.cs | 41 ++- 2 files changed, 192 insertions(+), 159 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index df8f778a..89e830e5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -1,127 +1,127 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the Crestron StatusSign device")] - public class StatusSignController : CrestronGenericBridgeableBaseDevice - { - private readonly StatusSign _device; - - public BoolFeedback RedLedEnabledFeedback { get; private set; } - public BoolFeedback GreenLedEnabledFeedback { get; private set; } - public BoolFeedback BlueLedEnabledFeedback { get; private set; } - - public IntFeedback RedLedBrightnessFeedback { get; private set; } - public IntFeedback GreenLedBrightnessFeedback { get; private set; } - public IntFeedback BlueLedBrightnessFeedback { get; private set; } - - public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware) - { - _device = hardware as StatusSign; - - RedLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Red] - .ControlFeedback.BoolValue); - GreenLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Green] - .ControlFeedback.BoolValue); - BlueLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Blue] - .ControlFeedback.BoolValue); - - RedLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Red].BrightnessFeedback); - GreenLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Green].BrightnessFeedback); - BlueLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback); - - if (_device != null) _device.BaseEvent += _device_BaseEvent; - } - - void _device_BaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case StatusSign.LedBrightnessFeedbackEventId: - RedLedBrightnessFeedback.FireUpdate(); - GreenLedBrightnessFeedback.FireUpdate(); - BlueLedBrightnessFeedback.FireUpdate(); - break; - case StatusSign.LedControlFeedbackEventId: - RedLedEnabledFeedback.FireUpdate(); - GreenLedEnabledFeedback.FireUpdate(); - BlueLedEnabledFeedback.FireUpdate(); - break; - } - } - - public void EnableLedControl(bool red, bool green, bool blue) - { - _device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red; - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green; - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue; - } - - public void SetColor(uint red, uint green, uint blue) - { - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red); - } - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green); - } - - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); - } - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +using System; +using System.Collections.Generic; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Core.CrestronIO +{ + [Description("Wrapper class for the Crestron StatusSign device")] + public class StatusSignController : CrestronGenericBridgeableBaseDevice + { + private readonly StatusSign _device; + + public BoolFeedback RedLedEnabledFeedback { get; private set; } + public BoolFeedback GreenLedEnabledFeedback { get; private set; } + public BoolFeedback BlueLedEnabledFeedback { get; private set; } + + public IntFeedback RedLedBrightnessFeedback { get; private set; } + public IntFeedback GreenLedBrightnessFeedback { get; private set; } + public IntFeedback BlueLedBrightnessFeedback { get; private set; } + + public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware) { - var joinMap = new StatusSignControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) + _device = hardware as StatusSign; + + RedLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint) StatusSign.Led.eLedColor.Red] + .ControlFeedback.BoolValue); + GreenLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint) StatusSign.Led.eLedColor.Green] + .ControlFeedback.BoolValue); + BlueLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint) StatusSign.Led.eLedColor.Blue] + .ControlFeedback.BoolValue); + + RedLedBrightnessFeedback = + new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Red].BrightnessFeedback); + GreenLedBrightnessFeedback = + new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Green].BrightnessFeedback); + BlueLedBrightnessFeedback = + new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback); + + if (_device != null) _device.BaseEvent += _device_BaseEvent; + } + + void _device_BaseEvent(GenericBase device, BaseEventArgs args) + { + switch (args.EventId) + { + case StatusSign.LedBrightnessFeedbackEventId: + RedLedBrightnessFeedback.FireUpdate(); + GreenLedBrightnessFeedback.FireUpdate(); + BlueLedBrightnessFeedback.FireUpdate(); + break; + case StatusSign.LedControlFeedbackEventId: + RedLedEnabledFeedback.FireUpdate(); + GreenLedEnabledFeedback.FireUpdate(); + BlueLedEnabledFeedback.FireUpdate(); + break; + } + } + + public void EnableLedControl(bool red, bool green, bool blue) + { + _device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red; + _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green; + _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue; + } + + public void SetColor(uint red, uint green, uint blue) + { + try + { + _device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness = + (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red); + } + catch (InvalidOperationException) + { + Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red); + } + try + { + _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness = + (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green); + } + catch (InvalidOperationException) + { + Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green); + } + + try + { + _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness = + (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue); + } + catch (InvalidOperationException) + { + Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); + } + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new StatusSignControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - + bridge.AddJoinMap(Key, joinMap); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); @@ -139,44 +139,44 @@ namespace PepperDash.Essentials.Core.CrestronIO RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]); BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]); - GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); - } - - private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) + GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); + } + + private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) { var redEnable = triList.BooleanOutput[joinMap.RedControl.JoinNumber].BoolValue; var greenEnable = triList.BooleanOutput[joinMap.GreenControl.JoinNumber].BoolValue; - var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; - device.EnableLedControl(redEnable, greenEnable, blueEnable); - } - - private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) + var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; + device.EnableLedControl(redEnable, greenEnable, blueEnable); + } + + private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) { var redBrightness = triList.UShortOutput[joinMap.RedLed.JoinNumber].UShortValue; var greenBrightness = triList.UShortOutput[joinMap.GreenLed.JoinNumber].UShortValue; - var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; - - device.SetColor(redBrightness, greenBrightness, blueBrightness); - } - } - - public class StatusSignControllerFactory : EssentialsDeviceFactory - { - public StatusSignControllerFactory() - { - TypeNames = new List() { "statussign" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new StatusSign Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem)); - } - } + var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; + + device.SetColor(redBrightness, greenBrightness, blueBrightness); + } + } + + public class StatusSignControllerFactory : EssentialsDeviceFactory + { + public StatusSignControllerFactory() + { + TypeNames = new List() { "statussign" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new StatusSign Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem)); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 91d35ac1..b0d4682d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using Crestron.SimplSharp; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Cards; @@ -383,6 +384,11 @@ namespace PepperDash.Essentials.DM } } + private void ChassisOnBaseEvent(GenericBase device, BaseEventArgs args) + { + + } + /// /// /// @@ -775,6 +781,20 @@ namespace PepperDash.Essentials.DM SystemIdBusyFeedback.FireUpdate(); break; } + case DMSystemEventIds.AudioBreakawayEventId: + { + Debug.Console(2, this, "AudioBreakaway Event: value: {0}", + (Chassis as DmMDMnxn).EnableAudioBreakawayFeedback.BoolValue); + EnableAudioBreakawayFeedback.FireUpdate(); + break; + } + case DMSystemEventIds.USBBreakawayEventId: + { + Debug.Console(2, this, "USBBreakaway Event: value: {0}", + (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue); + EnableUsbBreakawayFeedback.FireUpdate(); + break; + } } } @@ -1036,7 +1056,7 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, "Executing USB Input switch.\r\n in:{0} output: {1}", input, output); - if (input > chassisSize) + if (output > chassisSize) { //wanting to route an input to an output. Subtract chassis size and get output, unless it's 8x8 //need this to determine USB routing values @@ -1064,12 +1084,12 @@ namespace PepperDash.Essentials.DM Chassis.USBEnter.BoolValue = true; - if (Chassis.Inputs[input] == null) + if (Chassis.Inputs[output] == null) { return; } - Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[input], dmCard); - Chassis.Inputs[input].USBRoutedTo = dmCard; + Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[output], dmCard); + Chassis.Inputs[output].USBRoutedTo = dmCard; } } #endregion @@ -1105,6 +1125,19 @@ namespace PepperDash.Essentials.DM SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]); SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId.JoinNumber]); + EnableAudioBreakawayFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableAudioBreakaway.JoinNumber]); + EnableUsbBreakawayFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsbBreakaway.JoinNumber]); + + trilist.OnlineStatusChange += (o, a) => + { + if (!a.DeviceOnLine) return; + + EnableAudioBreakawayFeedback.FireUpdate(); + EnableUsbBreakawayFeedback.FireUpdate(); + SystemIdBusyFeedback.FireUpdate(); + SystemIdFeebdack.FireUpdate(); + }; + // Link up outputs for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) { From 39f25cc9db72c90c4398aeacd88e76b9dd6eec6e Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 12:43:00 -0600 Subject: [PATCH 6/6] Adds GetJoinMapForDevice method back somehow was missing from dev branch... --- .../PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 8f792659..fea4bbf1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -27,6 +27,11 @@ namespace PepperDash.Essentials.Core return joinMap; } + public static string GetJoinMapForDevice(string joinMapKey) + { + return GetSerializedJoinMapForDevice(joinMapKey); + } + /// /// Attempts to find a custom join map by key and returns it deserialized if found ///