From c55fb594420bfd8f1685f1b6df90a76e89b04b65 Mon Sep 17 00:00:00 2001 From: iioter <535915157@qq.com> Date: Sun, 24 Jul 2022 22:31:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AC=E4=BB=B6=E4=BB=8B=E7=BB=8D=E3=80=81?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=81=B6=E5=B0=94?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/Plugin/DeviceService.cs | 3 +-- Plugins/Plugin/DeviceThread.cs | 11 ++++++---- README.md | 37 ++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/Plugins/Plugin/DeviceService.cs b/Plugins/Plugin/DeviceService.cs index 35eca7b..c9ea792 100644 --- a/Plugins/Plugin/DeviceService.cs +++ b/Plugins/Plugin/DeviceService.cs @@ -22,7 +22,6 @@ namespace Plugin private IMqttServer _MqttServer; private string connnectSetting = IoTBackgroundService.connnectSetting; private DBTypeEnum DBType = IoTBackgroundService.DBType; - private Interpreter interpreter = new(); public DeviceService(IConfiguration ConfigRoot, DriverService drvierManager, MyMqttClient myMqttClient, UAService uAService, IMqttServer mqttServer, ILogger logger) { _logger = logger; @@ -137,7 +136,7 @@ namespace Plugin p.SetValue(DeviceObj, value); } - var deviceThread = new DeviceThread(Device, DeviceObj, systemManage.GatewayName, _MyMqttClient, interpreter, _MqttServer, _logger); + var deviceThread = new DeviceThread(Device, DeviceObj, systemManage.GatewayName, _MyMqttClient, _MqttServer, _logger); DeviceThreads.Add(deviceThread); } diff --git a/Plugins/Plugin/DeviceThread.cs b/Plugins/Plugin/DeviceThread.cs index 6af2cf1..7c85252 100644 --- a/Plugins/Plugin/DeviceThread.cs +++ b/Plugins/Plugin/DeviceThread.cs @@ -15,21 +15,21 @@ namespace Plugin public readonly Device _device; public readonly IDriver _driver; private readonly MyMqttClient _myMqttClient; + private Interpreter _interpreter ; public Dictionary DeviceValues { get; set; } = new(); internal List Methods { get; set; } private Task task { get; set; } = null; private DateTime TsStartDt = new DateTime(1970, 1, 1); private CancellationTokenSource tokenSource = new CancellationTokenSource(); - private Interpreter Interpreter = null; private object _lock = new object(); private bool lastConnected = false; - public DeviceThread(Device device, IDriver driver, string ProjectId, MyMqttClient myMqttClient, Interpreter interpreter, IMqttServer mqttServer, ILogger logger) + public DeviceThread(Device device, IDriver driver, string ProjectId, MyMqttClient myMqttClient, IMqttServer mqttServer, ILogger logger) { _myMqttClient = myMqttClient; _myMqttClient.OnExcRpc += MyMqttClient_OnExcRpc; _device = device; _driver = driver; - Interpreter = interpreter; + _interpreter = new Interpreter(); _logger = logger; Methods = _driver.GetType().GetMethods().Where(x => x.GetCustomAttribute(typeof(MethodAttribute)) != null).ToList(); if (_device.AutoStart) @@ -91,7 +91,7 @@ namespace Plugin { try { - ret.CookedValue = interpreter.Eval(DealMysqlStr(item.Expressions).Replace("raw", ret.Value?.ToString())); + ret.CookedValue = _interpreter.Eval(DealMysqlStr(item.Expressions).Replace("raw", ret.Value?.ToString())); } catch (Exception) { @@ -268,6 +268,9 @@ namespace Plugin public void Dispose() { _driver.Dispose(); + _interpreter = null; + DeviceValues = null; + Methods = null; _logger.LogInformation($"线程释放,{_device.DeviceName}"); } diff --git a/README.md b/README.md index ef1e231..04b9cbc 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ ## [教程文档:http://iotgateway.net](http://iotgateway.net/) ## [在线体验:http://online.iotgateway.net](http://online.iotgateway.net/) +## [配套硬件产品:http://iotgateway.net/docs/hardware/selection/](http://iotgateway.net/docs/hardware/selection/) + > 基于.NET6的跨平台物联网网关 > @@ -20,7 +22,40 @@ | ------ | ---- | | ![wx](./images/wx.jpg) | ![qq](./images/qq.png) | +## 重磅推出硬件网关 + +受益于.netcore**跨平台**能力,此项目并**不限于**下面推荐的硬件设备,你可以在任何主机上运行,但是会针对特定硬件设备做**优化适配**,如 + +\- **性能监控**:cpu、内存、磁盘等主机指标监控 + +\- **硬件交互**:模拟量采集、继电器控制等 + +### 为何推荐 + +如果你购买了硬件网关: + +- **间接为开源项目做贡献**,收益的一部分会投入到开源项目建设中去,包括但不限于云服务器资源租赁、先上线向下活动等 +- 可以**免费使用**后续"企业版网关项目(筹)" +- 可以**免费使用**网络透传等服务 +- 提供详细的**教程文档**,包括**Linux系统**、**dotnet跨平台等** +- 可用于**学习、评估、和生产环境**使用 + +### 产品列表 + +- 下列型号均有"**蓝牙BLE 5.0**、**Wi-Fi**" +- 搭载**Linux**操作系统```debian.11``` +- 时间关系,目前只整理了 [A080](http://iotgateway.net/docs/hardware/A080/introduction) 型号的资料,其他用法差不多,后续会更新 +- 9月后会推出**24v**版本 + +| 型号 | 触摸屏 | USB | 网口 |通讯口| SD扩展 | 4G | 电源|RTC| +| ------ | ---- |---- |---- |---- |------ | ---- |---- |---- | +| D070 | 无 | 4 | 千兆×1 | 无 |无|无| 5V|无| +| [A080](/docs/hardware/A080/introduction) | 无 | 2 | 千兆×1 | 232×1;485×4;can×1 |有|可选|12V|有| +| B100 | 无 | 2 | 百兆×1;千兆×1 | 232×1;485×1 |有|可选|12V|有| +| C210 | 10寸电容 | 2 | 千兆×1 | 232×4;485×2 |有|可选| 6~36V|有| + ## 运行 + - [直接运行:http://iotgateway.net/docs/iotgateway/run/release-run](http://iotgateway.net/docs/iotgateway/run/release-run) - [Docker运行:http://iotgateway.net/docs/iotgateway/run/docker-run](http://iotgateway.net/docs/iotgateway/run/docker-run) - [源码运行:http://iotgateway.net/docs/iotgateway/run/build-run](http://iotgateway.net/docs/iotgateway/run/build-run) @@ -56,7 +91,7 @@ ![variables](./images/variables.gif) - 3D数字孪生Demo -![3d](./images/3d.gif) + ![3d](./images/3d.gif) - 支持接入web组态项目 ![scada](./images/scada.gif)