using FEIApiControl; using OTSModelSharp.ServiceCenter; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OTSMeasureApp.ServiceCenter.PicoSmart { class PicoSmartSemController : ISemController { public static PicoSmartApi_cshape m_api; private int imageWidth = 640; private int imageHeight = 480; double dwelltime = 10; int port = 7321; string ip = "127.0.0.1"; /// /// //se 0;bse 1;se_bse 2; /// int scan_chanel = 1; /// /// //red 0; fast 1; slow 2; slow2 3 /// int scan_speed = 1; public PicoSmartSemController() { m_api = new PicoSmartApi_cshape(); m_api.set_ip(ip); m_api.set_port(port); } public static PicoSmartApi_cshape GetApiClassInstance() { if(m_api==null) { m_api=new PicoSmartApi_cshape(); } return m_api; } public bool Connect() { string FEIIP = FileHelper.GetXMLInformations("FEIIP"); string FEIPORT = FileHelper.GetXMLInformations("FEIPORT"); if (FEIIP == "" || FEIPORT == "") { NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!"); return false; } m_api.set_ip(FEIIP); m_api.set_port(int.Parse(FEIPORT)); if (m_api.isStart() == 1) { return true; } if (m_api.start()==1) { return true; } return false; } public bool DisConnect() { if (m_api.stop() == 1) { return true; } return false; } public bool GetMagnification(ref double a_dMagnification) { return m_api.GetMagnification(ref a_dMagnification); } public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY) { if(m_api.isStart()==0) { return false; } else { dScanFieldSizeX = imageWidth; dScanFieldSizeY = imageHeight; } return false; } public bool GetSemBeamBlank(ref int a_nBeamBlank) { return false; } public bool GetSemBrightness(ref double a_dBrightness) { return m_api.GetSemBrightness(ref a_dBrightness); } public bool GetSemContrast(ref double a_dContrast) { return m_api.GetSemContrast(ref a_dContrast); } public bool GetSemHighTension(ref double a_dKV) { return m_api.GetSemHighTension(ref a_dKV); } public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR) { return false; } public bool GetWorkingDistance(ref double a_distance) { return m_api.GetWorkingDistance(ref a_distance); } public bool IsConnected() { if(m_api.isStart()==1) { return true; } return false; } public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double rotation) { return false; } public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY) { return m_api.MoveSEMToPoint(a_dPositionX, a_dPositionY); } public bool SetMagnification(double a_dMagnification) { return m_api.SetMagnification(a_dMagnification); } public bool SetScanExternal(bool b) { return false; } public bool SetSemBeamBlank(bool value) { return false; } public bool SetSemBeamCurrentOff(bool value) { return false; } public bool SetSemBrightness(double a_dBrightness) { return m_api.SetSemBrightness(a_dBrightness); } public bool SetSemContrast(double a_dContrast) { return m_api.SetSemContrast( a_dContrast); } public bool SetSemHighTension(double a_dKV) { return m_api.SetSemHighTension(a_dKV); } public bool SetSemHTOff(bool value) { return false; } public bool SetWorkingDistance(double a_distance) { return false; } public bool StopXrayAcquisition() { return false; } } }