ScanController.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using OTSCLRINTERFACE;
  2. using OTSDataType;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace OTSModelSharp.ServiceInterface
  10. {
  11. public class ScanController : IScanController
  12. {
  13. private OTSCLRINTERFACE.COTSControlFunExport scan;
  14. static ScanController scanctrl=null;
  15. public static ScanController GetScanController()
  16. {
  17. if (scanctrl == null)
  18. {
  19. scanctrl = new ScanController();
  20. }
  21. return scanctrl;
  22. }
  23. private ScanController()
  24. {
  25. this.scan = SemController.hw;
  26. }
  27. public CBSEImgClr AcquireBSEImage(int matrixIndex, int reads, int dwell)
  28. {
  29. if (!scan.IsConnected())
  30. {
  31. return null;
  32. }
  33. Rectangle r = new Rectangle();
  34. CBSEImgClr bse = new CBSEImgClr(r);
  35. if (!scan.AcquireBSEImage(matrixIndex, reads, dwell, ref bse))
  36. {
  37. return null;
  38. }
  39. return bse;
  40. }
  41. public bool Init()
  42. {
  43. bool m_init= scan.ScanInit();
  44. return m_init;
  45. }
  46. public bool SetDwellTime(long val)
  47. {
  48. if (!scan.IsConnected())
  49. {
  50. return false;
  51. }
  52. return scan.SetDwellTime((int)val);
  53. }
  54. public bool SetImageSize(int width,int height)
  55. {
  56. if (!scan.IsConnected())
  57. {
  58. return false;
  59. }
  60. return scan.SetImageSize(width,height);
  61. }
  62. }
  63. }