SemController.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. 
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace ServiceInterface
  9. {
  10. public class SemController
  11. {
  12. public static OTSCLRINTERFACE.COTSControlFunExport hw=null;
  13. public SemController()
  14. {
  15. if (hw == null)
  16. {
  17. hw = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance();
  18. }
  19. }
  20. public bool Connect()
  21. {
  22. if (hw.IsConnected())
  23. {
  24. return true;
  25. }
  26. else
  27. { //和电镜建立通讯连接
  28. return hw.ConncetSem();
  29. }
  30. }
  31. public bool DisConnect()
  32. {
  33. return hw.DisconnectSem();
  34. }
  35. public bool GetMagnification(ref double a_dMagnification)
  36. {
  37. return hw.GetSemMagnification(ref a_dMagnification);
  38. }
  39. public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
  40. {
  41. return hw.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
  42. }
  43. public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
  44. {
  45. return hw.GetSemPositionXY(ref a_dPositionX, ref a_dPositionY, ref a_dPositionR);
  46. }
  47. public bool GetWorkingDistance(ref double a_distance)
  48. {
  49. return hw.GetSemWorkingDistance(ref a_distance);
  50. }
  51. public bool IsConnected()
  52. {
  53. //return true;
  54. return hw.IsConnected();
  55. }
  56. public bool MoveSEMToPoint(Point poi, double rotation)
  57. {
  58. return hw.MoveSEMToPoint(poi.X, poi.Y, rotation);
  59. }
  60. public bool SetMagnification(double a_dMagnification)
  61. {
  62. //hw.SetMagnification(a_dMagnification);
  63. hw.SetSemMagnification(a_dMagnification);
  64. return true;
  65. }
  66. public bool SetScanExternal(bool b)
  67. {
  68. //int seValue = b ? 1 : 0;
  69. return hw.SetSemScanExternal(b);
  70. }
  71. public bool SetWorkingDistance(double a_distance)
  72. {
  73. return hw.SetSemWorkingDistance(a_distance);
  74. }
  75. public OTSCLRINTERFACE.COTSControlFunExport GetHardwareInterface()
  76. {
  77. return hw;
  78. }
  79. }
  80. }