1、对串口获取返回值

2、新增获取批量点
3、新增测试用例
4、对对端设备进行调试
This commit is contained in:
zhengxuan.zhang
2022-11-25 17:53:16 +08:00
parent d73ac43da5
commit 4e11acde01
11 changed files with 816 additions and 486 deletions
@@ -106,7 +106,16 @@ namespace WPFSerialAssistant
}
}
private bool SendData(string textToSend)
{
if (string.IsNullOrEmpty(textToSend))
{
Alert("要发送的内容不能为空!");
return false;
}
return SerialPortWrite(textToSend);
}
private void AutoSendData()
{
@@ -514,9 +514,34 @@ namespace WPFSerialAssistant
dataRecvStatusBarItem.Visibility = Visibility.Collapsed;
}));
// TO-DO
// 处理数据,比如解析指令等等
}
// TO-DO
// 处理数据,比如解析指令等等
if (recvBuffer.Count > 0)
{
// 举例:解析指令,获取锁存点
if (recvBuffer[0] == 0x01 && recvBuffer[1] == 0x05)
{
// TO-DO:处理指令
this.Dispatcher.BeginInvoke(new Action(() =>
{
SendData("string textToSend");
}));
}
if (recvBuffer[0] == 0x01 && recvBuffer[1] == 0x09)
{
// TO-DO:处理指令
this.Dispatcher.BeginInvoke(new Action(() =>
{
SendData("ok");
}));
}
}
}
#endregion
}
}