From 8f530aa7fe07b6e8a7cb30682325d8c7e2fb022c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 23 Jan 2020 12:33:28 -0700 Subject: [PATCH 01/30] ECS-1244 Added StatusSignController Class and bridge --- PepperDashEssentials/Bridges/BridgeBase.cs | 5 + .../JoinMaps/StatusSignControllerJoinMap.cs | 45 ++++++++ .../Bridges/StatusSignControllerBridge.cs | 53 +++++++++ .../PepperDashEssentials.csproj | 2 + .../StatusSign/StatusSignController.cs | 107 ++++++++++++++++++ .../Factory/DeviceFactory.cs | 12 +- .../PepperDash_Essentials_Core.csproj | 3 +- 7 files changed, 224 insertions(+), 3 deletions(-) create mode 100644 PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs create mode 100644 PepperDashEssentials/Bridges/StatusSignControllerBridge.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index 74cc4e87..dce8cd4c 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -166,6 +166,11 @@ namespace PepperDash.Essentials.Bridges (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } + if (device is StatusSignController) + { + (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; + } } } diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs new file mode 100644 index 00000000..80e1dcef --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -0,0 +1,45 @@ +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class StatusSignControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint RedLed { get; set; } + public uint GreenLed { get; set; } + public uint BlueLed { get; set; } + public uint RedControl { get; set; } + public uint GreenControl { get; set; } + public uint BlueControl { get; set; } + + public StatusSignControllerJoinMap(uint joinStart) + { + //digital + IsOnline = 1; + RedControl = 2; + GreenControl = 3; + BlueControl = 4; + + //Analog + RedLed = 2; + GreenLed = 3; + BlueLed = 4; + + OffsetJoinNumbers(joinStart); + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs new file mode 100644 index 00000000..8d977467 --- /dev/null +++ b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs @@ -0,0 +1,53 @@ +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.CrestronIO; + +namespace PepperDash.Essentials.Bridges +{ + public static class StatusSignDeviceApiExtensions + { + public static void LinkToApi(this StatusSignController ssDevice, BasicTriList trilist, uint joinStart, + string joinMapKey) + { + var joinMap = new StatusSignControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, ssDevice, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, ssDevice)); + trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, ssDevice)); + trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, ssDevice)); + + trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); + } + + private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redEnable = triList.BooleanOutput[joinMap.RedControl].BoolValue; + var greenEnable = triList.BooleanOutput[joinMap.GreenControl].BoolValue; + var blueEnable = triList.BooleanOutput[joinMap.BlueControl].BoolValue; + device.EnableLedControl(redEnable, greenEnable, blueEnable); + } + + private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redBrightness = triList.UShortOutput[joinMap.RedLed].UShortValue; + var greenBrightness = triList.UShortOutput[joinMap.GreenLed].UShortValue; + var blueBrightness = triList.UShortOutput[joinMap.BlueLed].UShortValue; + + device.SetColor(redBrightness, greenBrightness, blueBrightness); + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 14725a1b..c40d67f5 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -153,7 +153,9 @@ + + diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs new file mode 100644 index 00000000..b83eae37 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -0,0 +1,107 @@ +using System; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Core; + +namespace PepperDash.Essentials.Core.CrestronIO +{ + public class StatusSignController:CrestronGenericBaseDevice + { + private 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); + + _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); + } + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 4eddd6ee..2f24d765 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -4,10 +4,11 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.GeneralIO; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.CrestronIO; namespace PepperDash.Essentials.Core { @@ -55,10 +56,17 @@ namespace PepperDash.Essentials.Core else if (typeName == "ceniodigin104") { var control = CommFactory.GetControlPropertiesConfig(dc); - var ipid = control.CresnetIdInt; + var ipid = control.IpIdInt; return new CenIoDigIn104Controller(key, name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem)); } + if (typeName == "statussign") + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new StatusSignController(key, name, new StatusSign(cresnetId, Global.ControlSystem)); + } // then check for types that have been added by plugin dlls. if (FactoryMethods.ContainsKey(typeName)) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index c6915164..87092915 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -64,7 +64,7 @@ False - ..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll False @@ -125,6 +125,7 @@ + From 09bc84346d1cf91cd32100616310c53685bb2091 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 23 Jan 2020 13:02:42 -0700 Subject: [PATCH 02/30] ECS-1245 Added C2nRths Controller and Bridge --- PepperDashEssentials/Bridges/BridgeBase.cs | 7 ++- .../Bridges/C2nRthsControllerBridge.cs | 29 ++++++++++++ .../JoinMaps/C2nRthsControllerJoinMap.cs | 39 ++++++++++++++++ .../PepperDashEssentials.csproj | 2 + .../Crestron IO/C2nRts/C2nRthsController.cs | 44 +++++++++++++++++++ .../Factory/DeviceFactory.cs | 7 +++ .../PepperDash_Essentials_Core.csproj | 1 + 7 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs create mode 100644 PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index dce8cd4c..bea29911 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -166,11 +166,16 @@ namespace PepperDash.Essentials.Bridges (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } - if (device is StatusSignController) + else if (device is StatusSignController) { (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } + else if (device is C2nRthsController) + { + (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; + } } } diff --git a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs new file mode 100644 index 00000000..a29512dd --- /dev/null +++ b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs @@ -0,0 +1,29 @@ +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.CrestronIO; + +namespace PepperDash.Essentials.Bridges +{ + public static class C2nRthsControllerApiExtensions + { + public static void LinkToApi(this C2nRthsController device, BasicTriList triList, uint joinStart, + string joinMapKey) + { + var joinMap = new C2nRthsControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, device, "Linking to Trilist '{0}'", triList.ID.ToString("X")); + + triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + } + + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs new file mode 100644 index 00000000..76d99edb --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -0,0 +1,39 @@ +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class C2nRthsControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Temperature { get; set; } + public uint Humidity { get; set; } + public uint TemperatureFormat { get; set; } + + public C2nRthsControllerJoinMap(uint joinStart) + { + //digital + IsOnline = 1; + TemperatureFormat = 2; + + //Analog + Temperature = 2; + Humidity = 3; + + OffsetJoinNumbers(joinStart); + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index c40d67f5..abe2bd25 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -119,9 +119,11 @@ + + diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs new file mode 100644 index 00000000..865acd1c --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -0,0 +1,44 @@ +using System; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Core; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.CrestronIO +{ + public class C2nRthsController:CrestronGenericBaseDevice + { + private C2nRths _device; + + public IntFeedback TemperatureFeedback { get; private set; } + public IntFeedback HumidityFeedback { get; private set; } + + public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware) + { + _device = hardware as C2nRths; + + TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); + HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); + + _device.BaseEvent += DeviceOnBaseEvent; + } + + private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) + { + switch (args.EventId) + { + case C2nRths.TemperatureFeedbackEventId: + TemperatureFeedback.FireUpdate(); + break; + case C2nRths.HumidityFeedbackEventId: + HumidityFeedback.FireUpdate(); + break; + } + } + + public void SetTemperatureFormat(bool setToC) + { + _device.TemperatureFormat.BoolValue = setToC; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 2f24d765..8bc89bd4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -66,6 +66,13 @@ namespace PepperDash.Essentials.Core var cresnetId = control.CresnetIdInt; return new StatusSignController(key, name, new StatusSign(cresnetId, Global.ControlSystem)); + } + if (typeName == "c2nrths") + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new C2nRthsController(key, name, new C2nRths(cresnetId, Global.ControlSystem)); } // then check for types that have been added by plugin dlls. diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 87092915..0a926f23 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -118,6 +118,7 @@ + From 9eb48acd6a4d782c4b2d9ff33a1817f664c78c3f Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Mon, 27 Jan 2020 10:00:48 -0600 Subject: [PATCH 03/30] Added Raw states for PIR and US sensors on the GlsOdtOccupancySensorController and corresponding joinMap data and Bridge connections --- .../GlsOccupancySensorBaseControllerBridge.cs | 4 ++ .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 18 ++++++-- .../GlsOdtOccupancySensorController.cs | 45 ++++++++++++------- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs index fd79a64a..7afe5853 100644 --- a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs +++ b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs @@ -103,6 +103,10 @@ namespace PepperDash.Essentials.Bridges trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action((b) => odtOccController.DecrementUsSensitivityInVacantState(b))); odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); + //Sensor Raw States + odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback]); + odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); + } #endregion } diff --git a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index ee7de892..6a02c6fb 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -30,7 +30,15 @@ namespace PepperDash.Essentials.Bridges /// /// High when raw occupancy is detected /// - public uint RawOccupancyFeedback { get; set; } + public uint RawOccupancyFeedback { get; set; } + /// + /// High when PIR sensor detects motion + /// + public uint RawOccupancyPirFeedback { get; set; } + /// + /// High when US sensor detects motion + /// + public uint RawOccupancyUsFeedback { get; set; } /// /// High when occupancy is detected /// @@ -138,7 +146,9 @@ namespace PepperDash.Essentials.Bridges RoomOccupiedFeedback = 2; GraceOccupancyDetectedFeedback = 3; RoomVacantFeedback = 4; - RawOccupancyFeedback = 5; + RawOccupancyFeedback = 5; + RawOccupancyPirFeedback = 6; + RawOccupancyUsFeedback = 7; EnableLedFlash = 11; DisableLedFlash = 12; EnableShortTimeout = 13; @@ -182,7 +192,9 @@ namespace PepperDash.Essentials.Bridges RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; RoomVacantFeedback = RoomVacantFeedback + joinOffset; - RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; + RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; + RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; + RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; EnableLedFlash = EnableLedFlash + joinOffset; DisableLedFlash = DisableLedFlash + joinOffset; EnableShortTimeout = EnableShortTimeout + joinOffset; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index 372aa232..7f034fbe 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -24,7 +24,11 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } - public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } + public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } + + public BoolFeedback RawOccupancyPirFeedback { get; private set; } + + public BoolFeedback RawOccupancyUsFeedback { get; private set; } public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor) @@ -38,11 +42,15 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue); - UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue); + UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue); + + RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue); + + RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue); UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue); - UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); + UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); } /// @@ -52,20 +60,23 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy /// /// protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId) - AndWhenVacatedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId) - OrWhenVacatedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId) - UltrasonicAEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId) - UltrasonicBEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) - UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) - UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); - + { + if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId) + AndWhenVacatedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId) + OrWhenVacatedFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId) + UltrasonicAEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId) + UltrasonicBEnabledFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId) + RawOccupancyPirFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId) + RawOccupancyUsFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) + UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) + UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); base.OccSensor_GlsOccupancySensorChange(device, args); } From df6bd2a21f16607fc25eebd44b95af4d579e8f72 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Mon, 27 Jan 2020 11:02:15 -0600 Subject: [PATCH 04/30] ECS-1248 Duplicate join map entry 'DisablePir' - removed and shifted map up by one --- .../JoinMaps/GlsOccupancySensorBaseJoinMap.cs | 439 +++++++++--------- 1 file changed, 219 insertions(+), 220 deletions(-) diff --git a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index 6a02c6fb..a48ad0d9 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class GlsOccupancySensorBaseJoinMap : JoinMapBase - { - #region Digitals - - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Forces the device to report occupied status - /// - public uint ForceOccupied { get; set; } - /// - /// Forces the device to report vacant status - /// - public uint ForceVacant { get; set; } - /// - /// Enables raw status reporting - /// - public uint EnableRawStates { get; set; } - /// - /// High when raw occupancy is detected - /// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class GlsOccupancySensorBaseJoinMap : JoinMapBase + { + #region Digitals + + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Forces the device to report occupied status + /// + public uint ForceOccupied { get; set; } + /// + /// Forces the device to report vacant status + /// + public uint ForceVacant { get; set; } + /// + /// Enables raw status reporting + /// + public uint EnableRawStates { get; set; } + /// + /// High when raw occupancy is detected + /// public uint RawOccupancyFeedback { get; set; } /// /// High when PIR sensor detects motion @@ -38,194 +38,193 @@ namespace PepperDash.Essentials.Bridges /// /// High when US sensor detects motion /// - public uint RawOccupancyUsFeedback { get; set; } - /// - /// High when occupancy is detected - /// - public uint RoomOccupiedFeedback { get; set; } - /// - /// Hich when occupancy is detected in the grace period - /// - public uint GraceOccupancyDetectedFeedback { get; set; } - /// - /// High when vacancy is detected - /// - public uint RoomVacantFeedback { get; set; } - - /// - /// Enables the LED Flash when set high - /// - public uint EnableLedFlash { get; set; } - /// - /// Disables the LED flash when set high - /// - public uint DisableLedFlash { get; set; } - /// - /// Enables the Short Timeout - /// - public uint EnableShortTimeout { get; set; } - /// - /// Disables the Short Timout - /// - public uint DisableShortTimeout { get; set; } - /// - /// Set high to enable one technology to trigger occupancy - /// - public uint OrWhenVacated { get; set; } - /// - /// Set high to require both technologies to trigger occupancy - /// - public uint AndWhenVacated { get; set; } - /// - /// Enables Ultrasonic Sensor A - /// - public uint EnableUsA { get; set; } - /// - /// Disables Ultrasonic Sensor A - /// - public uint DisableUsA { get; set; } - /// - /// Enables Ultrasonic Sensor B - /// - public uint EnableUsB { get; set; } - /// - /// Disables Ultrasonic Sensor B - /// - public uint DisableUsB { get; set; } - /// - /// Enables Pir - /// - public uint EnablePir { get; set; } - /// - /// Disables Pir - /// - public uint DisablePir { get; set; } - public uint IncrementUsInOccupiedState { get; set; } - public uint DecrementUsInOccupiedState { get; set; } - public uint IncrementUsInVacantState { get; set; } - public uint DecrementUsInVacantState { get; set; } - public uint IncrementPirInOccupiedState { get; set; } - public uint DecrementPirInOccupiedState { get; set; } - public uint IncrementPirInVacantState { get; set; } - public uint DecrementPirInVacantState { get; set; } - #endregion - - #region Analogs - /// - /// Sets adn reports the remote timeout value - /// - public uint Timeout { get; set; } - /// - /// Reports the local timeout value - /// - public uint TimeoutLocalFeedback { get; set; } - /// - /// Sets the minimum internal photo sensor value and reports the current level - /// - public uint InternalPhotoSensorValue { get; set; } - /// - /// Sets the minimum external photo sensor value and reports the current level - /// - public uint ExternalPhotoSensorValue { get; set; } - - public uint UsSensitivityInOccupiedState { get; set; } - - public uint UsSensitivityInVacantState { get; set; } - - public uint PirSensitivityInOccupiedState { get; set; } - - public uint PirSensitivityInVacantState { get; set; } - #endregion - - public GlsOccupancySensorBaseJoinMap() - { - IsOnline = 1; - ForceOccupied = 2; - ForceVacant = 3; - EnableRawStates = 4; - RoomOccupiedFeedback = 2; - GraceOccupancyDetectedFeedback = 3; - RoomVacantFeedback = 4; + public uint RawOccupancyUsFeedback { get; set; } + /// + /// High when occupancy is detected + /// + public uint RoomOccupiedFeedback { get; set; } + /// + /// Hich when occupancy is detected in the grace period + /// + public uint GraceOccupancyDetectedFeedback { get; set; } + /// + /// High when vacancy is detected + /// + public uint RoomVacantFeedback { get; set; } + + /// + /// Enables the LED Flash when set high + /// + public uint EnableLedFlash { get; set; } + /// + /// Disables the LED flash when set high + /// + public uint DisableLedFlash { get; set; } + /// + /// Enables the Short Timeout + /// + public uint EnableShortTimeout { get; set; } + /// + /// Disables the Short Timout + /// + public uint DisableShortTimeout { get; set; } + /// + /// Set high to enable one technology to trigger occupancy + /// + public uint OrWhenVacated { get; set; } + /// + /// Set high to require both technologies to trigger occupancy + /// + public uint AndWhenVacated { get; set; } + /// + /// Enables Ultrasonic Sensor A + /// + public uint EnableUsA { get; set; } + /// + /// Disables Ultrasonic Sensor A + /// + public uint DisableUsA { get; set; } + /// + /// Enables Ultrasonic Sensor B + /// + public uint EnableUsB { get; set; } + /// + /// Disables Ultrasonic Sensor B + /// + public uint DisableUsB { get; set; } + /// + /// Enables Pir + /// + public uint EnablePir { get; set; } + /// + /// Disables Pir + /// + public uint DisablePir { get; set; } + public uint IncrementUsInOccupiedState { get; set; } + public uint DecrementUsInOccupiedState { get; set; } + public uint IncrementUsInVacantState { get; set; } + public uint DecrementUsInVacantState { get; set; } + public uint IncrementPirInOccupiedState { get; set; } + public uint DecrementPirInOccupiedState { get; set; } + public uint IncrementPirInVacantState { get; set; } + public uint DecrementPirInVacantState { get; set; } + #endregion + + #region Analogs + /// + /// Sets adn reports the remote timeout value + /// + public uint Timeout { get; set; } + /// + /// Reports the local timeout value + /// + public uint TimeoutLocalFeedback { get; set; } + /// + /// Sets the minimum internal photo sensor value and reports the current level + /// + public uint InternalPhotoSensorValue { get; set; } + /// + /// Sets the minimum external photo sensor value and reports the current level + /// + public uint ExternalPhotoSensorValue { get; set; } + + public uint UsSensitivityInOccupiedState { get; set; } + + public uint UsSensitivityInVacantState { get; set; } + + public uint PirSensitivityInOccupiedState { get; set; } + + public uint PirSensitivityInVacantState { get; set; } + #endregion + + public GlsOccupancySensorBaseJoinMap() + { + IsOnline = 1; + ForceOccupied = 2; + ForceVacant = 3; + EnableRawStates = 4; + RoomOccupiedFeedback = 2; + GraceOccupancyDetectedFeedback = 3; + RoomVacantFeedback = 4; RawOccupancyFeedback = 5; - RawOccupancyPirFeedback = 6; - RawOccupancyUsFeedback = 7; - EnableLedFlash = 11; - DisableLedFlash = 12; - EnableShortTimeout = 13; - DisableShortTimeout = 14; - OrWhenVacated = 15; - AndWhenVacated = 16; - EnableUsA = 17; - DisableUsA = 18; - EnableUsB = 19; - DisableUsB = 20; - EnablePir = 21; - DisablePir = 22; - DisablePir = 23; - IncrementUsInOccupiedState = 24; - DecrementUsInOccupiedState = 25; - IncrementUsInVacantState = 26; - DecrementUsInVacantState = 27; - IncrementPirInOccupiedState = 28; - DecrementPirInOccupiedState = 29; - IncrementPirInVacantState = 30; - DecrementPirInVacantState = 31; - - Timeout = 1; - TimeoutLocalFeedback = 2; - InternalPhotoSensorValue = 3; - ExternalPhotoSensorValue = 4; - UsSensitivityInOccupiedState = 5; - UsSensitivityInVacantState = 6; - PirSensitivityInOccupiedState = 7; - PirSensitivityInVacantState = 8; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - ForceOccupied = ForceOccupied + joinOffset; - ForceVacant = ForceVacant + joinOffset; - EnableRawStates = EnableRawStates + joinOffset; - RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; - GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; - RoomVacantFeedback = RoomVacantFeedback + joinOffset; + RawOccupancyPirFeedback = 6; + RawOccupancyUsFeedback = 7; + EnableLedFlash = 11; + DisableLedFlash = 12; + EnableShortTimeout = 13; + DisableShortTimeout = 14; + OrWhenVacated = 15; + AndWhenVacated = 16; + EnableUsA = 17; + DisableUsA = 18; + EnableUsB = 19; + DisableUsB = 20; + EnablePir = 21; + DisablePir = 22; + IncrementUsInOccupiedState = 23; + DecrementUsInOccupiedState = 24; + IncrementUsInVacantState = 25; + DecrementUsInVacantState = 26; + IncrementPirInOccupiedState = 27; + DecrementPirInOccupiedState = 28; + IncrementPirInVacantState = 29; + DecrementPirInVacantState = 30; + + Timeout = 1; + TimeoutLocalFeedback = 2; + InternalPhotoSensorValue = 3; + ExternalPhotoSensorValue = 4; + UsSensitivityInOccupiedState = 5; + UsSensitivityInVacantState = 6; + PirSensitivityInOccupiedState = 7; + PirSensitivityInVacantState = 8; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + ForceOccupied = ForceOccupied + joinOffset; + ForceVacant = ForceVacant + joinOffset; + EnableRawStates = EnableRawStates + joinOffset; + RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; + GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; + RoomVacantFeedback = RoomVacantFeedback + joinOffset; RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; - RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; - EnableLedFlash = EnableLedFlash + joinOffset; - DisableLedFlash = DisableLedFlash + joinOffset; - EnableShortTimeout = EnableShortTimeout + joinOffset; - DisableShortTimeout = DisableShortTimeout + joinOffset; - OrWhenVacated = OrWhenVacated + joinOffset; - AndWhenVacated = AndWhenVacated + joinOffset; - EnableUsA = EnableUsA + joinOffset; - DisableUsA = DisableUsA + joinOffset; - EnableUsB = EnableUsB + joinOffset; - DisableUsB = DisableUsB + joinOffset; - EnablePir = EnablePir + joinOffset; - DisablePir = DisablePir + joinOffset; - DisablePir = DisablePir + joinOffset; - IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; - DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; - IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; - DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; - IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; - DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; - IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; - DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; - - Timeout = Timeout + joinOffset; - TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; - InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; - ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; - UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; - UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; - PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; - PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; - } - } - -} + RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; + EnableLedFlash = EnableLedFlash + joinOffset; + DisableLedFlash = DisableLedFlash + joinOffset; + EnableShortTimeout = EnableShortTimeout + joinOffset; + DisableShortTimeout = DisableShortTimeout + joinOffset; + OrWhenVacated = OrWhenVacated + joinOffset; + AndWhenVacated = AndWhenVacated + joinOffset; + EnableUsA = EnableUsA + joinOffset; + DisableUsA = DisableUsA + joinOffset; + EnableUsB = EnableUsB + joinOffset; + DisableUsB = DisableUsB + joinOffset; + EnablePir = EnablePir + joinOffset; + DisablePir = DisablePir + joinOffset; + DisablePir = DisablePir + joinOffset; + IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; + DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; + IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; + DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; + IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; + DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; + IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; + DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; + + Timeout = Timeout + joinOffset; + TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; + InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; + ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; + UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; + UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; + PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; + PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; + } + } + +} From 0724ec06ebc814ac8db39cd38290399a3f9f6c7f Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 31 Jan 2020 11:08:44 -0600 Subject: [PATCH 05/30] ecs-1252 Fixed missing feedbacks in BridgeControllers for StatusSign and C2nRts. Added Name feedbacks for same. --- .../Bridges/C2nRthsControllerBridge.cs | 9 ++++++++- .../Bridges/JoinMaps/C2nRthsControllerJoinMap.cs | 6 +++++- .../Bridges/JoinMaps/StatusSignControllerJoinMap.cs | 7 ++++++- .../Bridges/StatusSignControllerBridge.cs | 13 ++++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs index a29512dd..a479797b 100644 --- a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs +++ b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs @@ -22,7 +22,14 @@ namespace PepperDash.Essentials.Bridges Debug.Console(1, device, "Linking to Trilist '{0}'", triList.ID.ToString("X")); - triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + + device.TemperatureFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); + device.HumidityFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); + + triList.StringInput[joinMap.Name].StringValue = device.Name; + + } } diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index 76d99edb..00e6112a 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -6,7 +6,8 @@ namespace PepperDash.Essentials.Bridges { public class C2nRthsControllerJoinMap:JoinMapBase { - public uint IsOnline { get; set; } + public uint IsOnline { get; set; } + public uint Name { get; set; } public uint Temperature { get; set; } public uint Humidity { get; set; } public uint TemperatureFormat { get; set; } @@ -21,6 +22,9 @@ namespace PepperDash.Essentials.Bridges Temperature = 2; Humidity = 3; + //serial + Name = 1; + OffsetJoinNumbers(joinStart); } diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index 80e1dcef..933f6f74 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -6,7 +6,8 @@ namespace PepperDash.Essentials.Bridges { public class StatusSignControllerJoinMap:JoinMapBase { - public uint IsOnline { get; set; } + public uint IsOnline { get; set; } + public uint Name { get; set; } public uint RedLed { get; set; } public uint GreenLed { get; set; } public uint BlueLed { get; set; } @@ -27,6 +28,10 @@ namespace PepperDash.Essentials.Bridges GreenLed = 3; BlueLed = 4; + //string + Name = 1; + + OffsetJoinNumbers(joinStart); } diff --git a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs index 8d977467..7c0bab9e 100644 --- a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs +++ b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs @@ -28,7 +28,18 @@ namespace PepperDash.Essentials.Bridges trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); - trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); + + trilist.StringInput[joinMap.Name].StringValue = ssDevice.Name; + + ssDevice.RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); + ssDevice.BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); + ssDevice.GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); + + ssDevice.RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); + ssDevice.BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); + ssDevice.GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); + } private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, From 32a548b8fb3fe001ccea3bd675de19fd6826d309 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 31 Jan 2020 11:08:44 -0600 Subject: [PATCH 06/30] ECS-1252 Fixed missing feedbacks in BridgeControllers for StatusSign and C2nRts. Added Name feedbacks for same. --- .../Bridges/C2nRthsControllerBridge.cs | 9 ++++++++- .../Bridges/JoinMaps/C2nRthsControllerJoinMap.cs | 6 +++++- .../Bridges/JoinMaps/StatusSignControllerJoinMap.cs | 7 ++++++- .../Bridges/StatusSignControllerBridge.cs | 13 ++++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs index a29512dd..a479797b 100644 --- a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs +++ b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs @@ -22,7 +22,14 @@ namespace PepperDash.Essentials.Bridges Debug.Console(1, device, "Linking to Trilist '{0}'", triList.ID.ToString("X")); - triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + + device.TemperatureFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); + device.HumidityFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); + + triList.StringInput[joinMap.Name].StringValue = device.Name; + + } } diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index 76d99edb..00e6112a 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -6,7 +6,8 @@ namespace PepperDash.Essentials.Bridges { public class C2nRthsControllerJoinMap:JoinMapBase { - public uint IsOnline { get; set; } + public uint IsOnline { get; set; } + public uint Name { get; set; } public uint Temperature { get; set; } public uint Humidity { get; set; } public uint TemperatureFormat { get; set; } @@ -21,6 +22,9 @@ namespace PepperDash.Essentials.Bridges Temperature = 2; Humidity = 3; + //serial + Name = 1; + OffsetJoinNumbers(joinStart); } diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index 80e1dcef..933f6f74 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -6,7 +6,8 @@ namespace PepperDash.Essentials.Bridges { public class StatusSignControllerJoinMap:JoinMapBase { - public uint IsOnline { get; set; } + public uint IsOnline { get; set; } + public uint Name { get; set; } public uint RedLed { get; set; } public uint GreenLed { get; set; } public uint BlueLed { get; set; } @@ -27,6 +28,10 @@ namespace PepperDash.Essentials.Bridges GreenLed = 3; BlueLed = 4; + //string + Name = 1; + + OffsetJoinNumbers(joinStart); } diff --git a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs index 8d977467..7c0bab9e 100644 --- a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs +++ b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs @@ -28,7 +28,18 @@ namespace PepperDash.Essentials.Bridges trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); - trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); + + trilist.StringInput[joinMap.Name].StringValue = ssDevice.Name; + + ssDevice.RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); + ssDevice.BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); + ssDevice.GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); + + ssDevice.RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); + ssDevice.BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); + ssDevice.GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); + } private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, From 3648bdcae455e2e7ef7db54450308b288c3a4b58 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 3 Feb 2020 14:27:28 -0700 Subject: [PATCH 07/30] fixed ECS-1255 by checking for inputSlotSupportsHdcp2 config value on each input card and defaulting to false if not defined in config. --- .../Bridges/DmChassisControllerBridge.cs | 10 +- .../Chassis/DmChassisController.cs | 98 +++++++++++++++---- 2 files changed, 83 insertions(+), 25 deletions(-) diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index c85854b6..f87f2109 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -81,14 +81,14 @@ namespace PepperDash.Essentials.Bridges } } - if (basicTxDevice != null && advancedTxDevice == null) - trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; - - if (advancedTxDevice != null) + if (advancedTxDevice != null) // Advanced TX device { advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + // Flag if the TX is an advanced endpoint type + trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; } - else if(advancedTxDevice == null || basicTxDevice != null) + else if(advancedTxDevice == null || basicTxDevice != null) // Basic TX device { Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 094b8022..d0a6ba63 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -104,9 +104,12 @@ namespace PepperDash.Essentials.DM } var controller = new DmChassisController(key, name, chassis); + // add the cards and port names - foreach (var kvp in properties.InputSlots) - controller.AddInputCard(kvp.Value, kvp.Key); + foreach (var kvp in properties.InputSlots) + { + controller.AddInputCard(kvp.Value, kvp.Key); + } foreach (var kvp in properties.OutputSlots) { controller.AddOutputCard(kvp.Value, kvp.Key); @@ -188,11 +191,18 @@ namespace PepperDash.Essentials.DM SystemIdBusyFeedback = new BoolFeedback(() => { return (Chassis as DmMDMnxn).SystemIdBusy.BoolValue; }); InputCardHdcpCapabilityFeedbacks = new Dictionary(); InputCardHdcpCapabilityTypes = new Dictionary(); + } + public override bool CustomActivate() + { + Debug.Console(2, this, "Setting up feedbacks."); - for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) + // Setup Output Card Feedbacks + for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) { - var tempX = x; + var tempX = x; + + Debug.Console(2, this, "Setting up feedbacks for output slot: {0}", tempX); if (Chassis.Outputs[tempX] != null) { @@ -235,26 +245,41 @@ namespace PepperDash.Essentials.DM } }); OutputAudioRouteNameFeedbacks[tempX] = new StringFeedback(() => + { + if (Chassis.Outputs[tempX].AudioOutFeedback != null) { - if (Chassis.Outputs[tempX].AudioOutFeedback != null) - { - return Chassis.Outputs[tempX].AudioOutFeedback.NameFeedback.StringValue; - } - else - { - return NoRouteText; + return Chassis.Outputs[tempX].AudioOutFeedback.NameFeedback.StringValue; + } + else + { + return NoRouteText; - } - }); + } + }); - OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => + OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Outputs[tempX].EndpointOnlineFeedback; }); } + else + { + Debug.Console(2, this, "No Output Card defined in slot: {0}", tempX); + } + }; + + // Setup Input Card Feedbacks + for (uint x = 1; x <= Chassis.NumberOfInputs; x++) + { + var tempX = x; + + Debug.Console(2, this, "Setting up feedbacks for input slot: {0}", tempX); + + CheckForHdcp2Property(tempX); if (Chassis.Inputs[tempX] != null) { + UsbInputRoutedToFeebacks[tempX] = new IntFeedback(() => { if (Chassis.Inputs[tempX].USBRoutedToFeedback != null) { return (ushort)Chassis.Inputs[tempX].USBRoutedToFeedback.Number; } @@ -279,7 +304,7 @@ namespace PepperDash.Essentials.DM } }); - InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => + InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; }); @@ -288,6 +313,8 @@ namespace PepperDash.Essentials.DM { var inputCard = Chassis.Inputs[tempX]; + Debug.Console(2, this, "Adding InputCardHdcpCapabilityFeedback for slot: {0}", inputCard); + if (inputCard.Card is DmcHd) { InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport; @@ -342,8 +369,32 @@ namespace PepperDash.Essentials.DM return 0; }); } - } - } + else + { + Debug.Console(2, this, "No Input Card defined in slot: {0}", tempX); + } + } + + return base.CustomActivate(); + } + + /// + /// Checks for presence of config property defining if the input card supports HDCP2. + /// If not found, assumes false. + /// + /// Input Slot + void CheckForHdcp2Property(uint inputSlot) + { + if (!PropertiesConfig.InputSlotSupportsHdcp2.ContainsKey(inputSlot)) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Warning, +@"Properties Config does not define inputSlotSupportsHdcp2 entry for input card: {0}. Assuming false. +If HDCP2 is required, HDCP control/feedback will not fucntion correctly!", inputSlot); + PropertiesConfig.InputSlotSupportsHdcp2.Add(inputSlot, false); + } + else + Debug.Console(2, this, "inputSlotSupportsHdcp2 for input card: {0} = {1}", inputSlot, PropertiesConfig.InputSlotSupportsHdcp2[inputSlot]); + } /// /// @@ -566,6 +617,13 @@ namespace PepperDash.Essentials.DM var cecPort2 = outputCard.Card2.HdmiOutput; AddDmcHdoPorts(number, cecPort1, cecPort2); } + else if (type == "dmc4kzhdo") + { + var outputCard = new Dmc4kzHdoSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + var cecPort2 = outputCard.Card2.HdmiOutput; + AddDmcHdoPorts(number, cecPort1, cecPort2); + } else if (type == "dmchdo") { var outputCard = new DmcHdoSingle(number, Chassis); @@ -579,13 +637,13 @@ namespace PepperDash.Essentials.DM var cecPort1 = outputCard.Card1.HdmiOutput; AddDmcCoPorts(number, cecPort1); } - else if (type == "dmc4kzcohd") - { + else if (type == "dmc4kzcohd") + { var outputCard = new Dmc4kzCoHdSingle(number, Chassis); var cecPort1 = outputCard.Card1.HdmiOutput; AddDmcCoPorts(number, cecPort1); } - else if (type == "dmccohd") + else if (type == "dmccohd") { var outputCard = new DmcCoHdSingle(number, Chassis); var cecPort1 = outputCard.Card1.HdmiOutput; From 48cc8ec33fb44fe8a77055670406818a483d9e1c Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 11 Feb 2020 18:49:43 -0600 Subject: [PATCH 08/30] ECS-1258 : Fixed Issue related to improper bridging of c2nrths and statusSign. ECS-1248 : FIxed issues related to duplucate joins on GLSODTCCN ECS-1252 : Fixed Missing Feedbacks in c2nrths and StatusSign --- .../Bridges/C2nRthsControllerBridge.cs | 64 ++--- .../GlsOccupancySensorBaseControllerBridge.cs | 222 +++++++++--------- .../JoinMaps/C2nRthsControllerJoinMap.cs | 80 +++---- .../JoinMaps/StatusSignControllerJoinMap.cs | 93 ++++---- .../Bridges/StatusSignControllerBridge.cs | 107 ++++----- .../Crestron/CrestronGenericBaseDevice.cs | 52 ++-- 6 files changed, 314 insertions(+), 304 deletions(-) diff --git a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs index a479797b..58f4600d 100644 --- a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs +++ b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs @@ -1,36 +1,38 @@ -using Crestron.SimplSharpPro.DeviceSupport; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.CrestronIO; - -namespace PepperDash.Essentials.Bridges -{ - public static class C2nRthsControllerApiExtensions - { - public static void LinkToApi(this C2nRthsController device, BasicTriList triList, uint joinStart, - string joinMapKey) - { - var joinMap = new C2nRthsControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, device, "Linking to Trilist '{0}'", triList.ID.ToString("X")); - +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.CrestronIO; + +namespace PepperDash.Essentials.Bridges +{ + public static class C2nRthsControllerApiExtensions + { + public static void LinkToApi(this C2nRthsController device, BasicTriList triList, uint joinStart, + string joinMapKey) + { + var joinMap = new C2nRthsControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, device, "Linking to Trilist '{0}'", triList.ID.ToString("X")); + + triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + device.IsOnline.LinkInputSig(triList.BooleanInput[joinMap.IsOnline]); device.TemperatureFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); - device.HumidityFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); + device.HumidityFeedback.LinkInputSig(triList.UShortInput[joinMap.Humidity]); - triList.StringInput[joinMap.Name].StringValue = device.Name; - - - } - - } + triList.StringInput[joinMap.Name].StringValue = device.Name; + + + } + + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs index 7afe5853..44250f4c 100644 --- a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs +++ b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs @@ -1,114 +1,114 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Essentials.Devices.Common.Occupancy; - -using PepperDash.Essentials.Core; -using PepperDash.Core; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Bridges -{ - public static class GlsOccupancySensorBaseControllerApiExtensions - { - public static void LinkToApi(this GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey) - { - GlsOccupancySensorBaseJoinMap joinMap = new GlsOccupancySensorBaseJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - #region Single and Dual Sensor Stuff - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - - // Occupied status - trilist.SetSigTrueAction(joinMap.ForceOccupied, new Action(() => occController.ForceOccupied())); - trilist.SetSigTrueAction(joinMap.ForceVacant, new Action(() => occController.ForceVacant())); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); - - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout, new Action((u) => occController.SetRemoteTimeout(u))); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); - occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); - - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash, new Action(() => occController.SetLedFlashEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableLedFlash, new Action(() => occController.SetLedFlashEnable(false))); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); - - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout, new Action(() => occController.SetShortTimeoutState(true))); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout, new Action(() => occController.SetShortTimeoutState(false))); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); - - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir, new Action(() => occController.SetPirEnable(true))); - trilist.SetSigTrueAction(joinMap.DisablePir, new Action(() => occController.SetPirEnable(false))); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); - - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); - - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); - #endregion - - #region Dual Technology Sensor Stuff - var odtOccController = occController as GlsOdtOccupancySensorController; - - if (odtOccController != null) - { - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated, new Action((b) => odtOccController.SetOrWhenVacatedState(b))); - odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); - - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated, new Action((b) => odtOccController.SetAndWhenVacatedState(b))); - odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); - - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA, new Action(() => odtOccController.SetUsAEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsA, new Action(() => odtOccController.SetUsAEnable(false))); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); - - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB, new Action(() => odtOccController.SetUsBEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsB, new Action(() => odtOccController.SetUsBEnable(false))); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); - - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, new Action((b) => odtOccController.IncrementUsSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, new Action((b) => odtOccController.DecrementUsSensitivityInOccupiedState(b))); - odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); - - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, new Action((b) => odtOccController.IncrementUsSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action((b) => odtOccController.DecrementUsSensitivityInVacantState(b))); - odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Essentials.Devices.Common.Occupancy; + +using PepperDash.Essentials.Core; +using PepperDash.Core; + +using Newtonsoft.Json; + +namespace PepperDash.Essentials.Bridges +{ + public static class GlsOccupancySensorBaseControllerApiExtensions + { + public static void LinkToApi(this GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey) + { + GlsOccupancySensorBaseJoinMap joinMap = new GlsOccupancySensorBaseJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + #region Single and Dual Sensor Stuff + occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + + // Occupied status + trilist.SetSigTrueAction(joinMap.ForceOccupied, new Action(() => occController.ForceOccupied())); + trilist.SetSigTrueAction(joinMap.ForceVacant, new Action(() => occController.ForceVacant())); + occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); + occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); + occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); + + // Timouts + trilist.SetUShortSigAction(joinMap.Timeout, new Action((u) => occController.SetRemoteTimeout(u))); + occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); + occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); + + // LED Flash + trilist.SetSigTrueAction(joinMap.EnableLedFlash, new Action(() => occController.SetLedFlashEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableLedFlash, new Action(() => occController.SetLedFlashEnable(false))); + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); + + // Short Timeout + trilist.SetSigTrueAction(joinMap.EnableShortTimeout, new Action(() => occController.SetShortTimeoutState(true))); + trilist.SetSigTrueAction(joinMap.DisableShortTimeout, new Action(() => occController.SetShortTimeoutState(false))); + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); + + // PIR Sensor + trilist.SetSigTrueAction(joinMap.EnablePir, new Action(() => occController.SetPirEnable(true))); + trilist.SetSigTrueAction(joinMap.DisablePir, new Action(() => occController.SetPirEnable(false))); + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); + + // PIR Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); + + // PIR Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); + #endregion + + #region Dual Technology Sensor Stuff + var odtOccController = occController as GlsOdtOccupancySensorController; + + if (odtOccController != null) + { + // OR When Vacated + trilist.SetBoolSigAction(joinMap.OrWhenVacated, new Action((b) => odtOccController.SetOrWhenVacatedState(b))); + odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); + + // AND When Vacated + trilist.SetBoolSigAction(joinMap.AndWhenVacated, new Action((b) => odtOccController.SetAndWhenVacatedState(b))); + odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); + + // Ultrasonic A Sensor + trilist.SetSigTrueAction(joinMap.EnableUsA, new Action(() => odtOccController.SetUsAEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsA, new Action(() => odtOccController.SetUsAEnable(false))); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); + + // Ultrasonic B Sensor + trilist.SetSigTrueAction(joinMap.EnableUsB, new Action(() => odtOccController.SetUsBEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsB, new Action(() => odtOccController.SetUsBEnable(false))); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); + + // US Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, new Action((b) => odtOccController.IncrementUsSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, new Action((b) => odtOccController.DecrementUsSensitivityInOccupiedState(b))); + odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); + + // US Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, new Action((b) => odtOccController.IncrementUsSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action((b) => odtOccController.DecrementUsSensitivityInVacantState(b))); + odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); + //Sensor Raw States odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback]); - odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); - - } - #endregion - } - } + odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); + + } + #endregion + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs index 00e6112a..be0f002e 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -1,43 +1,43 @@ -using System.Linq; -using Crestron.SimplSharp.Reflection; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class C2nRthsControllerJoinMap:JoinMapBase - { +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class C2nRthsControllerJoinMap:JoinMapBase + { public uint IsOnline { get; set; } - public uint Name { get; set; } - public uint Temperature { get; set; } - public uint Humidity { get; set; } - public uint TemperatureFormat { get; set; } - - public C2nRthsControllerJoinMap(uint joinStart) - { - //digital - IsOnline = 1; - TemperatureFormat = 2; - - //Analog - Temperature = 2; - Humidity = 3; - + public uint Name { get; set; } + public uint Temperature { get; set; } + public uint Humidity { get; set; } + public uint TemperatureFormat { get; set; } + + public C2nRthsControllerJoinMap() + { + //digital + IsOnline = 1; + TemperatureFormat = 2; + + //Analog + Temperature = 2; + Humidity = 3; + //serial - Name = 1; - - OffsetJoinNumbers(joinStart); - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - var properties = - GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); - - foreach (var propertyInfo in properties) - { - propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); - } - } - } + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs index 933f6f74..d3a95383 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -1,50 +1,49 @@ -using System.Linq; -using Crestron.SimplSharp.Reflection; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class StatusSignControllerJoinMap:JoinMapBase - { +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class StatusSignControllerJoinMap:JoinMapBase + { public uint IsOnline { get; set; } - public uint Name { get; set; } - public uint RedLed { get; set; } - public uint GreenLed { get; set; } - public uint BlueLed { get; set; } - public uint RedControl { get; set; } - public uint GreenControl { get; set; } - public uint BlueControl { get; set; } - - public StatusSignControllerJoinMap(uint joinStart) - { - //digital - IsOnline = 1; - RedControl = 2; - GreenControl = 3; - BlueControl = 4; - - //Analog - RedLed = 2; - GreenLed = 3; - BlueLed = 4; - + public uint Name { get; set; } + public uint RedLed { get; set; } + public uint GreenLed { get; set; } + public uint BlueLed { get; set; } + public uint RedControl { get; set; } + public uint GreenControl { get; set; } + public uint BlueControl { get; set; } + + public StatusSignControllerJoinMap() + { + //digital + IsOnline = 1; + RedControl = 2; + GreenControl = 3; + BlueControl = 4; + + //Analog + RedLed = 2; + GreenLed = 3; + BlueLed = 4; + //string - Name = 1; - - - OffsetJoinNumbers(joinStart); - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - var properties = - GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); - - foreach (var propertyInfo in properties) - { - propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); - } - } - } + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs index 7c0bab9e..df38ba26 100644 --- a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs +++ b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs @@ -1,64 +1,65 @@ -using Crestron.SimplSharpPro.DeviceSupport; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.CrestronIO; - -namespace PepperDash.Essentials.Bridges -{ - public static class StatusSignDeviceApiExtensions - { - public static void LinkToApi(this StatusSignController ssDevice, BasicTriList trilist, uint joinStart, - string joinMapKey) - { - var joinMap = new StatusSignControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, ssDevice, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, ssDevice)); - trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, ssDevice)); - trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, ssDevice)); - - trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); - trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.CrestronIO; + +namespace PepperDash.Essentials.Bridges +{ + public static class StatusSignDeviceApiExtensions + { + public static void LinkToApi(this StatusSignController ssDevice, BasicTriList trilist, uint joinStart, + string joinMapKey) + { + var joinMap = new StatusSignControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, ssDevice, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, ssDevice)); + trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, ssDevice)); + trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, ssDevice)); + + trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.StringInput[joinMap.Name].StringValue = ssDevice.Name; + ssDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); ssDevice.RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); ssDevice.BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); ssDevice.GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); ssDevice.RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); ssDevice.BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); - ssDevice.GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); - - } - - private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) - { - var redEnable = triList.BooleanOutput[joinMap.RedControl].BoolValue; - var greenEnable = triList.BooleanOutput[joinMap.GreenControl].BoolValue; - var blueEnable = triList.BooleanOutput[joinMap.BlueControl].BoolValue; - device.EnableLedControl(redEnable, greenEnable, blueEnable); - } - - private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) - { - var redBrightness = triList.UShortOutput[joinMap.RedLed].UShortValue; - var greenBrightness = triList.UShortOutput[joinMap.GreenLed].UShortValue; - var blueBrightness = triList.UShortOutput[joinMap.BlueLed].UShortValue; - - device.SetColor(redBrightness, greenBrightness, blueBrightness); - } - } + ssDevice.GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); + + } + + private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redEnable = triList.BooleanOutput[joinMap.RedControl].BoolValue; + var greenEnable = triList.BooleanOutput[joinMap.GreenControl].BoolValue; + var blueEnable = triList.BooleanOutput[joinMap.BlueControl].BoolValue; + device.EnableLedControl(redEnable, greenEnable, blueEnable); + } + + private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redBrightness = triList.UShortOutput[joinMap.RedLed].UShortValue; + var greenBrightness = triList.UShortOutput[joinMap.GreenLed].UShortValue; + var blueBrightness = triList.UShortOutput[joinMap.BlueLed].UShortValue; + + device.SetColor(redBrightness, greenBrightness, blueBrightness); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 08223e03..ae1fedde 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -30,23 +30,27 @@ namespace PepperDash.Essentials.Core /// Used by implementing classes to prevent registration with Crestron TLDM. For /// devices like RMCs and TXs attached to a chassis. /// - public bool PreventRegistration { get; protected set; } - - public CrestronGenericBaseDevice(string key, string name, GenericBase hardware) - : base(key, name) - { - Feedbacks = new FeedbackCollection(); - - Hardware = hardware; - IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); - IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); - IpConnectionsText = new StringFeedback("IpConnectionsText", () => - string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray())); - - AddToFeedbackList(IsOnline, IsRegistered, IpConnectionsText); - - CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); - } + public bool PreventRegistration { get; protected set; } + + public CrestronGenericBaseDevice(string key, string name, GenericBase hardware) + : base(key, name) + { + Feedbacks = new FeedbackCollection(); + + Hardware = hardware; + IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); + IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); + IpConnectionsText = new StringFeedback("IpConnectionsText", () => + { + if (Hardware.ConnectedIpList != null) + return string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()); + else + return string.Empty; + }); + AddToFeedbackList(IsOnline, IsRegistered, IpConnectionsText); + + CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); + } /// /// Make sure that overriding classes call this! @@ -65,7 +69,11 @@ namespace PepperDash.Essentials.Core //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); return false; } - } + } + foreach (var f in Feedbacks) + { + f.FireUpdate(); + } Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange); CommunicationMonitor.Start(); @@ -97,7 +105,7 @@ namespace PepperDash.Essentials.Core { if (!Feedbacks.Contains(f)) { - Feedbacks.Add(f); + Feedbacks.Add(f); } } } @@ -105,14 +113,14 @@ namespace PepperDash.Essentials.Core void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { - if (args.DeviceOnLine) - { + //if (args.DeviceOnLine) + //{ foreach (var feedback in Feedbacks) { if (feedback != null) feedback.FireUpdate(); } - } + //} } #region IStatusMonitor Members From f1278d0ee4ecf2a751c2ce26b60f3708859d49e1 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 12 Feb 2020 16:07:43 -0700 Subject: [PATCH 09/30] Adds debug statement to Hardware_OnlineStatusChange callback to help figure out issues with devices not reporting online status correctly. Removes IsRegistered from Feedbacks and fires update manually. --- .../Crestron/CrestronGenericBaseDevice.cs | 283 +++++++++--------- 1 file changed, 144 insertions(+), 139 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index ae1fedde..6d6a5fb4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - /// - /// A bridge class to cover the basic features of GenericBase hardware - /// - public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking - { - public virtual GenericBase Hardware { get; protected set; } - - /// - /// Returns a list containing the Outputs that we want to expose. - /// - public FeedbackCollection Feedbacks { get; private set; } - - public BoolFeedback IsOnline { get; private set; } - public BoolFeedback IsRegistered { get; private set; } - public StringFeedback IpConnectionsText { get; private set; } - - /// - /// Used by implementing classes to prevent registration with Crestron TLDM. For - /// devices like RMCs and TXs attached to a chassis. - /// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; + +namespace PepperDash.Essentials.Core +{ + /// + /// A bridge class to cover the basic features of GenericBase hardware + /// + public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking + { + public virtual GenericBase Hardware { get; protected set; } + + /// + /// Returns a list containing the Outputs that we want to expose. + /// + public FeedbackCollection Feedbacks { get; private set; } + + public BoolFeedback IsOnline { get; private set; } + public BoolFeedback IsRegistered { get; private set; } + public StringFeedback IpConnectionsText { get; private set; } + + /// + /// Used by implementing classes to prevent registration with Crestron TLDM. For + /// devices like RMCs and TXs attached to a chassis. + /// public bool PreventRegistration { get; protected set; } public CrestronGenericBaseDevice(string key, string name, GenericBase hardware) @@ -47,118 +47,123 @@ namespace PepperDash.Essentials.Core else return string.Empty; }); - AddToFeedbackList(IsOnline, IsRegistered, IpConnectionsText); + AddToFeedbackList(IsOnline, IpConnectionsText); CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); - } - - /// - /// Make sure that overriding classes call this! - /// Registers the Crestron device, connects up to the base events, starts communication monitor - /// - public override bool CustomActivate() - { - Debug.Console(0, this, "Activating"); - 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; - } + } + + /// + /// Make sure that overriding classes call this! + /// Registers the Crestron device, connects up to the base events, starts communication monitor + /// + public override bool CustomActivate() + { + Debug.Console(0, this, "Activating"); + 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; + } + + IsRegistered.FireUpdate(); } + foreach (var f in Feedbacks) { f.FireUpdate(); - } - - Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange); - CommunicationMonitor.Start(); - - return true; - } - - /// - /// This disconnects events and unregisters the base hardware device. - /// - /// - public override bool Deactivate() - { - CommunicationMonitor.Stop(); - Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange; - - return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; - } - - /// - /// Adds feedback(s) to the list - /// - /// - public void AddToFeedbackList(params Feedback[] newFbs) - { - foreach (var f in newFbs) - { - if (f != null) - { - if (!Feedbacks.Contains(f)) - { + } + + Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange); + CommunicationMonitor.Start(); + + return true; + } + + /// + /// This disconnects events and unregisters the base hardware device. + /// + /// + public override bool Deactivate() + { + CommunicationMonitor.Stop(); + Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange; + + var success = Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; + + IsRegistered.FireUpdate(); + + return success; + } + + /// + /// Adds feedback(s) to the list + /// + /// + public void AddToFeedbackList(params Feedback[] newFbs) + { + foreach (var f in newFbs) + { + if (f != null) + { + if (!Feedbacks.Contains(f)) + { Feedbacks.Add(f); - } - } - } - } - - void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) - { - //if (args.DeviceOnLine) - //{ - foreach (var feedback in Feedbacks) - { - if (feedback != null) - feedback.FireUpdate(); - } - //} - } - - #region IStatusMonitor Members - - public StatusMonitorBase CommunicationMonitor { get; private set; } - #endregion - - #region IUsageTracking Members - - public UsageTracking UsageTracker { get; set; } - - #endregion - } - - //*********************************************************************************** - public class CrestronGenericBaseDeviceEventIds - { - public const uint IsOnline = 1; - public const uint IpConnectionsText =2; - } - - /// - /// Adds logging to Register() failure - /// - public static class GenericBaseExtensions - { - public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key) - { - var result = device.Register(); - var level = result == eDeviceRegistrationUnRegistrationResponse.Success ? - Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error; - Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result); - //if (result != eDeviceRegistrationUnRegistrationResponse.Success) - //{ - // Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result); - //} - return result; - } - - } + } + } + } + } + + void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + Debug.Console(2, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine); + foreach (var feedback in Feedbacks) + { + if (feedback != null) + feedback.FireUpdate(); + } + } + + #region IStatusMonitor Members + + public StatusMonitorBase CommunicationMonitor { get; private set; } + #endregion + + #region IUsageTracking Members + + public UsageTracking UsageTracker { get; set; } + + #endregion + } + + //*********************************************************************************** + public class CrestronGenericBaseDeviceEventIds + { + public const uint IsOnline = 1; + public const uint IpConnectionsText =2; + } + + /// + /// Adds logging to Register() failure + /// + public static class GenericBaseExtensions + { + public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key) + { + var result = device.Register(); + var level = result == eDeviceRegistrationUnRegistrationResponse.Success ? + Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error; + Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result); + //if (result != eDeviceRegistrationUnRegistrationResponse.Success) + //{ + // Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result); + //} + return result; + } + + } } \ No newline at end of file From 8a09ffa7e4626de59cb17ea3977751fb7f3def9a Mon Sep 17 00:00:00 2001 From: bitm0de Date: Sat, 15 Feb 2020 14:28:10 -0700 Subject: [PATCH 10/30] Updated to HDCPSupportOnFeedback from obsolete HDPCSupportOnFeedback --- .../Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs | 2 +- .../Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs | 2 +- .../Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 2a898b19..3b48a0f5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -115,7 +115,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 224510aa..ba7a005d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -116,7 +116,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index b0356f0d..86003aae 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -122,7 +122,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; From ee26e77f15d320623e8d575feeab4d7db002a61b Mon Sep 17 00:00:00 2001 From: bitm0de Date: Sat, 15 Feb 2020 14:28:41 -0700 Subject: [PATCH 11/30] Added plugin entrypoint attribute and interface --- .../Plugins/IPluginDeviceConfig.cs | 10 ++++++++++ .../Plugins/PluginEntrypointAttribute.cs | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs new file mode 100644 index 00000000..b131437d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs @@ -0,0 +1,10 @@ +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Core.Plugins +{ + public interface IPluginDeviceConfig + { + IKeyed BuildDevice(DeviceConfig dc); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs new file mode 100644 index 00000000..f802211f --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs @@ -0,0 +1,19 @@ +using System; + +namespace PepperDash.Essentials.Core.Plugins +{ + [AttributeUsage(AttributeTargets.Class)] + public sealed class PluginEntryPointAttribute : Attribute + { + private readonly string _uniqueKey; + + public string UniqueKey { + get { return _uniqueKey; } + } + + public PluginEntryPointAttribute(string key) + { + _uniqueKey = key; + } + } +} \ No newline at end of file From 00e14b746bcfb31f472fe5baf5564e1ef4457481 Mon Sep 17 00:00:00 2001 From: bitm0de Date: Sat, 15 Feb 2020 14:32:46 -0700 Subject: [PATCH 12/30] Added floating point epsilon comparison for equality check --- .../Essentials Devices Common/Codec/iHasScheduleAwareness.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs index 5a006388..57839471 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs @@ -73,17 +73,18 @@ namespace PepperDash.Essentials.Devices.Common.Codec { // Iterate the meeting list and check if any meeting need to do anythingk + const double meetingTimeEpsilon = 0.0001; foreach (Meeting m in Meetings) { eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown; if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start changeType = eMeetingEventChangeType.MeetingStartWarning; - else if (m.TimeToMeetingStart.TotalMinutes == 0) // Meeting Start + else if (Math.Abs(m.TimeToMeetingStart.TotalMinutes) < meetingTimeEpsilon) // Meeting Start changeType = eMeetingEventChangeType.MeetingStart; else if (m.TimeToMeetingEnd.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to end changeType = eMeetingEventChangeType.MeetingEndWarning; - else if (m.TimeToMeetingEnd.TotalMinutes == 0) // Meeting has ended + else if (Math.Abs(m.TimeToMeetingEnd.TotalMinutes) < meetingTimeEpsilon) // Meeting has ended changeType = eMeetingEventChangeType.MeetingEnd; if (changeType != eMeetingEventChangeType.Unkown) From c420e0654095e09eaf6fff7c61cb949801b462d2 Mon Sep 17 00:00:00 2001 From: bitm0de Date: Sat, 15 Feb 2020 14:43:31 -0700 Subject: [PATCH 13/30] Fixed conditional check to prevent NullReferenceException --- .../VideoCodec/CiscoCodec/BookingsDataClasses.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs index 46d171cf..cf4d8530 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs @@ -336,8 +336,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec if(b.Agenda != null) meeting.Agenda = b.Agenda.Value; if(b.Time != null) + { meeting.StartTime = b.Time.StartTime.Value; meeting.EndTime = b.Time.EndTime.Value; + } if(b.Privacy != null) meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value); From 86dcd066fe573d4464d9989ede497a09565bb446 Mon Sep 17 00:00:00 2001 From: bitm0de Date: Sat, 15 Feb 2020 15:10:22 -0700 Subject: [PATCH 14/30] Added MinimumEssentialsFrameworkVersion to plugin interface --- .../PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs index b131437d..7ac894c6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs @@ -5,6 +5,7 @@ namespace PepperDash.Essentials.Core.Plugins { public interface IPluginDeviceConfig { + string MinimumEssentialsFrameworkVersion { get; } IKeyed BuildDevice(DeviceConfig dc); } } \ No newline at end of file From f33f42a40e1ee4d61daa50728753cfafbdba3a72 Mon Sep 17 00:00:00 2001 From: bitm0de Date: Sat, 15 Feb 2020 19:51:09 -0700 Subject: [PATCH 15/30] Fixed misspelling --- .../PepperDashEssentialsBase/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs index f9464b7d..5c1f9863 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ [assembly: AssemblyTitle("PepperDashEssentialsBase")] [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentialsBase")] -[assembly: AssemblyCopyright("Copyright © Ppperdash 2019")] +[assembly: AssemblyCopyright("Copyright © Pepperdash 2019")] [assembly: AssemblyVersion("1.4.0.*")] \ No newline at end of file From 0228d2938d562faa2161e4acaefb617fb9280631 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Feb 2020 16:22:11 -0700 Subject: [PATCH 16/30] Updates PepperDash.Core to 1.0.33 --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index acebe6b4..27a665b6 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit acebe6b43b28cc3a93f899e9714292a0cc1ab2cc +Subproject commit 27a665b68a0725729bb09138bb85f575833df4b2 From 73ab16ce55c49bd2895fb5f9f0964f9d11a49878 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Feb 2020 20:09:51 -0700 Subject: [PATCH 17/30] Adds FreeRun support for DM-TX-201-C. Need to test on NYC hardware and then apply to other TX classes. --- .../Transmitters/DmTx201CController.cs | 34 +++++++++++++++++-- .../Endpoints/Transmitters/IFreeRunEnabled.cs | 20 +++++++++++ .../Essentials_DM/Essentials_DM.csproj | 1 + 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index ba7a005d..28c5611b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback + public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun { public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C @@ -33,8 +33,7 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } /// /// Helps get the "real" inputs, including when in Auto @@ -122,6 +121,8 @@ namespace PepperDash.Essentials.DM return 0; }); + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; var combinedFuncs = new VideoStatusFuncsWrapper @@ -195,6 +196,28 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable) + /// + /// + /// + /// public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); @@ -250,6 +273,7 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); } + } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) @@ -264,6 +288,10 @@ namespace PepperDash.Essentials.DM { HdmiInHdcpCapabilityFeedback.FireUpdate(); } + else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId) + { + FreeRunEnabledFeedback.FireUpdate(); + } } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs new file mode 100644 index 00000000..7410af9c --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.DM +{ + /// + /// Defines a device capable of setting the Free Run state of a VGA input and reporting feedback + /// + public interface IHasFreeRun + { + BoolFeedback FreeRunEnabledFeedback { get; } + + void SetFreeRunEnabled(bool enable); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj index 6f31634d..127a9e42 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -96,6 +96,7 @@ + From 3e16cbb092421df55a2f2992e009b40b82e5d7f7 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Feb 2020 20:45:01 -0700 Subject: [PATCH 18/30] Adds VGA brightness and contrast feedback/control to DM-TX-201-C --- .../Transmitters/DmTx201CController.cs | 38 +++++++++++++++++-- .../{IFreeRunEnabled.cs => TxInterfaces.cs} | 12 ++++++ .../Essentials_DM/Essentials_DM.csproj | 2 +- 3 files changed, 48 insertions(+), 4 deletions(-) rename essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/{IFreeRunEnabled.cs => TxInterfaces.cs} (57%) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 28c5611b..9195851e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -35,6 +35,9 @@ namespace PepperDash.Essentials.DM public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } + /// /// Helps get the "real" inputs, including when in Auto /// @@ -123,6 +126,11 @@ namespace PepperDash.Essentials.DM FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; var combinedFuncs = new VideoStatusFuncsWrapper @@ -157,7 +165,7 @@ namespace PepperDash.Essentials.DM }; AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this); HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, @@ -175,6 +183,21 @@ namespace PepperDash.Essentials.DM DmOutput.Port = Tx.DmOutput; } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { ActiveVideoInputFeedback.FireUpdate(); @@ -184,8 +207,7 @@ namespace PepperDash.Essentials.DM } public override bool CustomActivate() - { - + { Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); @@ -212,6 +234,16 @@ namespace PepperDash.Essentials.DM } } + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + /// /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable) /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs similarity index 57% rename from essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs rename to essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs index 7410af9c..50955dda 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/IFreeRunEnabled.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs @@ -17,4 +17,16 @@ namespace PepperDash.Essentials.DM void SetFreeRunEnabled(bool enable); } + + /// + /// Defines a device capable of adjusting VGA settings + /// + public interface IVgaBrightnessContrastControls + { + IntFeedback VgaBrightnessFeedback { get; } + IntFeedback VgaContrastFeedback { get; } + + void SetVgaBrightness(ushort level); + void SetVgaContrast(ushort level); + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj index 127a9e42..322cbdab 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -96,7 +96,7 @@ - + From e894e2d1b4feaffe3a638d0bc479b28eec91370c Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Feb 2020 20:46:42 -0700 Subject: [PATCH 19/30] Adds IVgaBrightnessContrastControls to DmTx201XController --- .../Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 9195851e..c5811263 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun + public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C From c62508b8ae9e3fb5ef12e0c51eb9f558fbfe4526 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 19 Feb 2020 10:41:42 -0700 Subject: [PATCH 20/30] Create CONTRIBUTING.md --- CONTRIBUTING.md | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..47fb6951 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,110 @@ +# Contributors Guide + +Essentials is an open source project. If you are interested in making it better, +there are many ways you can contribute. For example, you can: + +- Submit a bug report +- Suggest a new feature +- Provide feedback by commenting on feature requests/proposals +- Propose a patch by submitting a pull request +- Suggest or submit documentation improvements +- Review outstanding pull requests +- Answer questions from other users +- Share the software with other users who are interested +- Teach others to use the software + +## Bugs and Feature Requests + +If you believe that you have found a bug or wish to propose a new feature, +please first search the existing [issues] to see if it has already been +reported. If you are unable to find an existing issue, consider using one of +the provided templates to create a new issue and provide as many details as you +can to assist in reproducing the bug or explaining your proposed feature. + +## Patch Submission tips + +Patches should be submitted in the form of Pull Requests to the Essentials +[repository] on GitHub. But first, consider the following tips to ensure a +smooth process when submitting a patch: + +- Ensure that the patch compiles and does not break any build-time tests. +- Be understanding, patient, and friendly; developers may need time to review + your submissions before they can take action or respond. This does not mean + your contribution is not valued. If your contribution has not received a + response in a reasonable time, consider commenting with a polite inquiry for + an update. +- Limit your patches to the smallest reasonable change to achieve your intended + goal. For example, do not make unnecessary indentation changes; but don't go + out of your way to make the patch so minimal that it isn't easy to read, + either. Consider the reviewer's perspective. +- Before submission, please squash your commits to using a message that starts + with the issue number and a description of the changes. +- Isolate multiple patches from each other. If you wish to make several + independent patches, do so in separate, smaller pull requests that can be + reviewed more easily. +- Be prepared to answer questions from reviewers. They may have further + questions before accepting your patch, and may even propose changes. Please + accept this feedback constructively, and not as a rejection of your proposed + change. + +## GitFlow Branch Model +This repository adheres to the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model and is intitialized for GitFlow to make for consistend branch name prefixes. Please take time to familiarize yourself with this model. + +- `master` will contain the latest stable version of the framework and release builds will be created from tagged commits on `master`. +- HotFix/Patch Pull Requests should target the `master` as the base branch. +- All other Pull Requests (bug fixes, enhancements, etc.) should target the `development` as the base branch. +- `release/vX.Y.X` branches will be used for release candidates when moving new features from `development` to `master`. + Beta builds will be created from tagged commits on release candidate branches. + +## Review + +- We welcome code reviews from anyone. A committer is required to formally + accept and merge the changes. +- Reviewers will be looking for things like threading issues, performance + implications, API design, duplication of existing functionality, readability + and code style, avoidance of bloat (scope-creep), etc. +- Reviewers will likely ask questions to better understand your change. +- Reviewers will make comments about changes to your patch: + - MUST means that the change is required + - SHOULD means that the change is suggested, further discussion on the + subject may be required + - COULD means that the change is optional + +## Timeline and Managing Expectations + +As we continue to engage contributors and learn best practices for running a successful open source project, our processes +and guidance will likely evolve. We will try to communicate expectations as we are able and to always be responsive. We +hope that the community will share their suggestions for improving this engagement. Based on the level of initial interest +we receive and the availability of resources to evaluate contributions, we anticipate the following: + +- We will initially prioritize pull requests that include small bug fixes and code that addresses potential vulnerabilities + as well as pull requests that include improvements for processor language specifications because these require a + reasonable amount of effort to evaluate and will help us exercise and revise our process for accepting contributions. In + other words, we are going to start small in order to work out the kinks first. +- We are committed to maintaining the integrity and security of our code base. In addition to the careful review the + maintainers will give to code contributions to make sure they do not introduce new bugs or vulnerabilities, we will be + trying to identify best practices to incorporate with our open source project so that contributors can have more control + over whether their contributions are accepted. These might include things like style guides and requirements for tests and + documentation to accompany some code contributions. As a result, it may take a long time for some contributions to be + accepted. This does not mean we are ignoring them. +- We are committed to integrating this GitHub project with our team's regular development work flow so that the open source + project remains dynamic and relevant. This may affect our responsiveness and ability to accept pull requests + quickly. This does not mean we are ignoring them. +- Not all innovative ideas need to be accepted as pull requests into this GitHub project to be valuable to the community. + There may be times when we recommend that you just share your code for some enhancement to Ghidra from your own + repository. As we identify and recognize extensions that are of general interest to the reverse engineering community, we + may seek to incorporate them with our baseline. + +## Legal + +Consistent with Section D.6. of the GitHub Terms of Service as of 2019, and the MIT license, the project maintainer for this project accepts contributions using the inbound=outbound model. +When you submit a pull request to this repository (inbound), you are agreeing to license your contribution under the same terms as specified in [LICENSE] (outbound). + +This is an open source project. +Contributions you make to this repository are completely voluntary. +When you submit an issue, bug report, question, enhancement, pull request, etc., you are offering your contribution without expectation of payment, you expressly waive any future pay claims against PepperDash related to your contribution, and you acknowledge that this does not create an obligation on the part of PepperDash of any kind. +Furthermore, your contributing to this project does not create an employer-employee relationship between the PepperDash and the contributor. + +[issues]: https://github.com/PepperDash/Essentials/issues +[repository]: https://github.com/PepperDash/Essentials +[LICENSE]: https://github.com/PepperDash/Essentials/blob/master/LICENSE.md From ddeb41832ff2871d00e60379d0df8bea80cea146 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 19 Feb 2020 12:41:48 -0700 Subject: [PATCH 21/30] Update CONTRIBUTING.md Fixes spelling and grammar errors pointed out by @minesguy82 --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47fb6951..890b7769 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,11 +48,11 @@ smooth process when submitting a patch: change. ## GitFlow Branch Model -This repository adheres to the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model and is intitialized for GitFlow to make for consistend branch name prefixes. Please take time to familiarize yourself with this model. +This repository adheres to the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model and is intitialized for GitFlow to make for consistent branch name prefixes. Please take time to familiarize yourself with this model. - `master` will contain the latest stable version of the framework and release builds will be created from tagged commits on `master`. -- HotFix/Patch Pull Requests should target the `master` as the base branch. -- All other Pull Requests (bug fixes, enhancements, etc.) should target the `development` as the base branch. +- HotFix/Patch Pull Requests should target `master` as the base branch. +- All other Pull Requests (bug fixes, enhancements, etc.) should target `development` as the base branch. - `release/vX.Y.X` branches will be used for release candidates when moving new features from `development` to `master`. Beta builds will be created from tagged commits on release candidate branches. From b7f97dc146cf1069e16b7fb6b0705743eda63b24 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 20 Feb 2020 15:32:49 -0700 Subject: [PATCH 22/30] Adds new joins to DmTxControllerJoinMap and associated bridge --- .../Bridges/DmTxControllerBridge.cs | 20 +++++++++++++++++-- .../Bridges/JoinMaps/DmTxControllerJoinMap.cs | 20 +++++++++++++++++++ .../Timers/CountdownTimer.cs | 12 +++++++---- .../Transmitters/DmTx201CController.cs | 8 ++++++++ 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs index 2017acb4..91f8c6d7 100644 --- a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs @@ -57,7 +57,7 @@ namespace PepperDash.Essentials.Bridges trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; - if(txR.InputPorts[DmPortName.HdmiIn] != null) + if (txR.InputPorts[DmPortName.HdmiIn] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn]; @@ -71,7 +71,7 @@ namespace PepperDash.Essentials.Bridges SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); } } - + if (txR.InputPorts[DmPortName.HdmiIn1] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn1]; @@ -103,6 +103,22 @@ namespace PepperDash.Essentials.Bridges } } + + var txFreeRun = tx as IHasFreeRun; + if (txFreeRun != null) + { + txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]); + trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action(b => txFreeRun.SetFreeRunEnabled(b))); + } + + var txVga = tx as IVgaBrightnessContrastControls; + { + txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]); + txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]); + + trilist.SetUShortSigAction(joinMap.VgaBrightness, new Action(u => txVga.SetVgaBrightness(u))); + trilist.SetUShortSigAction(joinMap.VgaContrast, new Action(u => txVga.SetVgaContrast(u))); + } } static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs index e68e5ad2..ff673cab 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -18,6 +18,10 @@ namespace PepperDash.Essentials.Bridges /// High when video sync is detected /// public uint VideoSyncStatus { get; set; } + /// + /// + /// + public uint FreeRunEnabled { get; set; } #endregion #region Analogs @@ -41,6 +45,16 @@ namespace PepperDash.Essentials.Bridges /// Sets and reports the current HDCP state for the corresponding input port /// public uint Port2HdcpState { get; set; } + + /// + /// Sets and reports the current VGA Brightness level + /// + public uint VgaBrightness { get; set; } + + /// + /// Sets and reports the current VGA Contrast level + /// + public uint VgaContrast { get; set; } #endregion #region Serials @@ -56,6 +70,7 @@ namespace PepperDash.Essentials.Bridges // Digital IsOnline = 1; VideoSyncStatus = 2; + FreeRunEnabled = 3; // Serial CurrentInputResolution = 1; // Analog @@ -64,6 +79,8 @@ namespace PepperDash.Essentials.Bridges HdcpSupportCapability = 3; Port1HdcpState = 4; Port2HdcpState = 5; + VgaBrightness = 6; + VgaContrast = 7; } public override void OffsetJoinNumbers(uint joinStart) @@ -72,12 +89,15 @@ namespace PepperDash.Essentials.Bridges IsOnline = IsOnline + joinOffset; VideoSyncStatus = VideoSyncStatus + joinOffset; + FreeRunEnabled = FreeRunEnabled + joinOffset; CurrentInputResolution = CurrentInputResolution + joinOffset; VideoInput = VideoInput + joinOffset; AudioInput = AudioInput + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset; Port1HdcpState = Port1HdcpState + joinOffset; Port2HdcpState = Port2HdcpState + joinOffset; + VgaBrightness = VgaBrightness + joinOffset; + VgaContrast = VgaContrast + joinOffset; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs index a8da97e4..4878a206 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs @@ -23,6 +23,10 @@ namespace PepperDash.Essentials.Core public StringFeedback TimeRemainingFeedback { get; private set; } public bool CountsDown { get; set; } + + /// + /// The number of seconds to countdown + /// public int SecondsToCount { get; set; } public DateTime StartTime { get; private set; } @@ -31,7 +35,7 @@ namespace PepperDash.Essentials.Core CTimer SecondTimer; /// - /// + /// Constructor /// /// public SecondsCountdownTimer(string key) @@ -61,7 +65,7 @@ namespace PepperDash.Essentials.Core } /// - /// + /// Starts the Timer /// public void Start() { @@ -82,7 +86,7 @@ namespace PepperDash.Essentials.Core } /// - /// + /// Restarts the timer /// public void Reset() { @@ -91,7 +95,7 @@ namespace PepperDash.Essentials.Core } /// - /// + /// Cancels the timer (without triggering it to finish) /// public void Cancel() { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index c5811263..37ee38b3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -234,11 +234,19 @@ namespace PepperDash.Essentials.DM } } + /// + /// Sets the VGA brightness level + /// + /// public void SetVgaBrightness(ushort level) { Tx.VgaInput.VideoControls.Brightness.UShortValue = level; } + /// + /// Sets the VGA contrast level + /// + /// public void SetVgaContrast(ushort level) { Tx.VgaInput.VideoControls.Contrast.UShortValue = level; From a1e9d35a69e1a6ddefe65365e5c080fd4c9a96f2 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 24 Feb 2020 12:21:52 -0700 Subject: [PATCH 23/30] Implements IHasFreeRun and IHasVgaBrightnessContrastControls on DMTx200Controller --- .../Transmitters/DmTx200Controller.cs | 65 ++++++++++++++++++- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 3b48a0f5..42ecf5c6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFeedback + public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx200C2G Tx { get; private set; } @@ -32,8 +32,10 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } /// /// Helps get the "real" inputs, including when in Auto @@ -123,6 +125,14 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + + var combinedFuncs = new VideoStatusFuncsWrapper { HdcpActiveFeedbackFunc = () => @@ -170,6 +180,21 @@ namespace PepperDash.Essentials.DM DmOutput.Port = Tx.DmOutput; } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { ActiveVideoInputFeedback.FireUpdate(); @@ -191,6 +216,40 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); From d80602d3c6e1c22abcad9b57c3c221e1c3eb5666 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 24 Feb 2020 14:11:18 -0700 Subject: [PATCH 24/30] Adds IHasFreeRun and IVgaBrightnessContrastControls to 401 and 302 Tx controller classes --- .../Transmitters/DmTx401CController.cs | 63 +++++++++++++++++- .../Transmitters/DmTx4k302CController.cs | 66 ++++++++++++++++++- 2 files changed, 125 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index 86003aae..18e91fbe 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -17,7 +17,7 @@ namespace PepperDash.Essentials.DM { using eVst = DmTx401C.eSourceSelection; - public class DmTx401CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts + public class DmTx401CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx401C Tx { get; private set; } @@ -34,6 +34,11 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } + /// /// Helps get the "real" inputs, including when in Auto /// @@ -130,6 +135,13 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + var combinedFuncs = new VideoStatusFuncsWrapper { HdcpActiveFeedbackFunc = () => @@ -269,6 +281,55 @@ namespace PepperDash.Essentials.DM } } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + /// /// Relays the input stream change to the appropriate RoutingInputPort. /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index cb91f857..baaac013 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback, - IIROutputPorts, IComPorts + IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx4k302C Tx { get; private set; } @@ -35,8 +35,10 @@ namespace PepperDash.Essentials.DM public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } /// /// Helps get the "real" inputs, including when in Auto @@ -122,6 +124,13 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + var combinedFuncs = new VideoStatusFuncsWrapper { @@ -181,6 +190,21 @@ namespace PepperDash.Essentials.DM DmOut.Port = Tx.DmOutput; } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + public override bool CustomActivate() @@ -199,6 +223,42 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + + + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); From bea94ceaf089e0192cbf3911ebd5129dbc0ff450 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 24 Feb 2020 16:07:38 -0700 Subject: [PATCH 25/30] Fixes incorrect spelling of Extensions --- PepperDashEssentials/Bridges/DmChassisControllerBridge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index f87f2109..23294997 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -16,7 +16,7 @@ using Newtonsoft.Json; namespace PepperDash.Essentials.Bridges { - public static class DmChassisControllerApiExtentions + public static class DmChassisControllerApiExtensions { public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) { From 7be1c6df449af031633c698d6ad0414e34936970 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 24 Feb 2020 16:09:58 -0700 Subject: [PATCH 26/30] Updates to PD.Core v1.0.34 --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 27a665b6..7db7cb27 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 27a665b68a0725729bb09138bb85f575833df4b2 +Subproject commit 7db7cb27f613b52dd0b056f6973ead05ffe1c14a From 943ae2115bdb308339ca767785ed3a254ed1b651 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 24 Feb 2020 16:12:58 -0700 Subject: [PATCH 27/30] Closes #33 --- .../Bridges/JoinMaps/DmChassisControllerJoinMap.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index d04004b9..7c920cc4 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -139,6 +139,7 @@ namespace PepperDash.Essentials.Bridges OutputEndpointOnline = OutputEndpointOnline + joinOffset; HdcpSupportState = HdcpSupportState + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset; + TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset; } } } From 687300811e1cf295f79bfafc54c7de7130089bb0 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 4 Mar 2020 11:11:11 -0700 Subject: [PATCH 28/30] Updates to PD.Core v1.0.35 --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index acebe6b4..7db7cb27 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit acebe6b43b28cc3a93f899e9714292a0cc1ab2cc +Subproject commit 7db7cb27f613b52dd0b056f6973ead05ffe1c14a From 003a2aa76d36984c2395e5b8ff9e835137f8fe56 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 4 Mar 2020 11:11:36 -0700 Subject: [PATCH 29/30] Updates to PD.Core v1.0.35 --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 7db7cb27..15206840 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 7db7cb27f613b52dd0b056f6973ead05ffe1c14a +Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5 From 4126df47202fe94f10394eb9fc74d6752f4d32af Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 4 Mar 2020 11:22:02 -0700 Subject: [PATCH 30/30] Updates PD.Core to v1.0.35 --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 7db7cb27..15206840 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 7db7cb27f613b52dd0b056f6973ead05ffe1c14a +Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5