123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- using FEIApiControl;
- using OTSDataType;
- using OTSMeasureApp.ServiceCenter;
- 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 BrukerSemController : 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
- {
-
- sem = new BrukerSemController(semtype);
- }
- }
-
- return sem;
- }
- private BrukerSemController(string devicetype)
- {
-
- hw = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance(devicetype);
-
- }
-
- public bool Connect()
- {
-
- if (!hw.Init())
- {
- return false;
- }
- 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 SetScanFieldSize100(double dScanFieldSizeX, double dScanFieldSizeY)
- {
-
- if (!hw.IsConnected())
- {
- return false;
- }
- Size size = new Size();
- hw.SetSemScanField100(size);
- dScanFieldSizeX = size.Width;
- dScanFieldSizeY = size.Height;
- return true;
-
- }
- public bool GetScanFieldSize100(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
- {
-
- if (!hw.IsConnected())
- {
- return false;
- }
- Size size = hw.GetSemScanField100();
- dScanFieldSizeX = size.Width;
- dScanFieldSizeY = size.Height;
- return true;
-
- }
- 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 a_dKV)
- {
-
- if (!hw.IsConnected())
- {
- return false;
- }
- return hw.SetSemBeamBlank(a_dKV);
-
- }
- 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 GetSemBeamOn()
- //{
- // return sem.GetSemBeamOn();
- //}
- public bool SetSemBeamCurrent(bool a_dKV)
- {
- throw new NotImplementedException();
- }
- bool ISemController.StopXrayAcquisition()
- {
- throw new NotImplementedException();
- }
- }
- }
|