123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- #include "stdafx.h"
- #include "OTSSEMOxford.h"
- #include "../OTSSemBase.h"
- #include "COTSUtilityDllFunExport.h"
- namespace OTSController {
- COTSSEMOxford::COTSSEMOxford(void)
- {
- }
- COTSSEMOxford::~COTSSEMOxford(void)
- {
- }
- BOOL COTSSEMOxford::IsConnected(void)
- {
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->IsConnected();
- }
- BOOL COTSSEMOxford::Connect(void)
- {
- if (!m_oxfordImpl)
- {
- m_oxfordImpl = OxfordImpl::GetInstance();
- }
- return m_oxfordImpl->Connect();
- }
- // 0: beam off
- // 1: beam on
- // 2: beam blank
- BOOL COTSSEMOxford::GetBeamBlank(long& a_nBeamBlank)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- bool bBeamOn = false;
- if (!m_oxfordImpl->GetBeamOn(bBeamOn))
- {
- return FALSE;
- }
- if (!bBeamOn)
- {
- a_nBeamBlank = 0;
- return TRUE;
- }
- bool bBeamBlank = false;
- if (!m_oxfordImpl->GetBeamBlank(bBeamBlank))
- {
- return FALSE;
- }
- if (bBeamBlank)
- {
- a_nBeamBlank = 2;
- return TRUE;
- }
- a_nBeamBlank = 1;
- return TRUE;
- }
- BOOL COTSSEMOxford::SetBeamBlank(long a_nBeamBlank)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- /*if (a_nBeamBlank < 0 || a_nBeamBlank >= 3)
- {
- return FALSE;
- }
- if (a_nBeamBlank == 0)
- {
- return m_oxfordImpl->SetBeamOn(FALSE);
- }
- if (!m_oxfordImpl->SetBeamOn(TRUE))
- {
- return FALSE;
- }*/
- if (a_nBeamBlank == 0)
- {
- return m_oxfordImpl->SetBeamBlank(FALSE);
- }
- return TRUE;
- }
- BOOL COTSSEMOxford::SetBeamCurrent(BOOL a_nBeamCurrent)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
-
- if (!a_nBeamCurrent)
- {
- return m_oxfordImpl->SetBeamOn(FALSE);
- }
-
- return TRUE;
- }
- BOOL COTSSEMOxford::GetPositionXY(double& a_dPositionX, double& a_dPositionY, double& /*a_dPositionR*/)
- {
- // controller checking
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- if (!m_oxfordImpl->GetPositionXY(a_dPositionX, a_dPositionY))
- {
- return FALSE;
- }
- return TRUE;
- }
- BOOL COTSSEMOxford::SetPositionXY(double a_dPositionX, double a_dPositionY, double /*a_dPositionR*/)
- {
- // controller checking
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- // set position
- if (!m_oxfordImpl->SetPositionXY(a_dPositionX, a_dPositionY))
- {
- // OK, return TRUE
- return TRUE;
- }
- LogTrace(__FILE__, __LINE__, _T("setpostionxy %f, %f"), a_dPositionX, a_dPositionY);
- return TRUE;
- }
- BOOL COTSSEMOxford::SetPositionXY(double a_dPositionX, double a_dPositionY)
- {
- // controller checking
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- // set position
- if (!m_oxfordImpl->SetPositionXY(a_dPositionX, a_dPositionY))
- {
- // OK, return TRUE
- return TRUE;
- }
- LogTrace(__FILE__, __LINE__, _T("setpostionxy %f, %f"), a_dPositionX, a_dPositionY);
- return TRUE;
- }
- BOOL COTSSEMOxford::GetWorkingDistance(double& a_dWorkingDistance)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->GetWorkingDistance(a_dWorkingDistance);
- }
- BOOL COTSSEMOxford::SetWorkingDistance(double a_dWorkingDistance)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->SetWorkingDistance(a_dWorkingDistance);
- }
- BOOL COTSSEMOxford::GetHighTension(double& a_dKV)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->GetHighVoltage(a_dKV);
- }
- BOOL COTSSEMOxford::SetHighTension(double a_dKV)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->SetHighVoltage(a_dKV);
- }
- BOOL COTSSEMOxford::GetMagnification(double& a_dMagnification)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->GetMagnification(a_dMagnification);
- }
- BOOL COTSSEMOxford::SetMagnification(double a_dMagnification)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->SetMagnification(a_dMagnification);
- }
- // get scan field size
- // param double& a_dScanFieldSizeX - output
- // double& a_dScanFieldSizeY - output
- // return TRUE if success
- BOOL COTSSEMOxford::GetScanFieldSize(double& a_dScanFieldSizeX, double& a_dScanFieldSizeY)
- {
- // set method succeed flag to FALSE as default
- BOOL bReturn = FALSE;
- // get screen matrix and magnification
- double fmag = 0;
- if (GetMagnification(fmag))
- {
- double fssizeX = 0;
- double fssizeY = 0;
- if (MagToScanFieldSize(fmag, fssizeX, fssizeY))
- {
- // calculate scan field size and set output values
- a_dScanFieldSizeX = fssizeX;
- a_dScanFieldSizeY = fssizeY;
- // set method succeed flag to TRUE
- bReturn = TRUE;
- }
- }
- // return method succeed flag
- return bReturn;
- }
- // Set scan field size
- // param double& a_dScanFieldSizeX
- // return TRUE if success
- BOOL COTSSEMOxford::SetScanFieldSizeX(double a_dScanFieldSizeX)
- {
- // set method succeed flag to FALSE as default
- BOOL bReturn = FALSE;
- double mag = 0;
- if (ScanFieldSizeToMag(mag, a_dScanFieldSizeX))
- {
- LogTrace(__FILE__, __LINE__,_T("Scan field size is %f, mag is %f"), a_dScanFieldSizeX, mag);
- // set magnification and method succeed flag
- bReturn = SetMagnification(mag);
- }
- // return method succeed flag
- return bReturn;
- }
- BOOL COTSSEMOxford::SetScanExternal(BOOL a_bExternal)
- {
- ASSERT(m_oxfordImpl);
- if (!m_oxfordImpl)
- {
- return FALSE;
- }
- return m_oxfordImpl->SetExternal(a_bExternal);
- }
- }
|