using FEIApiControl; using OTSDataType; using OTSMeasureApp.ServiceCenter; using OTSMeasureApp.ServiceCenter.Coxm; using OTSMeasureApp.ServiceCenter.PicoSmart; using System; using System.Collections.Generic; using System.Configuration; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace OTSModelSharp.ServiceCenter { public class SemController : ISemController { private OTSCLRINTERFACE.COTSControlFunExport hw = null; private static ISemController sem = null; public static ISemController GetSEMController() { var semtype = FileHelper.GetXMLInformations("SemControllerName"); if (sem == null) { if (semtype== "FEI") { sem = new FEISemController(); } else if (semtype == "Oxford") { sem = new OxfordSemController(); } else if (semtype == "PicoSmart") { sem = new PicoSmartSemController(); } else if (semtype == "Coxm") { sem = new CoxmSemController(); } else { sem = new SemController(semtype); } } return sem; } private SemController(string devicetype) { hw = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance(devicetype); } public bool Connect() { if (hw.IsConnected()) { return true; } var sta= hw.ConncetSem(); return sta; } public bool IsConnected() { return hw.IsConnected(); } public bool DisConnect() { if (hw.IsConnected()) { return hw.DisconnectSem(); } return true; } public bool GetMagnification(ref double a_dMagnification) { if (!hw.IsConnected()) { return false; } return hw.GetSemMagnification(ref a_dMagnification); } public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY) { if (!hw.IsConnected()) { return false; } return hw.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY); } public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR) { if (!hw.IsConnected()) { return false; } return hw.GetSemPositionXY(ref a_dPositionX, ref a_dPositionY, ref a_dPositionR); } public bool GetWorkingDistance(ref double a_distance) { if (!hw.IsConnected()) { return false; } return hw.GetSemWorkingDistance(ref a_distance); } public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY, double a_dRotation) { if (!hw.IsConnected()) { return false; } return hw.MoveSEMToPoint(a_dPositionX, a_dPositionY, a_dRotation); } public bool MoveSEMToPoint(double a_dPositionX, double a_dPositionY) { if (!hw.IsConnected()) { return false; } return hw.MoveSEMToPoint(a_dPositionX, a_dPositionY); } public bool SetMagnification(double a_dMagnification) { if (!hw.IsConnected()) { return false; } NLog.LogManager.GetCurrentClassLogger().Warn("Set Magnification:" + a_dMagnification.ToString("F2")); hw.SetSemMagnification(a_dMagnification); return true; } public bool SetScanExternal(bool b) { if (!hw.IsConnected()) { return false; } return hw.SetSemScanExternal(b); } public bool SetWorkingDistance(double a_distance) { if (!hw.IsConnected()) { return false; } return hw.SetSemWorkingDistance(a_distance); System.Threading.Thread.Sleep(100); } public bool GetSemBrightness(ref double a_dBrightness) { if (!hw.IsConnected()) { return false; } return hw.GetSemBrightness(ref a_dBrightness); } public bool SetSemBrightness(double a_dBrightness) { if (!hw.IsConnected()) { return false; } return hw.SetSemBrightness(a_dBrightness); } public bool GetSemContrast(ref double a_dContrast) { if (!hw.IsConnected()) { return false; } return hw.GetSemContrast(ref a_dContrast); } public bool SetSemContrast(double a_dContrast) { if (!hw.IsConnected()) { return false; } return hw.SetSemContrast(a_dContrast); } public bool GetSemHighTension(ref double a_dKV) { if (!hw.IsConnected()) { return false; } return hw.GetSemHighTension(ref a_dKV); } public bool SetSemHighTension(double a_dKV) { if (!hw.IsConnected()) { return false; } return hw.SetSemHighTension(a_dKV); } public bool SetSemBeamOn(bool val) { if (!hw.IsConnected()) { return false; } return hw.SetSemBeamCurrent(val); } public bool SetSemBeamBlank(bool value) { if (!hw.IsConnected()) { return false; } return hw.SetSemBeamBlank(value); } public bool GetSemBeamBlank(ref int a_nBeamBlank) { if (!hw.IsConnected()) { return false; } return hw.GetSemBeamBlank(ref a_nBeamBlank); } public void StopXrayAcquisition() { if (hw.IsConnected()) { hw.StopXrayAcquisition(); } return ; } public bool SetSemBeamCurrentOff(bool value) { return hw.SetSemBeamCurrent(value); } bool ISemController.StopXrayAcquisition() { throw new NotImplementedException(); } public bool SetSemHTOff(bool value) { return hw.SetSemHTOnOff(value); } public bool RunHIGH_VACUUM() { return true; } public bool StopImageAcquisition() { return true; } public bool SetReducedArea() { return true; } public bool SetFullFrame() { return true; } } }