|
|
|
@ -41,21 +41,26 @@ namespace Rs.MotionPlat.SysConfig
|
|
|
|
|
sp.Read(readBuffer, 0, len);
|
|
|
|
|
reciveData.AddRange(readBuffer.Take(len));
|
|
|
|
|
string buf = Encoding.ASCII.GetString(readBuffer, 0, len);
|
|
|
|
|
LogHelper.Debug(" >>> " + buf);
|
|
|
|
|
if (buf == "+OK")
|
|
|
|
|
{
|
|
|
|
|
reciveMsg = Encoding.ASCII.GetString(reciveData.ToArray());
|
|
|
|
|
reciveData.Clear();
|
|
|
|
|
|
|
|
|
|
Invoke(new Action(() => {
|
|
|
|
|
txtRunResult.AppendText(reciveMsg + Environment.NewLine);
|
|
|
|
|
txtRunResult.AppendText(Encoding.ASCII.GetString(reciveData.ToArray()) + Environment.NewLine);
|
|
|
|
|
}));
|
|
|
|
|
LogHelper.Debug(Encoding.ASCII.GetString(reciveData.ToArray()));
|
|
|
|
|
reciveData.Clear();
|
|
|
|
|
}
|
|
|
|
|
else if (buf.IndexOf("#") > 0)
|
|
|
|
|
{
|
|
|
|
|
reciveMsg = Encoding.ASCII.GetString(reciveData.ToArray());
|
|
|
|
|
reciveData.Clear();
|
|
|
|
|
|
|
|
|
|
Invoke(new Action(() => {
|
|
|
|
|
txtRunResult.AppendText(reciveMsg+Environment.NewLine);
|
|
|
|
|
txtRunResult.AppendText(Encoding.ASCII.GetString(reciveData.ToArray()) + Environment.NewLine);
|
|
|
|
|
}));
|
|
|
|
|
LogHelper.Debug(Encoding.ASCII.GetString(reciveData.ToArray()));
|
|
|
|
|
reciveData.Clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -85,6 +90,7 @@ namespace Rs.MotionPlat.SysConfig
|
|
|
|
|
{
|
|
|
|
|
string msg = "$RD=9999#";
|
|
|
|
|
sp.Write(msg);
|
|
|
|
|
LogHelper.Debug(" <<< " + msg);
|
|
|
|
|
reciveMsg = "";
|
|
|
|
|
Dictionary<string, string> kv = new Dictionary<string, string>();
|
|
|
|
|
while (true)
|
|
|
|
@ -168,7 +174,7 @@ namespace Rs.MotionPlat.SysConfig
|
|
|
|
|
string msg = "$SA=1#";
|
|
|
|
|
byte[] datas = Encoding.ASCII.GetBytes(msg);
|
|
|
|
|
sp.Write(datas, 0, datas.Length);
|
|
|
|
|
|
|
|
|
|
LogHelper.Debug(" <<< " + msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -197,6 +203,7 @@ namespace Rs.MotionPlat.SysConfig
|
|
|
|
|
{
|
|
|
|
|
byte[] datas = Encoding.ASCII.GetBytes(msg);
|
|
|
|
|
sp.Write(datas, 0, datas.Length);
|
|
|
|
|
LogHelper.Debug(" <<< " + msg);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|