| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 | 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;        }    }}
 |