Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Serilog;
|
||||
|
||||
namespace adas_core.module.LightBeacons.Devices;
|
||||
|
||||
public abstract class LightBeaconAbstract(string host, string password)
|
||||
{
|
||||
public string Host = host;
|
||||
public string Password = password;
|
||||
|
||||
|
||||
public abstract void CodeBlue(object entry);
|
||||
|
||||
public abstract void CodeRed(object entry);
|
||||
|
||||
public abstract void CodeYellow(object entry);
|
||||
|
||||
public abstract void PowerOffLed(object entry);
|
||||
|
||||
public static LightBeaconAbstract? GetBeaconDevice(string driver, string host, string password)
|
||||
{
|
||||
var modelType = Type.GetType($"adas_core.Drivers.LightBeacon.{driver}");
|
||||
if (modelType == null)
|
||||
{
|
||||
Log.Debug($"LightBeacon modelType not found: driver {driver}, host {host}, password {password}");
|
||||
return null;
|
||||
}
|
||||
|
||||
var ctor = modelType.GetConstructor([typeof(string), typeof(string)]);
|
||||
if (ctor == null)
|
||||
return null;
|
||||
|
||||
return (LightBeaconAbstract)ctor.Invoke([host, password]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user