OTSOxfordImpl.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. #include "..\OTSControl\OTSSingleton.h"
  3. // Load ClientDll
  4. #include "..\OTSControl\Oxford\OxfordImplConst.h"
  5. #include "otsdataconst.h"
  6. #include "Element.h"
  7. #include "BSEImg.h"
  8. #include "PosXray.h"
  9. #include "OTSFeature.h"
  10. //#include "boost\type_traits\is_floating_point.hpp"
  11. #include "boost\noncopyable.hpp"
  12. #include "OxfordWrapper\OxfordController.h"
  13. #include <Bruker\OTSBrukerImpl_const.h>
  14. namespace OTSController
  15. {
  16. using namespace OTSDATA;
  17. typedef enum class __declspec(dllexport) OXFORD_PARAM
  18. {
  19. BUF_LENGTH = 1024,
  20. MAX_SEGMENTS = 8192,
  21. MAX_PIXEL_MICROSECONDS = 32000,
  22. RT_SPECTRUM_BUFFER_SIZE = 64000, // SpectrumBufferSize
  23. RT_SPECTRUM_CHANNELS = 2000, // XANA_CHANNELS = 2000,
  24. RT_SPECTRUM_CHANNELS_LONG = 3000 // RT_SPECTRUM_CHANNELS_LONG = 3000,
  25. } OXFORD_PARAM;
  26. class OxfordImpl : public Singleton<OxfordImpl>, public boost::noncopyable
  27. {
  28. public:
  29. OxfordImpl(void);
  30. ~OxfordImpl(void);
  31. bool Connect();
  32. bool IsConnected();
  33. bool GetPositionXY(double& a_dPosX, double& a_dPosY);
  34. bool SetPositionXY(double a_dPosX, double a_dPosY);
  35. bool GetWorkingDistance(double& a_dWorkingDistance);
  36. bool SetWorkingDistance(double a_dWorkingDistance);
  37. bool GetMagnification(double& a_dMagnification);
  38. bool SetMagnification(double a_dMagnification);
  39. bool GetHighVoltage(double& a_dHighVoltage);
  40. bool SetHighVoltage(double a_dHighVoltage);
  41. bool GetBeamOn(bool& a_bBeamOn);
  42. bool SetBeamOn(bool a_bBeamOn);
  43. bool GetBeamBlank(bool& a_bBeamBlank);
  44. bool SetBeamBlank(bool a_bBeamBlank);
  45. bool GetExternal(bool& a_bExternal);
  46. bool SetExternal(bool a_bExternal);
  47. bool CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
  48. bool CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
  49. bool SetBeamPosition(const double a_dPosX, const double a_dPosY);
  50. bool SetScanSpeed(const long a_nMilliseconds);
  51. bool GetImageSize(long& a_nWidth, long& a_nHeight);
  52. bool SetImageSize(const long a_nWidth, const long a_nHeight);
  53. bool CollectImage(BYTE* a_pImageBits);
  54. bool QuantifySpectrum(unsigned char* cResult);
  55. // if do x-ray quantification
  56. BOOL GetQuantificationFlag() { return m_bDoQuantification; }
  57. void SetQuantificationFlag(BOOL a_bDoQuantification) { m_bDoQuantification = a_bDoQuantification; }
  58. // m_bDoQuantification should be set first.
  59. BOOL GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS);
  60. BOOL GetXRayByFeatures(CPosXraysList&a_listXRayPoints, std::vector<std::vector<BrukerSegment>>& a_vFeatures, DWORD a_nXRayAQTime);
  61. protected:
  62. void CloseClient(void);//there's no need to call from out ,the single instance destruction method will call it automatically.
  63. std::shared_ptr<OxfordController> m_oxfordPtr;
  64. bool m_bInit; // initialize flag
  65. BOOL m_bDoQuantification; // if do x-ray quantification
  66. };
  67. //typedef boost::scoped_array<OxfordXrayData> featureData;
  68. } // namespace Controller