|
@@ -47,10 +47,6 @@ namespace OTSController {
|
|
|
LogTrace(__FILE__, __LINE__, _T("Bruker Implement Controller released."));
|
|
|
}
|
|
|
|
|
|
- // COTSBrukerImpl methods
|
|
|
-
|
|
|
- // public
|
|
|
-
|
|
|
// initialization
|
|
|
BOOL COTSBrukerImpl::Init(CONTROL_TYPE a_nControlType, BOOL a_b32Bite /*=TRUE*/)
|
|
|
{
|
|
@@ -65,18 +61,24 @@ namespace OTSController {
|
|
|
|
|
|
// load Bruker client dll name succeed
|
|
|
LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::Init: bruker client dll name: %s"), strBruckerDllName);
|
|
|
-
|
|
|
- m_bInit = BrukerDll::LoadEspritAPI((_T("OTSCPPDll\\") + strBruckerDllName).GetBuffer());
|
|
|
+ CString path;
|
|
|
+ GetModuleFileName(NULL, path.GetBufferSetLength(MAX_PATH + 1), MAX_PATH);
|
|
|
+ path.ReleaseBuffer();
|
|
|
+ int pos = path.ReverseFind('\\');
|
|
|
+ path = path.Left(pos);
|
|
|
+ SetDllDirectory(path + _T("\\OTSCPPDll\\"));//make sure to load the dll in this directory
|
|
|
+
|
|
|
+ m_bInit = BrukerDll::LoadEspritAPI( strBruckerDllName.GetBuffer());
|
|
|
// load Bruker client dll OK?
|
|
|
if (!m_bInit)
|
|
|
{
|
|
|
// failed to load bruker client dll
|
|
|
AfxMessageBox(_T("cann't load Bruker dll£¡ name:" + strBruckerDllName));
|
|
|
LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::Init: failed to load Bruker Client Dll , Dll Name: %s"), strBruckerDllName);
|
|
|
- //exit(0);
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
+ SetDllDirectory(NULL);// recover the default search path.
|
|
|
|
|
|
}
|
|
|
|
|
@@ -687,7 +689,6 @@ namespace OTSController {
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
- // ok. return TRUE
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
@@ -760,7 +761,7 @@ namespace OTSController {
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
- // ok. return TRUE
|
|
|
+
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
@@ -796,170 +797,10 @@ namespace OTSController {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // ok. return TRUE
|
|
|
+
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //BOOL COTSBrukerImpl::CollectXRayPoints(CPosXrayList& a_listXrayPois, DWORD a_nACTimeMS)
|
|
|
- //{
|
|
|
-
|
|
|
- // // do nothing if points list is empty
|
|
|
- // if (a_listXrayPois.empty())
|
|
|
- // {
|
|
|
- // // points list is empty
|
|
|
- // LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPoints: poits list is empty."));
|
|
|
- // return TRUE;
|
|
|
- // }
|
|
|
-
|
|
|
- // // turn SEM to external
|
|
|
- // if (!SetSEMExternalOn())
|
|
|
- // {
|
|
|
- // // failed to call SetSEMExternalOn method
|
|
|
- // LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPoints: failed to call SetSEMExternalOn method."));
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
-
|
|
|
- // // create array of BrukerSegment
|
|
|
- // long nCollectCount = (long)a_listXrayPois.size();
|
|
|
-
|
|
|
- // boost::scoped_array<BrukerDll::TSegment> segmentArray(new BrukerDll::TSegment[nCollectCount]);
|
|
|
-
|
|
|
- // for (int i = 0; i < nCollectCount; ++i)
|
|
|
- // {
|
|
|
- // CPoint poi = a_listXrayPois[i]->GetPosition();
|
|
|
- // segmentArray[i].Y = poi.y;
|
|
|
- // segmentArray[i].XStart = poi.x;
|
|
|
- // segmentArray[i].XCount = 1;
|
|
|
- // }
|
|
|
-
|
|
|
- // // ask bruker to collect a set of x ray data
|
|
|
- // //if (!StartPointListMeasurement(nCollectCount, segmentArray, a_nACTimeMS))
|
|
|
- // //{
|
|
|
- // // // failed to call StartPointListMeasurement method
|
|
|
- // // LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPoints: failed to call StartPointListMeasurement method."));
|
|
|
- // // return FALSE;
|
|
|
- // //}
|
|
|
- // if (BrukerDll::StartPointListMeasurement(m_nClientID, m_nSPU, nCollectCount, segmentArray, a_nACTimeMS) != 0)
|
|
|
- // {
|
|
|
- // LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::StartFeatureListMeasurement:Call StartFeatureListMeasurement failed: client id is %d"), m_nClientID);
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
- // // get the specs for a_listXrayPois
|
|
|
- // if (!ReadXRayPoints(a_listXrayPois, a_nACTimeMS))
|
|
|
- // {
|
|
|
- // // failed to call ReadXRayPoints method
|
|
|
- // LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPoints: failed to call ReadXRayPoints method."));
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
- //
|
|
|
- // return TRUE;
|
|
|
- //}
|
|
|
- // collect x ray points (area scan)
|
|
|
- //BOOL COTSBrukerImpl::CollectXRayPointsByFeatures(std::vector<CPosXray*>& a_vXPoints, std::vector<BrukerFeature>& a_vFeatures, DWORD a_nACTimeMS)
|
|
|
- //{
|
|
|
-
|
|
|
- // // do nothing if points list is empty
|
|
|
- // if (a_vXPoints.empty())
|
|
|
- // {
|
|
|
- // // points list is empty
|
|
|
- // LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: poits list is empty."));
|
|
|
- // return TRUE;
|
|
|
- // }
|
|
|
-
|
|
|
- // // lists size check
|
|
|
- // if (a_vXPoints.size() != a_vFeatures.size())
|
|
|
- // {
|
|
|
- // LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures:Feature size(%d) doesn't match xray point size(%d)"), a_vFeatures.size(), a_vXPoints.size());
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
-
|
|
|
- // // set SEM to external
|
|
|
- // if (!SetSEMExternalOn())
|
|
|
- // {
|
|
|
- // // failed to call SetSEMExternalOn method
|
|
|
- // LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: failed to call SetSEMExternalOn method."));
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
-
|
|
|
- // // create array of BrukerSegment
|
|
|
- // long nCollectCount = (long)a_vXPoints.size();
|
|
|
- // long nTotalPixelCount = 0;
|
|
|
-
|
|
|
-
|
|
|
- // SHORT* pixelTimes=new SHORT[nCollectCount];
|
|
|
- // BrukerDll::TFeatureData* features=new BrukerDll::TFeatureData[nCollectCount];
|
|
|
-
|
|
|
-
|
|
|
- // std::vector<BrukerDll::TSegment> extraSegments;
|
|
|
- // for (size_t i = 0; i < a_vXPoints.size(); i++)
|
|
|
- // {
|
|
|
- // features[i].SegmentCount = (long)a_vFeatures[i].SegmentCount;
|
|
|
- // if (features[i].SegmentCount > 0)
|
|
|
- // {
|
|
|
- // int segCount = features[i].SegmentCount;
|
|
|
- // auto ofeature = a_vFeatures[i];
|
|
|
- // features->Segments = new BrukerDll::TSegment[segCount];
|
|
|
- // for (int j = 0; j < segCount; j++)
|
|
|
- // {
|
|
|
- // features->Segments[j].XStart = ofeature.pSegment[j].XStart;
|
|
|
- // features->Segments[j].XCount = ofeature.pSegment[j].XCount;
|
|
|
- // features->Segments[j].Y = ofeature.pSegment[j].Y;
|
|
|
- // }
|
|
|
- //
|
|
|
- // //features[i].Segments = &a_vFeatures[i].pSegment;
|
|
|
-
|
|
|
- // // calculate pixel time
|
|
|
- // int nPixelCount = 0;
|
|
|
- // for (int j = 0; j < features[i].SegmentCount; j++)
|
|
|
- // {
|
|
|
- // nPixelCount += features[i].Segments[j].XCount;
|
|
|
- // }
|
|
|
- // //SHORT pt= (SHORT)(a_nACTimeMS * 1000 / nPixelCount);
|
|
|
- // pixelTimes[i] = (SHORT)(a_nACTimeMS * 1000 / nPixelCount);
|
|
|
- // nTotalPixelCount += nPixelCount;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // // will generate according to the x-ray position
|
|
|
- // // this shouldn't happen
|
|
|
- // extraSegments.push_back(BrukerDll::TSegment());
|
|
|
- // extraSegments[extraSegments.size() - 1].XStart = a_vXPoints[i]->GetPosition().x;
|
|
|
- // extraSegments[extraSegments.size() - 1].Y = a_vXPoints[i]->GetPosition().y;
|
|
|
- // features[i].SegmentCount = 1;
|
|
|
- // features[i].Segments = &extraSegments[extraSegments.size() - 1];
|
|
|
- // //SHORT pt = (SHORT)(a_nACTimeMS * 1000);
|
|
|
- // pixelTimes[i] = (SHORT)(a_nACTimeMS * 1000);
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // // ask bruker to collect a set of x-ray data
|
|
|
-
|
|
|
- // //if (!StartFeatureListMeasurement(nCollectCount, features.get(), pixelTimes.get()))
|
|
|
- // //{
|
|
|
- // // // failed to call StartFeatureListMeasurement method
|
|
|
- // // LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: failed to call StartFeatureListMeasurement method."));
|
|
|
- // // return FALSE;
|
|
|
- // //}
|
|
|
- // 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;
|
|
|
- // }
|
|
|
-
|
|
|
- // // get the specs for a_vXPoints
|
|
|
- // if (!ReadXRayPointsByFeature(a_vXPoints, a_nACTimeMS))
|
|
|
- // {
|
|
|
- // // failed to call ReadXRayPointsByFeature method
|
|
|
- // LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: failed to call ReadXRayPointsByFeature method."));
|
|
|
- // return FALSE;
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
- // return TRUE;
|
|
|
- //}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
BOOL COTSBrukerImpl::ReadXRayPoints(CPosXrayList& a_listXrayPois, const DWORD a_nACTimeMS)
|
|
|
{
|