mirror of
https://github.com/ThingsGateway/ThingsGateway.git
synced 2026-10-28 11:47:24 +08:00
补充插件实例内容
This commit is contained in:
@@ -451,7 +451,11 @@ public class CollectDeviceCore : DisposableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var oper = _driver.IsConnected();
|
||||
if (oper.IsSuccess)
|
||||
{
|
||||
Device.DeviceStatus = DeviceStatusEnum.OnLine;
|
||||
}
|
||||
}
|
||||
if (StoppingToken.Token.IsCancellationRequested)
|
||||
return ThreadRunReturn.Break;
|
||||
|
||||
@@ -41,6 +41,10 @@ public abstract class DriverBase : DisposableObject
|
||||
TouchSocketConfig.ConfigureContainer(a => a.RegisterSingleton<ILog>(logMessage));
|
||||
}
|
||||
/// <summary>
|
||||
/// 当前插件描述
|
||||
/// </summary>
|
||||
public DriverPlugin DriverPlugin { get; set; }
|
||||
/// <summary>
|
||||
/// 日志
|
||||
/// </summary>
|
||||
protected ILogger _logger;
|
||||
|
||||
@@ -77,6 +77,7 @@ public class PluginSingletonService : ISingleton
|
||||
{
|
||||
object driver = Activator.CreateInstance(DriverPluginDict[plugin.Id], _scopeFactory);
|
||||
DeviceOnDriverPluginDict[plugin.Id].AddRangeIfNotContains(devId);
|
||||
((DriverBase)driver).DriverPlugin = plugin;
|
||||
return driver;
|
||||
}
|
||||
Assembly assembly = null;
|
||||
@@ -114,6 +115,7 @@ public class PluginSingletonService : ISingleton
|
||||
_logger?.LogInformation($"加载插件 {driverFilePath}-{plugin.AssembleName} 成功");
|
||||
DriverPluginDict.TryAdd(plugin.Id, driverBase);
|
||||
DeviceOnDriverPluginDict.TryAdd(plugin.Id, new() { devId });
|
||||
((DriverBase)driver).DriverPlugin = plugin;
|
||||
return driver;
|
||||
}
|
||||
else
|
||||
@@ -129,6 +131,7 @@ public class PluginSingletonService : ISingleton
|
||||
_logger?.LogInformation($"加载插件 {driverFilePath}-{plugin.AssembleName} 成功");
|
||||
DriverPluginDict.TryAdd(plugin.Id, upLoadBase);
|
||||
DeviceOnDriverPluginDict.TryAdd(plugin.Id, new() { devId });
|
||||
((DriverBase)driver).DriverPlugin = plugin;
|
||||
return driver;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user