OTSEDSOxford.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. #include "stdafx.h"
  2. #include "OTSEDSOxford.h"
  3. #ifdef _DEBUG
  4. #define new DEBUG_NEW
  5. #endif
  6. namespace OTSController
  7. {
  8. COTSEDSOxford::COTSEDSOxford(void)
  9. {
  10. m_oxfordImpl = OxfordImpl::GetInstance();
  11. }
  12. COTSEDSOxford::~COTSEDSOxford(void)
  13. {
  14. }
  15. // initialisation
  16. BOOL COTSEDSOxford::Init()
  17. {
  18. BOOL ifconnect=true;
  19. if (!m_oxfordImpl->IsConnected())
  20. {
  21. ifconnect=m_oxfordImpl->Connect();
  22. }
  23. return ifconnect;
  24. }
  25. BOOL COTSEDSOxford::CollectSpectrum(DWORD a_nMilliseconds)
  26. {
  27. if (!m_oxfordImpl->CollectXrayData(a_nMilliseconds, (long* )m_nRayData, (DWORD)EDSConst::XANA_CHANNELS))
  28. {
  29. LogErrorTrace(__FILE__, __LINE__, _T("Collect spectrum at %d milliseconds failed."), a_nMilliseconds);
  30. ASSERT(m_oxfordImpl);
  31. if (!m_oxfordImpl)
  32. {
  33. return FALSE;
  34. }
  35. }
  36. // return method return flag
  37. return true;
  38. }
  39. BOOL COTSEDSOxford::CollectSpectrum(DWORD a_nMilliseconds, const CPoint& a_oPoint)
  40. {
  41. if (!m_oxfordImpl->CollectXrayDataAtPos(a_oPoint.x, a_oPoint.y, a_nMilliseconds, (long*)m_nRayData, (DWORD)EDSConst::XANA_CHANNELS))
  42. {
  43. LogErrorTrace(__FILE__, __LINE__, _T("Collect spectrum at %d milliseconds failed."), a_nMilliseconds);
  44. ASSERT(m_oxfordImpl);
  45. if (!m_oxfordImpl)
  46. {
  47. return FALSE;
  48. }
  49. }
  50. return true;
  51. }
  52. BOOL COTSEDSOxford::CollectSpectrum(DWORD a_nMilliseconds, long* a_pCounts, DWORD a_nBufferSize)
  53. {
  54. if (!m_oxfordImpl->CollectXrayData(a_nMilliseconds, a_pCounts, a_nBufferSize))
  55. {
  56. LogErrorTrace(__FILE__, __LINE__, _T("Collect spectrum at %d milliseconds failed."), a_nMilliseconds);
  57. ASSERT(m_oxfordImpl);
  58. if (!m_oxfordImpl)
  59. {
  60. return FALSE;
  61. }
  62. }
  63. // return method return flag
  64. return true;
  65. }
  66. BOOL COTSEDSOxford::GetXRayByPoints(std::vector<CPosXrayPtr>& a_vXRayPoints, const DWORD a_nXRayAQTime)
  67. {
  68. // collect x-ray points (point scan)
  69. if (!m_oxfordImpl->GetXRayByPoints(a_vXRayPoints, a_nXRayAQTime))
  70. {
  71. // failed to call Oxford controller CollectXRayPoints method.
  72. LogErrorTrace(__FILE__, __LINE__, _T("COTSEDSOxford::CollectXRayPoints: failed to call Oxford controller CollectXRayPoints method."));
  73. //return FALSE;
  74. }
  75. // ok, return TRUE
  76. return TRUE;
  77. }
  78. BOOL COTSEDSOxford::GetXRayByFeatures(std::vector<CPosXrayPtr>& a_listXRayPoints,
  79. std::vector<BrukerFeature>& a_listFeatures,
  80. const DWORD a_nXRayAQTime)
  81. {
  82. // collect x-Ray points (area scan)
  83. if (!m_oxfordImpl->GetXRayByFeatures(a_listXRayPoints, a_listFeatures, a_nXRayAQTime))
  84. {
  85. // failed to call oxford controller CollectXRayPointsByFeatures method.
  86. LogErrorTrace(__FILE__, __LINE__, _T("COTSEDSOxford::CollectXRayPointsByFeatures: failed to call Oxford controller CollectXRayPointsByFeatures method."));
  87. return FALSE;
  88. }
  89. // ok, return TRUE
  90. return TRUE;
  91. }
  92. BOOL COTSEDSOxford::StopXrayAcquistion()
  93. {
  94. return m_oxfordImpl->StopCollectXrayData();
  95. }
  96. // Quatification
  97. void COTSEDSOxford::SetQuantification(BOOL a_bQuantification)
  98. {
  99. m_oxfordImpl->SetQuantificationFlag(a_bQuantification);
  100. }
  101. BOOL COTSEDSOxford::GetQuantification()
  102. {
  103. return m_oxfordImpl->GetQuantificationFlag();
  104. //return FALSE;
  105. }
  106. // Get number of channels
  107. DWORD COTSEDSOxford::GetNumberOfChannels(void)
  108. {
  109. return (DWORD)2000;
  110. }
  111. // Get the x-Ray data
  112. DWORD* COTSEDSOxford::GetXRayData()
  113. {
  114. return m_nRayData;
  115. }
  116. BOOL COTSEDSOxford::IsSupportQuantification()
  117. {
  118. return TRUE;
  119. }
  120. BOOL COTSEDSOxford::GetQuantificationMethods(std::vector<CString>& a_vMethods)
  121. {
  122. //return m_oxfordImpl->GetQuantificationMethods(a_vMethods);
  123. return FALSE;
  124. }
  125. BOOL COTSEDSOxford::QuantifyXrayPoint(CPosXray* a_pXRayPoint, LPCTSTR a_sMethodName)
  126. {
  127. //return m_oxfordImpl->QuantifyXrayPoint(a_pXRayPoint, a_sMethodName);
  128. return FALSE;
  129. }
  130. BOOL COTSEDSOxford::QuantifySpectrumFile(LPCTSTR a_sFilePathName, LPCTSTR a_sMethodName, CElementChemistriesList& a_listElementChemistry)
  131. {
  132. return FALSE;
  133. //return m_oxfordImpl->QuantifySpectrumFile(a_sFilePathName, a_sMethodName, a_listElementChemistry);
  134. }
  135. BOOL COTSEDSOxford::QuantifySpectrumOut(DWORD a_nMilliseconds, long* a_pCounts, DWORD a_nBufferSize, CElementChemistriesList& a_listElementChemistry)
  136. {
  137. return FALSE;
  138. //return m_oxfordImpl->QuantifySpectrumOut(a_nMilliseconds, a_pCounts, a_nBufferSize, a_listElementChemistry);
  139. }
  140. }
  141. // namespace Controller