Updates device factory methodology for Essentials Core and Essential DM libraries

This commit is contained in:
Neil Dorin
2020-04-15 18:07:22 -06:00
parent f75d884986
commit c5232ca6b8
12 changed files with 242 additions and 124 deletions

View File

@@ -1,13 +1,16 @@
using Crestron.SimplSharpPro;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
public class C2nRthsController:CrestronGenericBridgeableBaseDevice
public class C2nRthsController : CrestronGenericBridgeableBaseDevice
{
private readonly C2nRths _device;
@@ -65,4 +68,22 @@ namespace PepperDash.Essentials.Core.CrestronIO
trilist.StringInput[joinMap.Name].StringValue = Name;
}
}
public class C2nRthsControllerFactory : EssentialsDeviceFactory<GenericComm>
{
public C2nRthsControllerFactory()
{
TypeNames = new List<string>() { "c2nrths" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem));
}
}
}