mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-11 02:35:00 +00:00
v1.0.34.* Updated Device Factory to consume portal generated config format
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user