using System.Collections.Generic;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Devices.Common
{
///
/// Represents a IRSetTopBoxBaseFactory
///
public class IRSetTopBoxBaseFactory : EssentialsDeviceFactory
{
///
/// Initializes a new instance of the class
///
public IRSetTopBoxBaseFactory()
{
TypeNames = new List() { "settopbox" };
}
///
/// BuildDevice method
///
///
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new SetTopBox Device");
var irCont = IRPortHelper.GetIrOutputPortController(dc);
var config = dc.Properties.ToObject();
var stb = new IRSetTopBoxBase(dc.Key, dc.Name, irCont, config);
var listName = dc.Properties.Value("presetsList");
if (listName != null)
stb.LoadPresets(listName);
return stb;
}
}
}