refactor: 将Framework库和RT、UI放在同一个解决方案中。

This commit is contained in:
SL
2026-06-01 17:48:28 +08:00
parent 1948f4290d
commit b73d39a6b1
4331 changed files with 506148 additions and 49363 deletions
@@ -0,0 +1,93 @@
using Aitex.Core.RT.Log;
using MECF.Framework.Common.Communications;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway
{
public class SunwayRobotMessage : AsciiMessage
{
public string Data { get; set; }
public string ErrorText { get; set; }
}
public class SunwayRobotTCPConnection : TCPPortConnectionBase
{
private bool _isAckMode = false;//should read from config file
public SunwayRobotTCPConnection(string address, string endof)
: base(address, endof, true)
{
}
public override bool SendMessage(string message)
{
return base.SendMessage(message);
}
protected override void ActiveHandlerProceedMessage(MessageBase msg)
{
lock (_lockerActiveHandler)
{
if (_activeHandler != null)
{
if (msg.IsFormatError || !((SunwayRobotHandler)_activeHandler).HasResponse || (_activeHandler.HandleMessage(msg, out bool transactionComplete) && transactionComplete))
{
_activeHandler = null;
}
}
}
}
protected override MessageBase ParseResponse(string rawText)
{
SunwayRobotMessage msg = new SunwayRobotMessage();
msg.RawMessage = rawText;
if (rawText.Length <= 0)
{
LOG.Error($"empty response,");
msg.IsFormatError = true;
return msg;
}
rawText = rawText.Replace("\r", "").Replace("\n", "");
if (rawText.Contains("_ERR"))
{
msg.IsError = true;
var rewTextArray = rawText.Split(' ');
msg.Data = rewTextArray[1];
msg.IsComplete = true;
}
else if (rawText.Contains("_BG_RDY"))
{
if (!_isAckMode)
{
LOG.Error($"response format check failed, BG_RDY is not valid in Mode 1");
msg.IsFormatError = true;
return msg;
}
msg.Data = rawText;
msg.IsResponse = true;
msg.IsAck = true;
msg.IsComplete = true;
}
else if (rawText.Contains("_RDY"))
{
msg.Data = rawText;
msg.IsResponse = true;
msg.IsAck = true;
msg.IsComplete = true;
}
else
{
msg.Data = rawText;
msg.IsResponse = true;
msg.IsAck = true;
msg.IsComplete = true;
}
return msg;
}
}
}