From 20beeb076a1dbc74cb40d56f17e53e900759818b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 31 May 2022 17:19:56 -0500 Subject: [PATCH 1/5] add new interfaces for implementing PDUs added basic join map --- .../Bridges/JoinMaps/BasePduJoinMap.cs | 59 +++++++++++++++++++ .../Devices/PduInterfaces.cs | 39 ++++++++++++ .../PepperDash_Essentials_Core.csproj | 2 + 3 files changed, 100 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs new file mode 100644 index 00000000..32ae92ac --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs @@ -0,0 +1,59 @@ +using System; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class BasePduJoinMap : JoinMapBaseAdvanced + { + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata { Description = "PDU Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("Online")] + public JoinDataComplete Online = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata { Description = "PDU Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutletCount")] + public JoinDataComplete OutletCount = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata { Description = "Number of COntrolled Outlets", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("OutletName")] + public JoinDataComplete OutletName = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata { Description = "Outlet Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutletEnabled")] + public JoinDataComplete OutletEnabled = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata { Description = "Outlet Enabled", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutletPowerReboot")] + public JoinDataComplete OutletPowerReboot = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata { Description = "Outlet Power Reboot", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutletPowerOn")] + public JoinDataComplete OutletPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata { Description = "Outlet Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutletPowerOff")] + public JoinDataComplete OutletPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata { Description = "Outlet Power Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + + + /// + /// Constructor to use when instantiating this Join Map without inheriting from it + /// + /// Join this join map will start at + public BasePduJoinMap(uint joinStart) + :base(joinStart, typeof(BasePduJoinMap)) + { + } + + /// + /// Constructor to use when extending this Join map + /// + /// Join this join map will start at + /// Type of the child join map + public BasePduJoinMap(uint joinStart, Type type) : base(joinStart, type) + { + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs new file mode 100644 index 00000000..2ca802a2 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using PepperDash.Core; +using PepperDash.Essentials.Core; + +namespace PepperDash_Essentials_Core.Devices +{ + /// + /// Interface for any device that is able to control it'spower and has a configurable reboot time + /// + public interface IHasPowerReboot : IKeyName, IHasPowerControlWithFeedback + { + /// + /// Delay between power off and power on for reboot + /// + int PowerRebootTimeMs { get;} + + /// + /// Reboot outlet + /// + void PowerReboot(); + } + + /// + /// Interface for any device that contains a collection of IHasPowerReboot Devices + /// + public interface IHasControlledPowerOutlets : IKeyName + { + /// + /// Collection of IPduOutlets + /// + Dictionary PduOutlets { get; } + + /// + /// Count of PduOutlets + /// + int PduOutletsCount { get; } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 7123a150..2847b663 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -123,6 +123,7 @@ + @@ -203,6 +204,7 @@ + From 05f3a7eb2cbdcbf09f6222d247f8d5108c4ee37d Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 31 May 2022 17:46:13 -0500 Subject: [PATCH 2/5] UpdateJoinmap Names --- .../Bridges/JoinMaps/BasePduJoinMap.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs index 32ae92ac..2ac56ff1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs @@ -2,7 +2,7 @@ namespace PepperDash.Essentials.Core.Bridges { - public class BasePduJoinMap : JoinMapBaseAdvanced + public class PduJoinMapBase : JoinMapBaseAdvanced { [JoinName("Name")] public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 }, @@ -24,9 +24,9 @@ namespace PepperDash.Essentials.Core.Bridges public JoinDataComplete OutletEnabled = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 }, new JoinMetadata { Description = "Outlet Enabled", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); - [JoinName("OutletPowerReboot")] - public JoinDataComplete OutletPowerReboot = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 }, - new JoinMetadata { Description = "Outlet Power Reboot", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("OutletPowerCycle")] + public JoinDataComplete OutletPowerCycle = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata { Description = "Outlet Power Cycle", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); [JoinName("OutletPowerOn")] public JoinDataComplete OutletPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 }, @@ -42,8 +42,8 @@ namespace PepperDash.Essentials.Core.Bridges /// Constructor to use when instantiating this Join Map without inheriting from it /// /// Join this join map will start at - public BasePduJoinMap(uint joinStart) - :base(joinStart, typeof(BasePduJoinMap)) + public PduJoinMapBase(uint joinStart) + :base(joinStart, typeof(PduJoinMapBase)) { } @@ -52,7 +52,8 @@ namespace PepperDash.Essentials.Core.Bridges /// /// Join this join map will start at /// Type of the child join map - public BasePduJoinMap(uint joinStart, Type type) : base(joinStart, type) + public PduJoinMapBase(uint joinStart, Type type) + : base(joinStart, type) { } } From 86dfc395ec2dcffac5dd18a8cf3f1cdd74868283 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 31 May 2022 17:48:18 -0500 Subject: [PATCH 3/5] Rename IHasPowerReboot to IHasPowerCycle Update naming scheme to Cycle from Reboot --- .../PepperDashEssentialsBase/Devices/PduInterfaces.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs index 2ca802a2..4cdda3c6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs @@ -7,17 +7,17 @@ namespace PepperDash_Essentials_Core.Devices /// /// Interface for any device that is able to control it'spower and has a configurable reboot time /// - public interface IHasPowerReboot : IKeyName, IHasPowerControlWithFeedback + public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback { /// /// Delay between power off and power on for reboot /// - int PowerRebootTimeMs { get;} + int PowerCycleTimeMs { get;} /// /// Reboot outlet /// - void PowerReboot(); + void PowerCycle(); } /// @@ -28,7 +28,7 @@ namespace PepperDash_Essentials_Core.Devices /// /// Collection of IPduOutlets /// - Dictionary PduOutlets { get; } + Dictionary PduOutlets { get; } /// /// Count of PduOutlets From 1cc37b752173750bd42821eca0a43d61b0ec16e5 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 2 Jun 2022 11:17:54 -0500 Subject: [PATCH 4/5] feature:Converted PduOutlets Dictionary to ReadOnlyDictionary feature:Removed redundant OutletCount property --- .../JoinMaps/{BasePduJoinMap.cs => PduJoinMapBase.cs} | 0 .../PepperDashEssentialsBase/Devices/PduInterfaces.cs | 8 ++------ .../PepperDash_Essentials_Core.csproj | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/{BasePduJoinMap.cs => PduJoinMapBase.cs} (100%) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/PduJoinMapBase.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/BasePduJoinMap.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/PduJoinMapBase.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs index 4cdda3c6..0f3b3fbf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/PduInterfaces.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core; @@ -28,12 +29,7 @@ namespace PepperDash_Essentials_Core.Devices /// /// Collection of IPduOutlets /// - Dictionary PduOutlets { get; } - - /// - /// Count of PduOutlets - /// - int PduOutletsCount { get; } + ReadOnlyDictionary PduOutlets { get; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 2847b663..c0903526 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -123,7 +123,7 @@ - + From 59b18d713bdb6cf3e47d36067d2658402d425641 Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 8 Jun 2022 15:12:32 -0500 Subject: [PATCH 5/5] fix: corrects issue #951, c2nio incorrect factory reference --- .../Crestron IO/C2nIo/C2nIoController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nIo/C2nIoController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nIo/C2nIoController.cs index 0b70288f..f1f1891d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nIo/C2nIoController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nIo/C2nIoController.cs @@ -66,7 +66,7 @@ namespace PepperDash.Essentials.Core.CrestronIO #endregion } - public class C2NIoControllerFactory : EssentialsDeviceFactory + public class C2NIoControllerFactory : EssentialsDeviceFactory { public C2NIoControllerFactory() {