diff --git a/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs b/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs index d311e537..7b3ecd03 100644 --- a/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs +++ b/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs @@ -144,7 +144,25 @@ namespace PepperDash.Essentials.Core [JsonConverter(typeof(ComSpecJsonConverter))] public ComPort.ComPortSpec ComParams { get; set; } - public string CresnetId { get; set; } + public string CresnetId { get; set; } + + /// + /// Attempts to provide uint conversion of string CresnetId + /// + public uint CresnetIdInt + { + get + { + try + { + return Convert.ToUInt32(CresnetId, 16); + } + catch (Exception) + { + throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId)); + } + } + } //public string IpId { get; set; } diff --git a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 74bb76c2..98a8d702 100644 --- a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -295,43 +295,32 @@ namespace PepperDash.Essentials.Devices.Common return new Roku2(key, name, irCont); } - else if (typeName == "occsensor") + else if (typeName == "glsoirccn") { - var props = JsonConvert.DeserializeObject(properties.ToString()); + var comm = CommFactory.GetControlPropertiesConfig(dc); uint id = 0x00; GlsOccupancySensorBase occSensor = null; - try - { - id = Convert.ToUInt32(props.CresnetId, 16); - } - catch (Exception e) - { - Debug.Console(0, "ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", props.CresnetId, e); - } - - switch (props.Model.ToLower()) - { - case "glsodtccn": - { - occSensor = new GlsOdtCCn(id, Global.ControlSystem); - break; - } - case "glsoirccn": - { - occSensor = new GlsOirCCn(id, Global.ControlSystem); - break; - } - default: - { - Debug.Console(0, "Unrecognized Model: '{0}'. Unable to create occupancy sensor device.", props.Model); - break; - } - } + occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); if (occSensor != null) - return new EssentialsGlsOccupancySensorBaseController(key, name, occSensor, props); + return new EssentialsGlsOccupancySensorBaseController(key, name, occSensor); + else + Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); + } + + else if (typeName == "glsodtccn") + { + var comm = CommFactory.GetControlPropertiesConfig(dc); + + uint id = 0x00; + GlsOccupancySensorBase occSensor = null; + + occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem); + + if (occSensor != null) + return new EssentialsGlsOccupancySensorBaseController(key, name, occSensor); else Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); } diff --git a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs index 05425970..00b46b9e 100644 --- a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs +++ b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs @@ -29,7 +29,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy } } - public EssentialsGlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor, GlsOccupancySensorConfigurationProperties props) + public EssentialsGlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor) : base(key, name, sensor) { OccSensor = sensor; @@ -62,13 +62,4 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy } } } - - /// - /// - /// - public class GlsOccupancySensorConfigurationProperties - { - public string CresnetId { get; set; } - public string Model { get; set; } - } } \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs index dc549ece..57c10aba 100644 --- a/Essentials/PepperDashEssentials/ControlSystem.cs +++ b/Essentials/PepperDashEssentials/ControlSystem.cs @@ -32,7 +32,7 @@ namespace PepperDash.Essentials public override void InitializeSystem() { //CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file", - //ConsoleAccessLevelEnum.AccessOperator); + // ConsoleAccessLevelEnum.AccessOperator); //CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Unloads configuration file", // ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj index 397eb1b2..5e6a90dc 100644 --- a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj +++ b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj @@ -75,9 +75,9 @@ False ..\..\..\pepperdash-portal-sync\SspPortalSync\SspPortalSync\bin\PepperDashCorePortalSync.dll - + False - ..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll + ..\..\Release Package\PepperDash_Core.dll False diff --git a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs index bb3fc49d..be8d7f37 100644 --- a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] -[assembly: AssemblyVersion("1.0.33.*")] +[assembly: AssemblyVersion("1.0.34.*")]