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)
|
if (Device.AutoStart)
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"线程已启动:{Device.DeviceName}");
|
_logger.LogInformation($"线程已启动:{Device.DeviceName}");
|
||||||
Thread.Sleep(8000);
|
|
||||||
|
|
||||||
if (Device.DeviceVariables != null)
|
if (Device.DeviceVariables != null)
|
||||||
{
|
{
|
||||||
@ -53,6 +52,7 @@ namespace Plugin
|
|||||||
|
|
||||||
_task = Task.Factory.StartNew(() =>
|
_task = Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
|
Thread.Sleep(8000);
|
||||||
//上传客户端属性
|
//上传客户端属性
|
||||||
myMqttClient.UploadAttributeAsync(device.DeviceName,
|
myMqttClient.UploadAttributeAsync(device.DeviceName,
|
||||||
device.DeviceConfigs.Where(x => x.DataSide == DataSide.ClientSide)
|
device.DeviceConfigs.Where(x => x.DataSide == DataSide.ClientSide)
|
||||||
@ -151,10 +151,12 @@ namespace Plugin
|
|||||||
|
|
||||||
payLoad.TS = (long)(DateTime.UtcNow - _tsStartDt).TotalMilliseconds;
|
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.Good;
|
||||||
payLoad.DeviceStatus = DeviceStatusTypeEnum.Bad;
|
sendModel[Device.DeviceName] = new List<PayLoad> { payLoad };
|
||||||
|
myMqttClient.PublishTelemetryAsync(Device, sendModel).Wait();
|
||||||
}
|
}
|
||||||
else if (DeviceValues.Any(x =>
|
else if (DeviceValues.Any(x =>
|
||||||
x.Value.StatusType == VaribaleStatusTypeEnum.Bad))
|
x.Value.StatusType == VaribaleStatusTypeEnum.Bad))
|
||||||
@ -167,12 +169,6 @@ namespace Plugin
|
|||||||
|
|
||||||
_myMqttClient?.DeviceDisconnected(Device);
|
_myMqttClient?.DeviceDisconnected(Device);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
payLoad.DeviceStatus = DeviceStatusTypeEnum.Good;
|
|
||||||
sendModel[Device.DeviceName] = new List<PayLoad> { payLoad };
|
|
||||||
myMqttClient.PublishTelemetryAsync(Device, sendModel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
|
||||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user