mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Added code to Device Factory to build Cresnet Occupancy Sensors from config.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
@@ -13,6 +14,7 @@ using PepperDash.Essentials.Core.CrestronIO;
|
|||||||
|
|
||||||
using PepperDash.Essentials.Devices.Common.DSP;
|
using PepperDash.Essentials.Devices.Common.DSP;
|
||||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||||
|
using PepperDash.Essentials.Devices.Common.Occupancy;
|
||||||
|
|
||||||
using PepperDash.Essentials.Devices.Common;
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
@@ -248,6 +250,46 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
return new Roku2(key, name, irCont);
|
return new Roku2(key, name, irCont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (typeName == "occsensor")
|
||||||
|
{
|
||||||
|
var props = JsonConvert.DeserializeObject<GlsOccupancySensorConfigurationProperties>(properties.ToString());
|
||||||
|
uint id = 0x00;
|
||||||
|
GlsOccupancySensorBase occSensor = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
id = Convert.ToUInt32(props.CresnetId, 8);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Unable to convert Crestnet 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (occSensor != null)
|
||||||
|
return new EssentialsGlsOccupancySensorBaseController(key, name, occSensor, props);
|
||||||
|
else
|
||||||
|
Debug.Console(0, "Unable to create Occupancy Sensor Device. Key: '{0}'", key);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro.GeneralIO;
|
using Crestron.SimplSharpPro.GeneralIO;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
namespace PepperDash.Essentials.Devices.Common.Occupancy
|
||||||
@@ -24,6 +25,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
|
|||||||
|
|
||||||
public class GlsOccupancySensorConfigurationProperties
|
public class GlsOccupancySensorConfigurationProperties
|
||||||
{
|
{
|
||||||
|
public string CresnetId { get; set; }
|
||||||
|
public string Model { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,6 +151,8 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -239,6 +241,7 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
public class EssentialsRoomOccSensorConfig
|
public class EssentialsRoomOccSensorConfig
|
||||||
{
|
{
|
||||||
public string DeviceKey { get; set; }
|
public string DeviceKey { get; set; }
|
||||||
|
public string TimoutMinutes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EssentialsRoomTechConfig
|
public class EssentialsRoomTechConfig
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user