123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- #include "stdafx.h"
- #include "OTSScanBrucker.h"
- #include "SEMCommonConst.h"
- namespace OTSController {
- // constructor
- COTSScanBrucker::COTSScanBrucker()
- : m_pBrukerImpl(nullptr)
- {
- m_pBrukerImpl = COTSBrukerImpl::GetInstance();
- if (!m_pBrukerImpl->Init(CONTROL_TYPE::BRUKER_SCAN))
- {
- // failed to call bruker controller init method
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::Init: failed to failed to call bruker controller init method."));
-
- }
- }
- // destructor
- COTSScanBrucker::~COTSScanBrucker(void)
- {
- }
- // initialization
- BOOL COTSScanBrucker::Init()
- {
- return TRUE;
- }
- // acquire BSE image
- CBSEImgPtr COTSScanBrucker::AcquireBSEImage()
- {
- // BSE image
- CBSEImgPtr poBSEImgPtr = nullptr;
- // acquire BSE image
- poBSEImgPtr = m_pBrukerImpl->AcquireImage();
- // check acquired image
- ASSERT(poBSEImgPtr);
- if (!poBSEImgPtr)
- {
- // failed to load simulation image
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::AcquireBSEImage: failed to acquire image"));
- }
- // return acquired image, nullptr if acquire image failed
- return poBSEImgPtr;
- }
- // move beam to point
- BOOL COTSScanBrucker::MoveBeamTo(CPoint& a_beamPos)
- {
-
- // move beam to point
- if (!m_pBrukerImpl->ImageSetPoint(a_beamPos))
- {
- // failed to call ImageSetPoint method
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::MoveBeamTo: failed to call ImageSetPoint method."));
- return FALSE;
- }
- // ok, return TRUE
- return TRUE;
- }
- // set image size
- BOOL COTSScanBrucker::SetImageSize(long a_nImageSizeX,long a_Height)
- {
- // call ImageGetConfiguration to get the existing dimensions, dwell time and enabled channels
- /*DWORD nWidth = 0;
- DWORD nHeight = 0;*/
- DWORD nAverage;
- BYTE bCh1;
- BYTE bCh2;
- if (!m_pBrukerImpl->ImageGetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
- {
- // failed to call ImageGetConfiguration method
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetImageSize: failed to call ImageGetConfiguration method."));
- return FALSE;
- }
- // set image size
- nWidth = a_nImageSizeX;
- nHeight = a_Height;
- if (!m_pBrukerImpl->ImageSetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
- {
- // failed to call ImageGetConfiguration method
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetImageSize: failed to call ImageSetConfiguration method."));
- return FALSE;
- }
- // ok, return TRUE
- return TRUE;
- }
- // set dwell time
- BOOL COTSScanBrucker::SetDwellTime(long a_nDwellTime)
- {
- // call ImageGetConfiguration to get the existing dimensions, dwell time and enabled channels
- DWORD nWidth = 0;
- DWORD nHeight = 0;
- DWORD nAverage;
- BYTE bCh1;
- BYTE bCh2;
- if (!m_pBrukerImpl->ImageGetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
- {
- // failed to call ImageGetConfiguration method
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetDwellTime: failed to call ImageGetConfiguration method."));
- return FALSE;
- }
- // set dwell time
- nAverage = (DWORD)a_nDwellTime;
- if(!m_pBrukerImpl->ImageSetConfiguration(nWidth, nHeight, nAverage, bCh1, bCh2))
- {
- // failed to call ImageSetConfiguration method
- LogErrorTrace(__FILE__, __LINE__, _T("COTSScanBrucker::SetDwellTime: failed to call ImageSetConfiguration method."));
- return FALSE;
- }
- return TRUE;
- }
- }
|