refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MECF.Framework.Common.Communications;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner.Handlers
|
||||
{
|
||||
public abstract class HwAlignerGuideHandler : HandlerBase
|
||||
{
|
||||
public HwAlignerGuide Device { get; }
|
||||
|
||||
protected HwAlignerGuideHandler(HwAlignerGuide device, string command)
|
||||
: base(BuildMessage(command))
|
||||
{
|
||||
Device = device;
|
||||
}
|
||||
|
||||
private static byte[] BuildMessage(string command)
|
||||
{
|
||||
var liCmd = Encoding.ASCII.GetBytes(command).ToList<byte>();
|
||||
liCmd.Add(0x0d); //CR
|
||||
liCmd.Add(0x0a); //LF 不可颠倒
|
||||
|
||||
return liCmd.ToArray();
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
var result = msg as HwAlignerGuideMessage;
|
||||
|
||||
ResponseMessage = msg;
|
||||
handled = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using MECF.Framework.Common.Communications;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner.Handlers
|
||||
{
|
||||
public class HwAlignerGuideSetHandler : HwAlignerGuideHandler
|
||||
{
|
||||
public HwAlignerGuideSetHandler(HwAlignerGuide device, string name, string command, int timeout = 30)
|
||||
: base(device, command)
|
||||
{
|
||||
AckTimeout = TimeSpan.FromSeconds(timeout);
|
||||
CompleteTimeout = TimeSpan.FromSeconds(timeout);
|
||||
Name = name;
|
||||
device.SetCurrentOper();
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
handled = false;
|
||||
var result = msg as HwAlignerGuideMessage;
|
||||
if (result is { IsResponse: false })
|
||||
{
|
||||
handled = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
handled = Device.ParseData(Name, result.Data, out var returnIfo);
|
||||
return returnIfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using MECF.Framework.Common.Communications;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner.Handlers
|
||||
{
|
||||
public class HwAlignerWaferCheckHandler : HwAlignerGuideHandler
|
||||
{
|
||||
public HwAlignerWaferCheckHandler(HwAlignerGuide device, int timeout = 100)
|
||||
: base(device, "DOC")
|
||||
{
|
||||
AckTimeout = TimeSpan.FromSeconds(timeout);
|
||||
CompleteTimeout = TimeSpan.FromSeconds(timeout);
|
||||
Name = device.Name;
|
||||
device.HaveWafer = false;
|
||||
device.SetCurrentOper();
|
||||
}
|
||||
|
||||
public override bool HandleMessage(MessageBase msg, out bool handled)
|
||||
{
|
||||
var result = msg as HwAlignerGuideMessage;
|
||||
if (result is { IsResponse: false })
|
||||
{
|
||||
handled = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
handled = Device.CheckWaferDataA(Name, result.Data, out var returnIfo);
|
||||
return returnIfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user