OTSScanBrucker.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #include "stdafx.h"
  2. #include "OTSScanBrucker.h"
  3. #include "SEMCommonConst.h"
  4. namespace OTSController {
  5. // constructor
  6. COTSScanBrucker::COTSScanBrucker()
  7. : m_pBrukerImpl(nullptr)
  8. {
  9. m_pBrukerImpl = COTSBrukerImpl::GetInstance();
  10. if (!m_pBrukerImpl->Init(CONTROL_TYPE::BRUKER_SCAN))
  11. {
  12. // failed to call bruker controller init method
  13. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::Init: failed to failed to call bruker controller init method."));
  14. }
  15. }
  16. // destructor
  17. COTSScanBrucker::~COTSScanBrucker(void)
  18. {
  19. }
  20. // initialization
  21. BOOL COTSScanBrucker::Init()
  22. {
  23. return TRUE;
  24. }
  25. // acquire BSE image
  26. CBSEImgPtr COTSScanBrucker::AcquireBSEImage()
  27. {
  28. // BSE image
  29. CBSEImgPtr poBSEImgPtr = nullptr;
  30. // acquire BSE image
  31. poBSEImgPtr = m_pBrukerImpl->AcquireImage();
  32. // check acquired image
  33. ASSERT(poBSEImgPtr);
  34. if (!poBSEImgPtr)
  35. {
  36. // failed to load simulation image
  37. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::AcquireBSEImage: failed to acquire image"));
  38. }
  39. // return acquired image, nullptr if acquire image failed
  40. return poBSEImgPtr;
  41. }
  42. // move beam to point
  43. BOOL COTSScanBrucker::MoveBeamTo(CPoint& a_beamPos)
  44. {
  45. // move beam to point
  46. if (!m_pBrukerImpl->ImageSetPoint(a_beamPos))
  47. {
  48. // failed to call ImageSetPoint method
  49. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::MoveBeamTo: failed to call ImageSetPoint method."));
  50. return FALSE;
  51. }
  52. // ok, return TRUE
  53. return TRUE;
  54. }
  55. // set image size
  56. BOOL COTSScanBrucker::SetImageSize(long a_nImageSizeX,long a_Height)
  57. {
  58. // call ImageGetConfiguration to get the existing dimensions, dwell time and enabled channels
  59. /*DWORD nWidth = 0;
  60. DWORD nHeight = 0;*/
  61. DWORD nAverage;
  62. BYTE bCh1;
  63. BYTE bCh2;
  64. if (!m_pBrukerImpl->ImageGetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
  65. {
  66. // failed to call ImageGetConfiguration method
  67. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetImageSize: failed to call ImageGetConfiguration method."));
  68. return FALSE;
  69. }
  70. // set image size
  71. nWidth = a_nImageSizeX;
  72. nHeight = a_Height;
  73. if (!m_pBrukerImpl->ImageSetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
  74. {
  75. // failed to call ImageGetConfiguration method
  76. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetImageSize: failed to call ImageSetConfiguration method."));
  77. return FALSE;
  78. }
  79. // ok, return TRUE
  80. return TRUE;
  81. }
  82. // set dwell time
  83. BOOL COTSScanBrucker::SetDwellTime(long a_nDwellTime)
  84. {
  85. // call ImageGetConfiguration to get the existing dimensions, dwell time and enabled channels
  86. DWORD nWidth = 0;
  87. DWORD nHeight = 0;
  88. DWORD nAverage;
  89. BYTE bCh1;
  90. BYTE bCh2;
  91. if (!m_pBrukerImpl->ImageGetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
  92. {
  93. // failed to call ImageGetConfiguration method
  94. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetDwellTime: failed to call ImageGetConfiguration method."));
  95. return FALSE;
  96. }
  97. // set dwell time
  98. nAverage = (DWORD)a_nDwellTime;
  99. if(!m_pBrukerImpl->ImageSetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
  100. {
  101. // failed to call ImageSetConfiguration method
  102. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetDwellTime: failed to call ImageSetConfiguration method."));
  103. return FALSE;
  104. }
  105. return TRUE;
  106. }
  107. }