mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 12:15:01 +00:00
Finishes converting all existing types to new DeviceFactory mechanism. #106
This commit is contained in:
@@ -9,6 +9,7 @@ using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Bridges;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
@@ -461,4 +462,27 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
trilist.SetBoolSigAction(joinMap.Record, stbTransport.Record);
|
||||
}
|
||||
}
|
||||
|
||||
public class IRSetTopBoxBaseFactory : EssentialsDeviceFactory<IRSetTopBoxBase>
|
||||
{
|
||||
public IRSetTopBoxBaseFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "settopbox" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new SetTopBox Device");
|
||||
var irCont = IRPortHelper.GetIrOutputPortController(dc);
|
||||
var config = dc.Properties.ToObject<SetTopBoxPropertiesConfig>();
|
||||
var stb = new IRSetTopBoxBase(dc.Key, dc.Name, irCont, config);
|
||||
|
||||
var listName = dc.Properties.Value<string>("presetsList");
|
||||
if (listName != null)
|
||||
stb.LoadPresets(listName);
|
||||
return stb;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user