This commit is contained in:
郭睿 2024-12-09 11:05:15 +08:00
parent de790170f0
commit e0f3197855
3 changed files with 7 additions and 3 deletions

View File

@ -46,7 +46,6 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
_redisDataRepository = redisDataRepository; _redisDataRepository = redisDataRepository;
_dotNettyTcpServer.MessageReceived += OnMessageReceived; // 订阅事件 _dotNettyTcpServer.MessageReceived += OnMessageReceived; // 订阅事件
_deviceBoardStatesRedis = redisRepository; _deviceBoardStatesRedis = redisRepository;
} }
//Dictionary<byte, DeviceInfo> _deviceRunStates = new Dictionary<byte, DeviceInfo>(); //Dictionary<byte, DeviceInfo> _deviceRunStates = new Dictionary<byte, DeviceInfo>();
//private ConcurrentDictionary<byte, int> _communicationStateCounts = new(); //private ConcurrentDictionary<byte, int> _communicationStateCounts = new();
@ -199,7 +198,7 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
} }
boardStates[0].Value = new BitArray(new byte[] { data[0] })[0] ? 0 : 1;//运行状态 boardStates[0].Value = new BitArray(new byte[] { data[0] })[0] ? 0 : 1;//运行状态
boardStates[1].Value = new BitArray(new byte[] { data[0] })[1] ? 0 : 1;//报警状态 boardStates[1].Value = new BitArray(new byte[] { data[0] })[1] ? 0 : 1;//报警状态
boardStates[7].Value = new BitArray(new byte[] { data[1] })[0] ? 0 : 1; // 液晶状态 boardStates[7].Value = new BitArray(new byte[] { data[1] })[7] ? 0 : 1; // 液晶状态
BitArray bit2 = new BitArray(new byte[] { data[2] }); BitArray bit2 = new BitArray(new byte[] { data[2] });
boardStates[2].Value = bit2[0] ? 0 : 1; boardStates[2].Value = bit2[0] ? 0 : 1;
boardStates[3].Value = bit2[1] ? 0 : 1; boardStates[3].Value = bit2[1] ? 0 : 1;

View File

@ -6,6 +6,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -143,6 +144,10 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server
{ {
try try
{ {
if (DateTime.Now.Hour == 0&&DateTime.Now.Minute == 5&& DateTime.Now.Second<30)
{
await SendCustomMessageAsync(ctx, address, 0, 4, 0);//发送版本信息请求
}
UpdateConnectionContext(address, ctx); UpdateConnectionContext(address, ctx);
await UpdateCommunicationStateCountAsync(address, ctx); await UpdateCommunicationStateCountAsync(address, ctx);
} }