OTSOxfordImpl.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 DisConnect();
  33. bool IsConnected();
  34. bool GetPositionXY(double& a_dPosX, double& a_dPosY);
  35. bool SetPositionXY(double a_dPosX, double a_dPosY);
  36. bool GetWorkingDistance(double& a_dWorkingDistance);
  37. bool SetWorkingDistance(double a_dWorkingDistance);
  38. bool GetMagnification(double& a_dMagnification);
  39. bool SetMagnification(double a_dMagnification);
  40. bool GetHighVoltage(double& a_dHighVoltage);
  41. bool SetHighVoltage(double a_dHighVoltage);
  42. bool GetBeamOn(bool& a_bBeamOn);
  43. bool SetBeamOn(bool a_bBeamOn);
  44. bool GetBeamBlank(bool& a_bBeamBlank);
  45. bool SetBeamBlank(bool a_bBeamBlank);
  46. bool GetExternal(bool& a_bExternal);
  47. bool SetExternal(bool a_bExternal);
  48. bool CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
  49. bool CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
  50. bool SetBeamPosition(const double a_dPosX, const double a_dPosY);
  51. bool SetScanSpeed(const long a_nMilliseconds);
  52. bool GetImageSize(long& a_nWidth, long& a_nHeight);
  53. bool SetImageSize(const long a_nWidth, const long a_nHeight);
  54. bool CollectImage(BYTE* a_pImageBits);
  55. bool QuantifySpectrum(unsigned char* cResult);
  56. // if do x-ray quantification
  57. BOOL GetQuantificationFlag() { return m_bDoQuantification; }
  58. void SetQuantificationFlag(BOOL a_bDoQuantification) { m_bDoQuantification = a_bDoQuantification; }
  59. // m_bDoQuantification should be set first.
  60. BOOL GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS);
  61. BOOL GetXRayByFeatures(CPosXraysList&a_listXRayPoints, std::vector<BrukerFeature>& a_vFeatures, DWORD a_nXRayAQTime);
  62. protected:
  63. void CloseClient(void);//there's no need to call from out ,the single instance destruction method will call it automatically.
  64. std::shared_ptr<OxfordController> m_oxfordPtr;
  65. bool m_bInit; // initialize flag
  66. BOOL m_bDoQuantification; // if do x-ray quantification
  67. };
  68. //typedef boost::scoped_array<OxfordXrayData> featureData;
  69. } // namespace Controller