提交代码
This commit is contained in:
@ -66,21 +66,42 @@ namespace WCS.BLL
|
||||
|
||||
tcpClient = new TcpClient();
|
||||
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(RemoteIPHost)
|
||||
//.SetBindIPHost(BindIPHost)
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//配置断线重连
|
||||
a.UseReconnection(-1, true, 1000);
|
||||
a.Add<HeartbeatAndReceivePlugin>();
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
//添加控制台日志注入
|
||||
a.AddConsoleLogger();
|
||||
}));
|
||||
if (string.IsNullOrEmpty(BindIPHost))
|
||||
{
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(new IPHost(RemoteIPHost))
|
||||
//.SetBindIPHost(BindIPHost)
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//配置断线重连
|
||||
a.UseReconnection(-1, true, 1000);
|
||||
a.Add<HeartbeatAndReceivePlugin>();
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
//添加控制台日志注入
|
||||
a.AddConsoleLogger();
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(new IPHost(RemoteIPHost))
|
||||
.SetBindIPHost(new IPHost(BindIPHost))
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//配置断线重连
|
||||
a.UseReconnection(-1, true, 1000);
|
||||
a.Add<HeartbeatAndReceivePlugin>();
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
//添加控制台日志注入
|
||||
a.AddConsoleLogger();
|
||||
}));
|
||||
}
|
||||
|
||||
//添加接收事件 匹配已发送的指令
|
||||
tcpClient.Received += (client, e) =>
|
||||
@ -96,7 +117,7 @@ namespace WCS.BLL
|
||||
//灯控制统一返回的是 FF-00-00-0A-00-02-D7-B5
|
||||
if (len == 8)
|
||||
{
|
||||
if (data[4] == 0x00 && data[0] == 0xFF && data[1] == 0x00 && (data[4] == 0x01 && data[4] == 0x02))
|
||||
if (data[4] == 0x00 && data[0] == 0xFF && data[1] == 0x00 && (data[5] == 0x01 || data[5] == 0x02))
|
||||
{
|
||||
//查询当前板子是否有待验证的指令
|
||||
var message = new MessageDto();
|
||||
@ -233,8 +254,8 @@ namespace WCS.BLL
|
||||
{
|
||||
Logs.Write($"【发送】{BitConverter.ToString(message)}", LogsType.Instructions);
|
||||
});
|
||||
//发送自带8ms间隔
|
||||
Thread.Sleep(8);
|
||||
//发送自带15ms间隔
|
||||
Thread.Sleep(15);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Reference in New Issue
Block a user