mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 12:06:58 +00:00
Attempt at modifying device factory mechanism
This commit is contained in:
parent
ca27e01f94
commit
a403a8b81f
7 changed files with 120 additions and 12 deletions
|
|
@ -13,12 +13,14 @@ using PepperDash.Essentials.Core.Config;
|
|||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serves as a generic wrapper class for all styles of IBasicCommuncation ports
|
||||
/// </summary>
|
||||
public class
|
||||
GenericComm : ReconfigurableDevice
|
||||
public class GenericComm : ReconfigurableDevice
|
||||
{
|
||||
|
||||
EssentialsControlPropertiesConfig PropertiesConfig;
|
||||
|
||||
public IBasicCommunication CommPort { get; private set; }
|
||||
|
|
@ -29,6 +31,14 @@ namespace PepperDash.Essentials.Core
|
|||
PropertiesConfig = CommFactory.GetControlPropertiesConfig(config);
|
||||
|
||||
CommPort = CommFactory.CreateCommForDevice(config);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static IKeyed BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
|
||||
return new GenericComm(dc);
|
||||
}
|
||||
|
||||
public void SetPortConfig(string portConfig)
|
||||
|
|
@ -51,6 +61,22 @@ namespace PepperDash.Essentials.Core
|
|||
|
||||
ConfigWriter.UpdateDeviceConfig(config);
|
||||
}
|
||||
|
||||
|
||||
public class Factory : EssentialsDevice.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue