CoxmEDSController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using FEIApiControl;
  2. using OTSCLRINTERFACE;
  3. using OTSModelSharp.ServiceCenter;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using NSDLL_CLR;
  10. namespace OTSMeasureApp.ServiceCenter.Coxm
  11. {
  12. class CoxmEDSController : IEDSController
  13. {
  14. public static int imgwidth=800;
  15. public static int imgheight = 600;
  16. private IEDSController m_eds;
  17. static string eds_deviceType = "Bruker";//"Oxford" "FEI"
  18. NSRestClient m_coxm_api;
  19. public CoxmEDSController(string SemType,string deviceType, int imgwidth, int imgheight ,int expectcount, bool ifautoid, string knownelements)
  20. {
  21. eds_deviceType = deviceType;
  22. CoxmEDSController.imgwidth = imgwidth;
  23. CoxmEDSController.imgheight = imgheight;
  24. //get eds
  25. switch (deviceType)
  26. {
  27. case "Oxford":
  28. m_eds = new OxfordEDSController(expectcount, ifautoid, knownelements);
  29. break;
  30. case "Bruker":
  31. {
  32. var ctrl = new EDSController("Bruker", expectcount, ifautoid, knownelements);
  33. //var delayQuant = Convert.ToBoolean(FileHelper.GetIfDelayQuantify());
  34. var delayQuant = false;//Now it has proved that this method won't increase the speed of xray analysis.So deactivate it here.
  35. ctrl.delayQuant = delayQuant;
  36. m_eds = ctrl;
  37. }
  38. break;
  39. default:
  40. m_eds = new EDSController("OffLine", expectcount, ifautoid, knownelements);
  41. break;
  42. }
  43. m_coxm_api = CoxmSemController.GetApiClassInstance();
  44. }
  45. public bool CollectSpectrum(uint a_nXRayAQTime, ref uint[] a_XrayData)
  46. {
  47. return m_eds.CollectSpectrum( a_nXRayAQTime, ref a_XrayData);
  48. }
  49. public bool Connect()
  50. {
  51. m_coxm_api.ServerConnect();
  52. if(m_coxm_api.IsServerConnectStatus())
  53. {
  54. return false;
  55. }
  56. return m_eds.Connect();
  57. }
  58. public EDSTYPE GetEDSType()
  59. {
  60. return EDSTYPE.COXM;
  61. }
  62. public int GetExpectCount()
  63. {
  64. return m_eds.GetExpectCount();
  65. }
  66. public bool GetIfDelayQuantify()
  67. {
  68. return m_eds.GetIfDelayQuantify();
  69. }
  70. public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
  71. {
  72. return m_eds.GetXRayByFeatures( a_listParticles, a_nXRayAQTime, a_bElementInfo);
  73. }
  74. public bool GetXRayByParts(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
  75. {
  76. return m_eds.GetXRayByParts( a_listParticles, a_nXRayAQTime, a_bElementInfo);
  77. }
  78. public bool QuantifyXrayByPart(COTSParticleClr part)
  79. {
  80. return m_eds.QuantifyXrayByPart( part);
  81. }
  82. public void SetFilterKeyEleNames(List<string> KeyNameList)
  83. {
  84. m_eds.SetFilterKeyEleNames(KeyNameList);
  85. }
  86. public void SetResolution(int resolutionWidth, int resolutionHeight)
  87. {
  88. imgwidth= resolutionWidth;
  89. imgheight= resolutionHeight;
  90. m_eds.SetResolution(resolutionWidth, resolutionHeight);
  91. }
  92. bool IEDSController.GetXRayByExpandFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
  93. {
  94. return m_eds.GetXRayByExpandFeatures( a_listParticles, a_nXRayAQTime, a_bElementInfo);
  95. }
  96. void IEDSController.SetQuantifiCationParam(bool IfAutoId, string knownElements)
  97. {
  98. m_eds.SetQuantifiCationParam(IfAutoId, knownElements);
  99. }
  100. }
  101. }