mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Updates to device factory methodology for use in plugins
This commit is contained in:
@@ -13,8 +13,6 @@ using PepperDash.Essentials.Core.Config;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -62,21 +60,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
ConfigWriter.UpdateDeviceConfig(config);
|
ConfigWriter.UpdateDeviceConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Factory : Essentials.Core.Factory
|
|
||||||
{
|
|
||||||
#region IDeviceFactory Members
|
|
||||||
|
|
||||||
List<string> TypeNames = new List<string>() { "genericComm" };
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public override IKeyed BuildDevice(DeviceConfig dc)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
|
||||||
return new GenericComm(dc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GenericCommFactory : Essentials.Core.EssentialsDeviceFactory<GenericComm>
|
||||||
|
{
|
||||||
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||||
|
return new GenericComm(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericCommFactory()
|
||||||
|
{
|
||||||
|
TypeNames = new List<string>() { "genericComm" };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,18 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected EssentialsDevice(string key, string name)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class Factory : IDeviceFactory
|
/// <summary>
|
||||||
|
/// Devices the basic needs for a Device Factory
|
||||||
|
/// </summary>
|
||||||
|
public abstract class EssentialsDeviceFactory<T> : IDeviceFactory where T:EssentialsDevice
|
||||||
{
|
{
|
||||||
#region IDeviceFactory Members
|
#region IDeviceFactory Members
|
||||||
|
|
||||||
@@ -35,13 +44,16 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract EssentialsDevice BuildDevice(DeviceConfig dc);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
public abstract IKeyed BuildDevice(DeviceConfig dc);
|
/// <summary>
|
||||||
|
/// Devices the basic needs for a Device Factory
|
||||||
protected Factory()
|
/// </summary>
|
||||||
{
|
public abstract class EssentialsPluginDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDeviceFactory where T : EssentialsDevice
|
||||||
TypeNames = new List<string>();
|
{
|
||||||
}
|
public string MinimumEssentialsFrameworkVersion { get; protected set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
public CoreDeviceFactory()
|
public CoreDeviceFactory()
|
||||||
{
|
{
|
||||||
var genComm = new GenericComm.Factory() as IDeviceFactory;
|
var genComm = new GenericCommFactory() as IDeviceFactory;
|
||||||
genComm.LoadTypeFactories();
|
genComm.LoadTypeFactories();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user