ScanController.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. private bool m_init=false;
  15. public ScanController()
  16. {
  17. this.scan = SemController.hw;
  18. }
  19. public CBSEImgClr AcquireBSEImage(int matrixIndex, int reads, int dwell)
  20. {
  21. if (!scan.IsConnected())
  22. {
  23. return null;
  24. }
  25. if (!m_init)
  26. {
  27. return null;
  28. }
  29. Rectangle r = new Rectangle();
  30. CBSEImgClr bse = new CBSEImgClr(r);
  31. if (!scan.AcquireBSEImage(matrixIndex, reads, dwell, ref bse))
  32. {
  33. return null;
  34. }
  35. return bse;
  36. }
  37. public bool Init()
  38. {
  39. m_init= scan.ScanInit();
  40. return m_init;
  41. }
  42. public bool SetDwellTime(long val)
  43. {
  44. if (!scan.IsConnected())
  45. {
  46. return false;
  47. }
  48. if (!m_init)
  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. if (!m_init)
  61. {
  62. return false;
  63. }
  64. return scan.SetImageSize(width,height);
  65. }
  66. }
  67. }