mirror of
https://gitee.com/iioter/iotgateway.git
synced 2024-11-29 18:28:09 +08:00
优化采集
This commit is contained in:
parent
93862348c0
commit
cbdf3a99cb
@ -41,7 +41,6 @@ namespace Plugin
|
||||
if (Device.AutoStart)
|
||||
{
|
||||
_logger.LogInformation($"线程已启动:{Device.DeviceName}");
|
||||
Thread.Sleep(8000);
|
||||
|
||||
if (Device.DeviceVariables != null)
|
||||
{
|
||||
@ -53,6 +52,7 @@ namespace Plugin
|
||||
|
||||
_task = Task.Factory.StartNew(() =>
|
||||
{
|
||||
Thread.Sleep(8000);
|
||||
//上传客户端属性
|
||||
myMqttClient.UploadAttributeAsync(device.DeviceName,
|
||||
device.DeviceConfigs.Where(x => x.DataSide == DataSide.ClientSide)
|
||||
@ -151,10 +151,12 @@ namespace Plugin
|
||||
|
||||
payLoad.TS = (long)(DateTime.UtcNow - _tsStartDt).TotalMilliseconds;
|
||||
|
||||
if (DeviceValues.Any(x => x.Value.Value == null))
|
||||
if (DeviceValues.All(x =>
|
||||
x.Value.StatusType == VaribaleStatusTypeEnum.Good))
|
||||
{
|
||||
payLoad.Values = null;
|
||||
payLoad.DeviceStatus = DeviceStatusTypeEnum.Bad;
|
||||
payLoad.DeviceStatus = DeviceStatusTypeEnum.Good;
|
||||
sendModel[Device.DeviceName] = new List<PayLoad> { payLoad };
|
||||
myMqttClient.PublishTelemetryAsync(Device, sendModel).Wait();
|
||||
}
|
||||
else if (DeviceValues.Any(x =>
|
||||
x.Value.StatusType == VaribaleStatusTypeEnum.Bad))
|
||||
@ -167,12 +169,6 @@ namespace Plugin
|
||||
|
||||
_myMqttClient?.DeviceDisconnected(Device);
|
||||
}
|
||||
else
|
||||
{
|
||||
payLoad.DeviceStatus = DeviceStatusTypeEnum.Good;
|
||||
sendModel[Device.DeviceName] = new List<PayLoad> { payLoad };
|
||||
myMqttClient.PublishTelemetryAsync(Device, sendModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4,8 +4,6 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user