|
@@ -80,29 +80,6 @@ namespace OTSController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // initialized?
|
|
|
- //if (!m_bConnected)
|
|
|
- //{
|
|
|
-
|
|
|
- //
|
|
|
- // if (QueryBrukerServers() && OpenClient())
|
|
|
- // {
|
|
|
- // LogTrace(__FILE__, __LINE__, "open bruker client success!");
|
|
|
- // if (!m_psRTSpectrumBuffer)
|
|
|
- // {
|
|
|
- // m_psRTSpectrumBuffer.reset(new char[(int)BRUKER_PARAM::RT_SPECTRUM_BUFFER_SIZE]);
|
|
|
- // }
|
|
|
- // memset(m_psRTSpectrumBuffer.get(), 0, (int)BRUKER_PARAM::RT_SPECTRUM_BUFFER_SIZE);
|
|
|
- // // ok, return true
|
|
|
- // m_bConnected = true;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // m_bConnected = false;
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
-
|
|
|
// control type?
|
|
|
switch (a_nControlType)
|
|
|
{
|
|
@@ -123,11 +100,7 @@ namespace OTSController {
|
|
|
// x-ray control
|
|
|
case CONTROL_TYPE::BRUKER_XRAY:
|
|
|
{
|
|
|
- // check detector states and set m_nSPU
|
|
|
- /*if (!SetSPU())
|
|
|
- {
|
|
|
- return FALSE;
|
|
|
- }*/
|
|
|
+
|
|
|
|
|
|
m_bXRAyControllerInst = TRUE;
|
|
|
}
|
|
@@ -182,28 +155,7 @@ namespace OTSController {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- // check connection
|
|
|
- //BOOL COTSBrukerImpl::CheckConnection(BOOL& a_bConnected)
|
|
|
- //{
|
|
|
-
|
|
|
- // if (BrukerDll::CheckConnection(m_nClientID)== 0)
|
|
|
- // {
|
|
|
- // // connected
|
|
|
- // a_bConnected = TRUE;
|
|
|
-
|
|
|
- // // ok, return true
|
|
|
- // return TRUE;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- //
|
|
|
- // a_bConnected = FALSE;
|
|
|
-
|
|
|
- // //LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CheckConnection: no hardware connected."));
|
|
|
-
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
- //}
|
|
|
+
|
|
|
|
|
|
void COTSBrukerImpl::SetExpectCount(int expectCount)
|
|
|
{
|
|
@@ -1241,10 +1193,10 @@ namespace OTSController {
|
|
|
{
|
|
|
|
|
|
// first attempt to open client
|
|
|
- BOOL bStartNew = TRUE;
|
|
|
- BOOL bGUI = FALSE;
|
|
|
+ bool bStartNew = FALSE;
|
|
|
+ bool bGUI = FALSE;
|
|
|
BOOL bConnected = FALSE;
|
|
|
- auto bRet = BrukerDll::OpenClient(m_psServerName.get(), "edx", "edx", static_cast<BYTE>(bStartNew), static_cast<BYTE>(bGUI), m_nClientID);
|
|
|
+ auto bRet = BrukerDll::OpenClient(m_psServerName.get(), "edx", "edx", bStartNew, bGUI, m_nClientID);//static_cast<BYTE>(bStartNew)
|
|
|
//CheckConnection(bConnected);
|
|
|
if (bRet)
|
|
|
{
|
|
@@ -2494,12 +2446,9 @@ BOOL COTSBrukerImpl::GetXRayByFeatures(CPosXrayList& a_vXPoints, std::vector<Bru
|
|
|
long nCollectCount = (long)a_vXPoints.size();
|
|
|
long nTotalPixelCount = 0;
|
|
|
|
|
|
- SHORT* pixelTimes(new SHORT[nCollectCount]);
|
|
|
+ SHORT* pixelTimes=new SHORT[nCollectCount];
|
|
|
BrukerDll::PFeatureDataList features = new BrukerDll::TFeatureData[nCollectCount];
|
|
|
|
|
|
- /*boost::scoped_array<SHORT*> pixelTimes(new SHORT *[nCollectCount]);
|
|
|
- boost::scoped_array<BrukerDll::TFeatureData> features(new BrukerDll::TFeatureData[nCollectCount]);
|
|
|
- std::vector<BrukerDll::TSegment> extraSegments;*/
|
|
|
|
|
|
for (size_t i = 0; i < nCollectCount; i++)
|
|
|
{
|
|
@@ -2526,7 +2475,8 @@ BOOL COTSBrukerImpl::GetXRayByFeatures(CPosXrayList& a_vXPoints, std::vector<Bru
|
|
|
{
|
|
|
nPixelCount += ofeature.pSegment[j].XCount;
|
|
|
}
|
|
|
- pixelTimes[i] = (SHORT)(ceil((double)a_nACTimeMS * 1000.0 / (double)nPixelCount));
|
|
|
+ SHORT pt= (SHORT)(ceil((double)a_nACTimeMS * 1000.0 / (double)nPixelCount));
|
|
|
+ pixelTimes[i] = pt;
|
|
|
|
|
|
nTotalPixelCount += nPixelCount;
|
|
|
}
|
|
@@ -2535,21 +2485,21 @@ BOOL COTSBrukerImpl::GetXRayByFeatures(CPosXrayList& a_vXPoints, std::vector<Bru
|
|
|
// will generate according to the x-ray position
|
|
|
// this shouldn't happen
|
|
|
|
|
|
- //BrukerDll::PFeatureDataList features = new BrukerDll::TFeatureData[nCollectCount];
|
|
|
+
|
|
|
BrukerDll::TSegment* extraSegments=new BrukerDll::TSegment[1];
|
|
|
- //extraSegments.push_back(BrukerDll::TSegment());
|
|
|
+
|
|
|
extraSegments[0].XStart = a_vXPoints[i]->GetPosition().x;
|
|
|
extraSegments[0].Y = a_vXPoints[i]->GetPosition().y;
|
|
|
extraSegments[0].XCount = 1;
|
|
|
features[i].SegmentCount = 1;
|
|
|
- features[i].Segments = &extraSegments[0];
|
|
|
+ features[i].Segments = extraSegments;
|
|
|
pixelTimes[i] = (SHORT)(a_nACTimeMS * 1000);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// ask bruker to collect a set of x-ray data
|
|
|
- if (BrukerDll::StartFeatureListMeasurement(m_nClientID, m_nSPU, nCollectCount, features, &pixelTimes) != 0)
|
|
|
+ if (BrukerDll::StartFeatureListMeasurement(m_nClientID, m_nSPU, nCollectCount, features, pixelTimes) != 0)
|
|
|
{
|
|
|
LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::StartFeatureListMeasurement:Call StartFeatureListMeasurement failed: client id is %d"), m_nClientID);
|
|
|
return FALSE;
|
|
@@ -2596,7 +2546,7 @@ BOOL COTSBrukerImpl::SetXRayPointsByFeature(CPosXrayList& a_vXPoints, const DWOR
|
|
|
memset(cResult, 0, 10000);
|
|
|
if (BrukerDll::QuantifyFeatureListSpectrum(m_nClientID, index, pcMethod, pcParams, cResult, 10000, (BrukerDll::PRTSpectrumHeaderRec)m_psRTSpectrumBuffer.get(), (int)BRUKER_PARAM::RT_SPECTRUM_BUFFER_SIZE) != 0)
|
|
|
{
|
|
|
- LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::SetXRayPoints failed to call QuantifyPointListSpectrum method, error code %d"), -1);
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::SetXRayPointsByFeature failed to call QuantifyFeatureListSpectrum method, error code %d"), -1);
|
|
|
//return FALSE;
|
|
|
}
|
|
|
|