|
@@ -1,6 +1,6 @@
|
|
|
#include "stdafx.h"
|
|
#include "stdafx.h"
|
|
|
#include "OTSOxfordImpl.h"
|
|
#include "OTSOxfordImpl.h"
|
|
|
-#include "../OTSControl/ControllerHelper.h"
|
|
|
|
|
|
|
+#include "ControllerHelper.h"
|
|
|
#include "COTSUtilityDllFunExport.h"
|
|
#include "COTSUtilityDllFunExport.h"
|
|
|
#include "OxfordImplConst.h"
|
|
#include "OxfordImplConst.h"
|
|
|
|
|
|
|
@@ -8,6 +8,7 @@
|
|
|
#ifdef _DEBUG
|
|
#ifdef _DEBUG
|
|
|
#define new DEBUG_NEW
|
|
#define new DEBUG_NEW
|
|
|
#endif
|
|
#endif
|
|
|
|
|
+#include <Oxford/OxfordWrapper/OxfordControllerWrapper.h>
|
|
|
|
|
|
|
|
namespace OTSController
|
|
namespace OTSController
|
|
|
{
|
|
{
|
|
@@ -16,38 +17,49 @@
|
|
|
OxfordImpl::OxfordImpl(void)
|
|
OxfordImpl::OxfordImpl(void)
|
|
|
: m_bInit(false)
|
|
: m_bInit(false)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+ if (ManagedGlobals::oxfordController == nullptr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ManagedGlobals::oxfordController = gcnew OxfordControllerWrapper();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
OxfordImpl::~OxfordImpl(void)
|
|
OxfordImpl::~OxfordImpl(void)
|
|
|
{
|
|
{
|
|
|
CloseClient();
|
|
CloseClient();
|
|
|
- m_oxfordPtr.reset();
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- // Close Client
|
|
|
|
|
-// return true if success
|
|
|
|
|
|
|
+
|
|
|
void OxfordImpl::CloseClient(void)
|
|
void OxfordImpl::CloseClient(void)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- m_oxfordPtr->CloseClient();
|
|
|
|
|
|
|
+ ManagedGlobals::oxfordController->CloseClient();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool OxfordImpl::Connect()
|
|
bool OxfordImpl::Connect()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- if (!m_oxfordPtr)
|
|
|
|
|
- {
|
|
|
|
|
- m_oxfordPtr.reset(new OxfordController);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
if (!m_bInit)
|
|
if (!m_bInit)
|
|
|
{
|
|
{
|
|
|
- m_bInit = m_oxfordPtr->CreateController();
|
|
|
|
|
|
|
+ OxfordWrapperErrorCode r;
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->Init())
|
|
|
|
|
+ {
|
|
|
|
|
+ r=OxfordWrapperErrorCode::CONTROLLER_INIT_FAILED;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->IsConnected())
|
|
|
|
|
+ {
|
|
|
|
|
+ r=OxfordWrapperErrorCode::CONTROLLER_NOT_CONNECTED;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ r=OxfordWrapperErrorCode::SUCCEED;
|
|
|
|
|
+ m_bInit = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
return m_bInit;
|
|
return m_bInit;
|
|
|
}
|
|
}
|
|
@@ -65,19 +77,37 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::IsConnected()
|
|
bool OxfordImpl::IsConnected()
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return (bool)m_oxfordPtr->IsConnected();
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->IsConnected())
|
|
|
|
|
+ {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool OxfordImpl::GetPositionXY(double& a_dPosX, double& a_dPosY)
|
|
bool OxfordImpl::GetPositionXY(double& a_dPosX, double& a_dPosY)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetPositionXY(a_dPosX, a_dPosY);
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetPositionXY(a_dPosX, a_dPosY))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetPositionXY command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -85,9 +115,17 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetPositionXY(double a_dPosX, double a_dPosY)
|
|
bool OxfordImpl::SetPositionXY(double a_dPosX, double a_dPosY)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetPositionXY(a_dPosX, a_dPosY);
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetPositionXY(a_dPosX, a_dPosY))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetPositionXY command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -95,9 +133,16 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetWorkingDistance(double& a_dWorkingDistance)
|
|
bool OxfordImpl::GetWorkingDistance(double& a_dWorkingDistance)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetWorkingDistance(a_dWorkingDistance);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetWorkingDistance(a_dWorkingDistance))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetWorkingDistance command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -105,9 +150,17 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetWorkingDistance(double a_dWorkingDistance)
|
|
bool OxfordImpl::SetWorkingDistance(double a_dWorkingDistance)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetWorkingDistance(a_dWorkingDistance);
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetWorkingDistance(a_dWorkingDistance))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetWorkingDistance command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -115,9 +168,17 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetMagnification(double& a_dMagnification)
|
|
bool OxfordImpl::GetMagnification(double& a_dMagnification)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetMagnification(a_dMagnification);
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetMagnification(a_dMagnification))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetMagnification command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -125,9 +186,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetMagnification(double a_dMagnification)
|
|
bool OxfordImpl::SetMagnification(double a_dMagnification)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetMagnification(a_dMagnification);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetMagnification(a_dMagnification))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetMagnification command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -135,9 +202,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetHighVoltage(double& a_dHighVoltage)
|
|
bool OxfordImpl::GetHighVoltage(double& a_dHighVoltage)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetHighVoltage(a_dHighVoltage);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetHighVoltage(a_dHighVoltage))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetHighVoltage command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -145,9 +218,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetHighVoltage(double a_dHighVoltage)
|
|
bool OxfordImpl::SetHighVoltage(double a_dHighVoltage)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetHighVoltage(a_dHighVoltage);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetHighVoltage(a_dHighVoltage))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetHighVoltage command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -155,9 +234,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetBeamOn(bool& a_bBeamOn)
|
|
bool OxfordImpl::GetBeamOn(bool& a_bBeamOn)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetBeamOn(a_bBeamOn);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetBeamOn(a_bBeamOn))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetBeamOn command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -165,9 +250,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetBeamOn(bool a_bBeamOn)
|
|
bool OxfordImpl::SetBeamOn(bool a_bBeamOn)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetBeamOn(a_bBeamOn);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetBeamOn(a_bBeamOn))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetBeamOn command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -175,9 +266,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetBeamBlank(bool& a_bBeamBlank)
|
|
bool OxfordImpl::GetBeamBlank(bool& a_bBeamBlank)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetBeamBlank(a_bBeamBlank);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetBeamBlank(a_bBeamBlank))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetBeamBlank command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -185,9 +282,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetBeamBlank(bool a_bBeamBlank)
|
|
bool OxfordImpl::SetBeamBlank(bool a_bBeamBlank)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetBeamBlank(a_bBeamBlank);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetBeamBlank(a_bBeamBlank))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetBeamBlank command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -195,9 +298,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetExternal(bool& a_bExternal)
|
|
bool OxfordImpl::GetExternal(bool& a_bExternal)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetExternal(a_bExternal);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetExternalScan(a_bExternal))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetExternal command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -205,9 +314,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetExternal(bool a_bExternal)
|
|
bool OxfordImpl::SetExternal(bool a_bExternal)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetExternal(a_bExternal);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetExternalScan(a_bExternal))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetExternal command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -215,9 +330,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
|
|
bool OxfordImpl::CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->CollectXrayData(a_nAcTime, a_pnCounts, a_nBufferSize);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nAcTime, a_pnCounts, a_nBufferSize))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayData command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -225,9 +346,16 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
|
|
bool OxfordImpl::CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->CollectXrayDataAtPos(a_dPosX, a_dPosY, a_nAcTime, a_pnCounts, a_nBufferSize);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_dPosX, a_dPosY, a_nAcTime, a_pnCounts, a_nBufferSize))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayDataAtPos command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -239,9 +367,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetBeamPosition(const double a_dPosX, const double a_dPosY)
|
|
bool OxfordImpl::SetBeamPosition(const double a_dPosX, const double a_dPosY)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetBeamPosition(a_dPosX, a_dPosY);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetBeamPosition(a_dPosX, a_dPosY))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetBeamPosition command failed."));
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -249,9 +383,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetScanSpeed(const long a_nMilliseconds)
|
|
bool OxfordImpl::SetScanSpeed(const long a_nMilliseconds)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetScanSpeed(a_nMilliseconds);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetScanSpeed(a_nMilliseconds))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetScanSpeed command failed."));
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::SUCCEED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -259,9 +399,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::GetImageSize(long& a_nWidth, long& a_nHeight)
|
|
bool OxfordImpl::GetImageSize(long& a_nWidth, long& a_nHeight)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->GetImageSize(a_nWidth, a_nHeight);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->GetImageSize(a_nWidth, a_nHeight))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("GetImageSize command failed."));
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::SUCCEED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -269,9 +415,16 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::SetImageSize(const long a_nWidth, const long a_nHeight)
|
|
bool OxfordImpl::SetImageSize(const long a_nWidth, const long a_nHeight)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->SetImageSize(a_nWidth, a_nHeight);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->SetImageSize(a_nWidth, a_nHeight))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("SetImageSize command failed."));
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::SUCCEED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -279,10 +432,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::CollectImage(BYTE* a_pImageBits)
|
|
bool OxfordImpl::CollectImage(BYTE* a_pImageBits)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if (m_bInit)
|
|
|
{
|
|
{
|
|
|
- int i= m_oxfordPtr->CollectImage(a_pImageBits);
|
|
|
|
|
- return i== (int)OxfordWrapperErrorCode::SUCCEED;
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectImage(a_pImageBits))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("CollectImage command failed."));
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::SUCCEED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -290,9 +448,15 @@
|
|
|
|
|
|
|
|
bool OxfordImpl::QuantifySpectrum(unsigned char* cResult)
|
|
bool OxfordImpl::QuantifySpectrum(unsigned char* cResult)
|
|
|
{
|
|
{
|
|
|
- if (m_oxfordPtr && m_bInit)
|
|
|
|
|
|
|
+ if ( m_bInit)
|
|
|
{
|
|
{
|
|
|
- return m_oxfordPtr->QuantifySpectrum(cResult);
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->QuantifySpectrum(cResult))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("CollectImage command failed."));
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::SUCCEED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
@@ -301,17 +465,6 @@
|
|
|
|
|
|
|
|
BOOL OxfordImpl::GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS)
|
|
BOOL OxfordImpl::GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS)
|
|
|
{
|
|
{
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- // oxford dll handle check
|
|
|
|
|
- ASSERT(m_oxfordPtr);
|
|
|
|
|
- if (!m_oxfordPtr)
|
|
|
|
|
- {
|
|
|
|
|
- // error, invalid m_oxfordDll
|
|
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: invalid m_oxfordDll."));
|
|
|
|
|
- return FALSE;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// do nothing if points list is empty
|
|
// do nothing if points list is empty
|
|
|
if (a_listXrayPois.empty())
|
|
if (a_listXrayPois.empty())
|
|
|
{
|
|
{
|
|
@@ -322,7 +475,6 @@
|
|
|
|
|
|
|
|
// create array of BrukerSegment
|
|
// create array of BrukerSegment
|
|
|
long nCollectCount = (long)a_listXrayPois.size();
|
|
long nCollectCount = (long)a_listXrayPois.size();
|
|
|
- //boost::scoped_array<OxfordXrayData> segmentArray(new OxfordXrayData[nCollectCount]);
|
|
|
|
|
OxfordXrayData* segmentArray(new OxfordXrayData[nCollectCount]);
|
|
OxfordXrayData* segmentArray(new OxfordXrayData[nCollectCount]);
|
|
|
|
|
|
|
|
for (int i = 0; i < nCollectCount; ++i)
|
|
for (int i = 0; i < nCollectCount; ++i)
|
|
@@ -331,15 +483,16 @@
|
|
|
segmentArray[i].m_nPosX = poi.x;
|
|
segmentArray[i].m_nPosX = poi.x;
|
|
|
segmentArray[i].m_nPosY = poi.y;
|
|
segmentArray[i].m_nPosY = poi.y;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- if (!m_oxfordPtr->CollectXrayList(a_nACTimeMS, segmentArray, nCollectCount, GENERALXRAYCHANNELS))
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectXrayPoints(a_nACTimeMS, segmentArray, nCollectCount, GENERALXRAYCHANNELS))
|
|
|
{
|
|
{
|
|
|
- LogTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: poits list is empty."));
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayList command failed."));
|
|
|
|
|
+ return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// get the specs for a_vXPoints
|
|
// get the specs for a_vXPoints
|
|
|
for (int i = 0; i < nCollectCount; ++i)
|
|
for (int i = 0; i < nCollectCount; ++i)
|
|
|
{
|
|
{
|
|
@@ -368,11 +521,14 @@
|
|
|
// try to redo x-ray collection at the position
|
|
// try to redo x-ray collection at the position
|
|
|
static DWORD nChannelData[GENERALXRAYCHANNELS];
|
|
static DWORD nChannelData[GENERALXRAYCHANNELS];
|
|
|
memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
|
|
memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
|
|
|
- if (!m_oxfordPtr->CollectXrayData(a_nACTimeMS, (long*)nChannelData, GENERALXRAYCHANNELS))
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nACTimeMS, (long*)nChannelData, GENERALXRAYCHANNELS))
|
|
|
{
|
|
{
|
|
|
// error
|
|
// error
|
|
|
CString s;
|
|
CString s;
|
|
|
- s.Format(_T("Call CollectOneXRayPoint failed: index = %d(x:%d, y:%d))"), i, poi.x, poi.y);
|
|
|
|
|
|
|
+ s.Format(_T("Call CollectXRayPoint failed: index = %d(x:%d, y:%d))"), i, poi.x, poi.y);
|
|
|
LogErrorTrace(__FILE__,__LINE__,s);
|
|
LogErrorTrace(__FILE__,__LINE__,s);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -402,11 +558,7 @@
|
|
|
// ok return TRUE
|
|
// ok return TRUE
|
|
|
return TRUE;
|
|
return TRUE;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- catch (const std::exception e)
|
|
|
|
|
- {
|
|
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: exception.")+ CString(e.what()));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// error, return false
|
|
// error, return false
|
|
|
return FALSE;
|
|
return FALSE;
|
|
@@ -415,16 +567,8 @@
|
|
|
|
|
|
|
|
BOOL OxfordImpl::GetXRayByFeatures(CPosXraysList&a_listXrayPois, std::vector<BrukerFeature>& a_vFeatures, DWORD a_nXRayAQTime)
|
|
BOOL OxfordImpl::GetXRayByFeatures(CPosXraysList&a_listXrayPois, std::vector<BrukerFeature>& a_vFeatures, DWORD a_nXRayAQTime)
|
|
|
{
|
|
{
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- // oxford dll handle check
|
|
|
|
|
- ASSERT(m_oxfordPtr);
|
|
|
|
|
- if (!m_oxfordPtr)
|
|
|
|
|
- {
|
|
|
|
|
- // error, invalid m_oxfordDll
|
|
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: invalid m_oxfordDll."));
|
|
|
|
|
- return FALSE;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// do nothing if points list is empty
|
|
// do nothing if points list is empty
|
|
|
if (a_listXrayPois.empty())
|
|
if (a_listXrayPois.empty())
|
|
@@ -480,12 +624,14 @@
|
|
|
int a_nACTimeMS = a_nXRayAQTime / nTotalNum;
|
|
int a_nACTimeMS = a_nXRayAQTime / nTotalNum;
|
|
|
|
|
|
|
|
|
|
|
|
|
- if (!m_oxfordPtr->CollectXrayArea(a_nXRayAQTime, features, nCollectCount, GENERALXRAYCHANNELS))
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectXrayArea(a_nXRayAQTime, features, nCollectCount, GENERALXRAYCHANNELS))
|
|
|
{
|
|
{
|
|
|
- LogTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: poits list is empty."));
|
|
|
|
|
-
|
|
|
|
|
|
|
+ LogTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayArea failed"));
|
|
|
return false;
|
|
return false;
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// get the specs for a_vXPoints
|
|
// get the specs for a_vXPoints
|
|
|
for (int i = 0; i < nCollectCount; ++i)
|
|
for (int i = 0; i < nCollectCount; ++i)
|
|
@@ -516,13 +662,15 @@
|
|
|
// try to redo x-ray collection at the position
|
|
// try to redo x-ray collection at the position
|
|
|
static DWORD nChannelData[GENERALXRAYCHANNELS];
|
|
static DWORD nChannelData[GENERALXRAYCHANNELS];
|
|
|
memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
|
|
memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
|
|
|
- if (!m_oxfordPtr->CollectXrayData(a_nXRayAQTime, (long*)nChannelData, GENERALXRAYCHANNELS))
|
|
|
|
|
- {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nXRayAQTime, (long*)nChannelData, GENERALXRAYCHANNELS))
|
|
|
|
|
+ {
|
|
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayData command failed."));
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// set spectrum with new spectrum
|
|
// set spectrum with new spectrum
|
|
|
a_listXrayPois[i]->SetXrayData(nChannelData);
|
|
a_listXrayPois[i]->SetXrayData(nChannelData);
|
|
|
|
|
|
|
@@ -541,16 +689,7 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
delete features;
|
|
delete features;
|
|
|
- // ok return TRUE
|
|
|
|
|
return TRUE;
|
|
return TRUE;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- catch (const std::exception&)
|
|
|
|
|
- {
|
|
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: exception."));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // error, return false
|
|
|
|
|
- return FALSE;
|
|
|
|
|
}
|
|
}
|
|
|
-} // namespace Controller
|
|
|
|
|
|
|
+}
|