From ba9cc9f00cc708bd22b54f14f8d9070f39c40a95 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Mon, 6 Nov 2023 15:46:07 -0500 Subject: [PATCH] feat(wip): still working on re-arranging base classes --- .../{Factory => }/DeviceFactory.cs | 15 --------------- .../Somfy => Shades}/RelayControlledShade.cs | 12 ++++-------- .../Shades/ShadeController.cs | 17 +++++++---------- .../EssentialsShadeDriver.cs | 1 - 4 files changed, 11 insertions(+), 34 deletions(-) rename src/PepperDash.Essentials.Devices.Common/{Factory => }/DeviceFactory.cs (69%) rename src/PepperDash.Essentials.Devices.Common/{Environment/Somfy => Shades}/RelayControlledShade.cs (92%) rename src/{PepperDash.Essentials.Core => PepperDash.Essentials.Devices.Common}/Shades/ShadeController.cs (82%) diff --git a/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs similarity index 69% rename from src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs rename to src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs index c5ab29b1..b5ee9a89 100644 --- a/src/PepperDash.Essentials.Devices.Common/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Devices.Common/DeviceFactory.cs @@ -2,24 +2,9 @@ using System; using System.Linq; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; using Crestron.SimplSharp.Reflection; - -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.CrestronIO; - -using PepperDash.Essentials.Devices.Common; -using PepperDash.Essentials.Devices.Common.DSP; -using PepperDash.Essentials.Devices.Common.VideoCodec; -using PepperDash.Essentials.Devices.Common.Environment; namespace PepperDash.Essentials.Devices.Common { diff --git a/src/PepperDash.Essentials.Devices.Common/Environment/Somfy/RelayControlledShade.cs b/src/PepperDash.Essentials.Devices.Common/Shades/RelayControlledShade.cs similarity index 92% rename from src/PepperDash.Essentials.Devices.Common/Environment/Somfy/RelayControlledShade.cs rename to src/PepperDash.Essentials.Devices.Common/Shades/RelayControlledShade.cs index 852d554f..a8fc5fd4 100644 --- a/src/PepperDash.Essentials.Devices.Common/Environment/Somfy/RelayControlledShade.cs +++ b/src/PepperDash.Essentials.Devices.Common/Shades/RelayControlledShade.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; using Crestron.SimplSharp; - using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.CrestronIO; using PepperDash.Essentials.Core.Shades; -namespace PepperDash.Essentials.Devices.Common.Environment.Somfy +namespace PepperDash.Essentials.Devices.Common.Shades { /// /// Controls a single shade using three relays @@ -122,9 +118,9 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); - var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); - return new Environment.Somfy.RelayControlledShade(dc.Key, dc.Name, props); + return new RelayControlledShade(dc.Key, dc.Name, props); } } diff --git a/src/PepperDash.Essentials.Core/Shades/ShadeController.cs b/src/PepperDash.Essentials.Devices.Common/Shades/ShadeController.cs similarity index 82% rename from src/PepperDash.Essentials.Core/Shades/ShadeController.cs rename to src/PepperDash.Essentials.Devices.Common/Shades/ShadeController.cs index 6dff9803..a229cb6d 100644 --- a/src/PepperDash.Essentials.Core/Shades/ShadeController.cs +++ b/src/PepperDash.Essentials.Devices.Common/Shades/ShadeController.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - +using System.Collections.Generic; using PepperDash.Core; +using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Shades; -namespace PepperDash.Essentials.Core.Shades +namespace PepperDash.Essentials.Devices.Common.Shades { /// /// Class that contains the shades to be controlled in a room @@ -40,7 +37,7 @@ namespace PepperDash.Essentials.Core.Shades return base.CustomActivate(); } - void AddShade(ShadeBase shade) + void AddShade(IShadesOpenCloseStop shade) { Shades.Add(shade); } @@ -67,9 +64,9 @@ namespace PepperDash.Essentials.Core.Shades public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new ShadeController Device"); - var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); + var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); - return new Core.Shades.ShadeController(dc.Key, dc.Name, props); + return new ShadeController(dc.Key, dc.Name, props); } } diff --git a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs index 63b38f9d..1d8ad7c2 100644 --- a/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs +++ b/src/PepperDash.Essentials/UIDrivers/Environment Drivers/EssentialsShadeDriver.cs @@ -8,7 +8,6 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Shades; -using PepperDash.Essentials.Devices.Common.Environment.Somfy; namespace PepperDash.Essentials {