15 #define LOG(__msg__, __level__,__location__) l_SendLogMessage(__msg__, __level__, "", __location__ )
27 void CMFCController::l_SendLogMessage(
const std::string & rMessage,
const CInstrumentCatalog::eLogLevel & rLevel,
const std::string & rContext,
const std::string & rLocation)
36 m_ContCat.
cError.RequestControl(rErrorMessage);
39 void CMFCController::l_SendSearchProgress(
const U8 & rSearchProgress)
54 bool CMFCController::l_IsAbortRequested()
56 return CThreadedMailBox::l_IsRequestedToStop();
61 rErrorOut = rOriginError;
62 if (CMFCDevice::sMFCDeviceError::eLevel::kWarning == rOriginError.
Level &&
nullptr != m_pMFCDevice)
66 rErrorOut.
Level = CMFCDevice::sMFCDeviceError::eLevel::kError;
73 void CMFCController::l_AbortInstrument()
79 if (
nullptr != m_pMFCDevice)
91 l_SendErrorMessage(rE);
95 void CMFCController::l_ScanResources()
103 if (
nullptr == m_pRsrcManager)
110 if (l_RsrcList != l_NewRsrcList)
112 l_RsrcList = l_NewRsrcList;
119 l_SendErrorMessage(rE);
125 void CMFCController::l_GetRemoteBoxButtonStatus()
130 bool l_RemoteBoxPressed(
false);
133 if (
nullptr == m_pMFCDevice)
141 if (l_RemoteBoxPressed)
147 l_CheckConnectionOnWarning(rE, l_Error);
149 l_SendErrorMessage(l_Error);
153 bool CMFCController::l_ScanPA()
156 bool l_PAInfoChanged(
false);
157 bool l_PASucceeded(
true);
165 if (
nullptr == m_pMFCDevice)
172 l_PAInfoChanged =
true;
177 l_RetError = m_pMFCDevice->
ScanPA(m_PAInfo, l_InsConf, l_PAInfoChanged);
186 l_CheckConnectionOnWarning(rE, l_Error);
188 l_SendErrorMessage(l_Error);
189 l_PASucceeded =
false;
193 m_ContCat.
cPAInfo.RequestControl(m_PAInfo);
196 return l_PASucceeded;
199 void CMFCController::l_OperateWithInstrument()
222 if (
nullptr == m_pMFCDevice)
224 l_RetError = m_pMFCDevice->
Search(m_InstrState);
239 if (
nullptr == m_pMFCDevice)
241 l_RetError = m_pMFCDevice->
Measure(m_InstrState);
253 l_SendErrorMessage(rE);
257 void CMFCController::l_RequestSelfAbort()
267 m_ContCat(rCatInstance),
270 m_pMFCDevice(nullptr),
271 m_DefaultPAConfScriptFilePath(rDefaultPAConfScriptFilePath),
272 m_CustomPAConfScriptDirectory(rCustomPAConfScriptDir)
284 void CMFCController::l_TimerEventHandler()
288 switch (m_ControllerState)
293 m_Timer.
StartSingleShot(std::chrono::milliseconds(RSRC_POLLING_PERIOD_MS));
298 l_GetRemoteBoxButtonStatus();
300 m_Timer.
StartSingleShot(std::chrono::milliseconds(PA_POLLING_PERIOD_MS));
305 l_OperateWithInstrument();
323 void CMFCController::l_PostTimerEvent()
332 case eEventType::kExit:
339 case eEventType::kUserMsg:
344 case sMFCControllerMailBoxMsg::eMsgType::kTimerEvent:
345 l_TimerEventHandler();
355 CThreadedMailBox::ThreadStart();
360 CThreadedMailBox::ThreadStop();
373 m_pMFCDevice =
nullptr;
375 if (
nullptr == pRsrcManager)
380 m_pRsrcManager = pRsrcManager;
398 if (
nullptr == pMFCDevice)
403 if (pMFCDevice != m_pMFCDevice)
407 m_pMFCDevice = pMFCDevice;
426 if (
nullptr == pMFCDevice)
431 m_pMFCDevice = pMFCDevice;
432 m_InstrState = InsState;
462 if (
nullptr == m_pMFCDevice)
475 m_ContCat.
cPAInfo.RequestControl(m_PAInfo);
481 l_CheckConnectionOnWarning(rE, l_Error);
483 l_SendErrorMessage(l_Error);