From 996b96df8283eb1fefce27f9a17aedd221464fae Mon Sep 17 00:00:00 2001 From: iioter <535915157@qq.com> Date: Mon, 29 Aug 2022 15:00:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=94=B9=E4=B8=BA=E7=9F=AD?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/Plugin/DeviceThread.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Plugins/Plugin/DeviceThread.cs b/Plugins/Plugin/DeviceThread.cs index 7aee794..b5f8fc1 100644 --- a/Plugins/Plugin/DeviceThread.cs +++ b/Plugins/Plugin/DeviceThread.cs @@ -151,6 +151,15 @@ namespace Plugin payLoad.Values = null; payLoad.DeviceStatus = DeviceStatusTypeEnum.Bad; } + else if (DeviceValues.Any(x => x.Value.StatusType == VaribaleStatusTypeEnum.Bad)) + { + if (driver.IsConnected) + { + driver.Close(); + driver.Dispose(); + } + _myMqttClient?.DeviceDisconnected(Device); + } else { payLoad.DeviceStatus = DeviceStatusTypeEnum.Good;