using OTSDataType; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OTSModelSharp.ServiceInterface { public class SemController : ISemController { public static OTSCLRINTERFACE.COTSControlFunExport hw=null; private static SemController sem=null; public static SemController GetSEMController() { if (sem == null) { sem = new SemController(); } return sem; } private SemController() { hw = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance(); } public bool Connect() { if (!hw.Init()) { return false; } if (hw.IsConnected()) { return true; } return hw.ConncetSem(); } public bool IsConnected() { //return true; return hw.IsConnected(); } public bool DisConnect() { if (hw.IsConnected()) { return hw.DisconnectSem(); } return true; } public bool GetSEMDataGnrFromHw(ref CSEMDataGnr SemDataGnr) { if (!hw.IsConnected()) { return false; } double kv=0, brightness=0, contrast=0; hw.GetSemHighTension(ref kv); hw.GetSemBrightness(ref brightness); hw.GetSemContrast(ref contrast); SemDataGnr.SetValue(kv, brightness, contrast); 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(Point poi, double rotation) { if (!hw.IsConnected()) { return false; } return hw.MoveSEMToPoint(poi.X, poi.Y,rotation); } public bool MoveSEMToPoint(Point poi) { if (!hw.IsConnected()) { return false; } return hw.MoveSEMToPoint(poi.X, poi.Y); } public bool SetMagnification(double a_dMagnification) { if (!hw.IsConnected()) { return false; } //hw.SetMagnification(a_dMagnification); hw.SetSemMagnification(a_dMagnification); return true; } public bool SetScanExternal(bool b) { if (!hw.IsConnected()) { return false; } //int seValue = b ? 1 : 0; return hw.SetSemScanExternal(b); } public bool SetWorkingDistance(double a_distance) { if (!hw.IsConnected()) { return false; } return hw.SetSemWorkingDistance(a_distance); } public bool SetSemBeamCurrentOff() { if (!hw.IsConnected()) { return false; } //int seValue = b ? 1 : 0; return hw.SetSemBeamCurrent(true); } public OTSCLRINTERFACE.COTSControlFunExport GetHardwareInterface() { if (!hw.IsConnected()) { return null; } return hw; } } }