mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
v1.0.34.* Updated Device Factory to consume portal generated config format
This commit is contained in:
parent
17f147b5e0
commit
29c60548cc
6 changed files with 43 additions and 45 deletions
|
|
@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to provide uint conversion of string CresnetId
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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<GlsOccupancySensorConfigurationProperties>(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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class GlsOccupancySensorConfigurationProperties
|
||||
{
|
||||
public string CresnetId { get; set; }
|
||||
public string Model { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -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 =>
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\pepperdash-portal-sync\SspPortalSync\SspPortalSync\bin\PepperDashCorePortalSync.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Core, Version=1.0.1.20241, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||
<HintPath>..\..\Release Package\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Essentials_DM, Version=1.0.0.19343, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
|
|||
|
|
@ -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.*")]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue