|
|
@ -290,8 +290,8 @@ namespace SocketExample
|
|
|
|
string tempWritestate = "";
|
|
|
|
string tempWritestate = "";
|
|
|
|
for (int n = 0;n < (Convert.ToInt32(dataLength,16)/5);n++)
|
|
|
|
for (int n = 0;n < (Convert.ToInt32(dataLength,16)/5);n++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tempReadstate += $"A{n+1}:{Convert.ToInt32(readStateString.Substring(12+10*n,4),16).ToString()} ";
|
|
|
|
tempReadstate += $"A{n+1} : {(Convert.ToInt32(readStateString.Substring(12+10*n,4),16)/100).ToString()} ";
|
|
|
|
tempWritestate += $"A{n + 1}:{Convert.ToInt32(readStateString.Substring(16 + 10 * n, 4), 16).ToString()} ";
|
|
|
|
tempWritestate += $"A{n + 1} : {(Convert.ToInt32(readStateString.Substring(16 + 10 * n, 4), 16) / 100).ToString()} ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ReadPowerState = tempReadstate;
|
|
|
|
ReadPowerState = tempReadstate;
|
|
|
|
WritePowerState = tempWritestate;
|
|
|
|
WritePowerState = tempWritestate;
|
|
|
@ -440,7 +440,7 @@ namespace SocketExample
|
|
|
|
//连接事件
|
|
|
|
//连接事件
|
|
|
|
client.Connected += onConnected;
|
|
|
|
client.Connected += onConnected;
|
|
|
|
//断连事件
|
|
|
|
//断连事件
|
|
|
|
client.Closed = (client, e) => { Infotext += "已断开!\n"; StateColour = "Red"; LinkState = "未连接"; streamWriter.Close(); return EasyTask.CompletedTask; };
|
|
|
|
client.Closed = (client, e) => { Infotext += "已断开!\n"; StateColour = "Red"; LinkState = "未连接"; return EasyTask.CompletedTask; };
|
|
|
|
//接收事件
|
|
|
|
//接收事件
|
|
|
|
client.Received += onRecieved;
|
|
|
|
client.Received += onRecieved;
|
|
|
|
|
|
|
|
|
|
|
|