OTSControlFunExport.h 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624
  1. #pragma once
  2. /**
  3. @file
  4. @brief OTSControl DLL Interface provide for C#
  5. @author xiaoxing.zhang,Anna Hao
  6. @version 1.0.0.0
  7. @date 2017/6/28
  8. - 2017/6/28 1.0.0.0 xiaoxing.zhang developed SEM Interface
  9. - 2017/6/28 1.0.0.0 Anna Hao developed Scan Interface
  10. - 2017/6/29 1.0.0.0 Anna Hao developed EDS Interface
  11. - - 2017/7/3 1.0.0.0 xiaoxing.zhang Add log for SemInterface
  12. */
  13. #include "BSEImg.h"
  14. #include "COTSHardwareMgr.h"
  15. #include "Bruker/OTSBrukerImpl_const.h"
  16. using namespace System;
  17. using namespace System::Drawing;
  18. const CString g_LogName = "_OTSControl";
  19. CString g_cstLogData = "";
  20. namespace NSOTSController
  21. {
  22. using namespace OTSController;
  23. public ref class COTSSimuControlClr
  24. {
  25. public:
  26. COTSSimuControlClr();
  27. ~COTSSimuControlClr();
  28. !COTSSimuControlClr();
  29. public:
  30. bool Connect();
  31. bool Disconnect();
  32. bool SetWorkingDistance(double a_dWorkingDistance);
  33. bool GetWorkingDistance(double% a_dWorkingDistance);
  34. bool SetMagnification(double a_dMag);
  35. bool GetMagnification(double% a_dMag);
  36. };
  37. public ref class COTSControlFunExport
  38. {
  39. public:
  40. COTSControlFunExport(String^ cstLogName)
  41. {
  42. // CString stLogName = cstLogName+g_LogName;
  43. m_LpHardWareMgr = NULL;
  44. m_LpSemBase = NULL;
  45. m_LpScanBase = NULL;
  46. m_LpEDSBase = NULL;
  47. this->InitDevPoint();
  48. LogInfoTrace(__FILE__, __LINE__, "***************** Init OTSContrll ***************");
  49. }
  50. ~COTSControlFunExport()
  51. {
  52. if (nullptr != m_LpHardWareMgr)
  53. {
  54. delete m_LpHardWareMgr;
  55. m_LpHardWareMgr = nullptr;
  56. }
  57. }
  58. !COTSControlFunExport()
  59. {
  60. if (nullptr != m_LpHardWareMgr)
  61. {
  62. delete m_LpHardWareMgr;
  63. m_LpHardWareMgr = nullptr;
  64. }
  65. }
  66. public:
  67. void InitDevPoint();
  68. //获取当前电镜的ID号
  69. int GetSemType()
  70. {
  71. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemType ***************");
  72. int ID = 0;
  73. ID = (int)m_LpSemBase->GetType();
  74. //log
  75. LogTrace(__FILE__, __LINE__, " GetSemType(), ID = %d ", ID);
  76. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&& Exit GetSemType ***************");
  77. return ID;
  78. }
  79. //和电镜建立通讯连接
  80. bool ConncetSem()
  81. {
  82. LogInfoTrace(__FILE__, __LINE__, "***************** Enter ConncetSem ***************");
  83. BOOL bRev = m_LpSemBase->Connect();
  84. //log
  85. LogInfoTrace(__FILE__, __LINE__, "ConncetSem(), bRev = %d", bRev);
  86. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit ConncetSem &&&&&&&&&&&&&&&&");
  87. return bRev;
  88. }
  89. //断开电镜连接
  90. bool DisConnectSem()
  91. {
  92. LogInfoTrace(__FILE__, __LINE__, "***************** Enter DisConnectSem ***************");
  93. BOOL bRev = m_LpSemBase->Disconnect();
  94. LogInfoTrace(__FILE__, __LINE__, "DisConnectSem(), bRev = %d", bRev);
  95. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit DisConnectSem &&&&&&&&&&&&&&&&");
  96. return bRev;
  97. }
  98. //获得扫描区域大小
  99. Size GetSemScanField100()
  100. {
  101. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemScanField100 ***************");
  102. Size sz;
  103. CSize size = m_LpSemBase->GetScanField100();
  104. sz.Width = size.cx;
  105. sz.Height = size.cy;
  106. LogTrace(__FILE__, __LINE__, "GetSemScanField100(), CSize.x = %d, CSize.y = %d", size.cx, size.cx);
  107. LogInfoTrace(__FILE__, __LINE__, " &&&&&&&&&&&&&&&&&& Exit GetSemScanField100 &&&&&&&&&&&&&&&& ");
  108. return sz;
  109. }
  110. //设置扫描区域大小
  111. void SetSemScanField100(Size sz)
  112. {
  113. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemScanField100 ***************");
  114. LogTrace(__FILE__, __LINE__, "SetSemScanField100(sz.x = %d, sz.y = %d)", sz.Width, sz.Height);
  115. CSize size;
  116. size.cx = sz.Width;
  117. size.cy = sz.Height;
  118. m_LpSemBase->SetScanField100(size);
  119. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemScanField100 &&&&&&&&&&&&&&&& ");
  120. }
  121. bool GetSemBeamBlank(long% a_nBeamBlank)
  122. {
  123. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemBeamBlank ***************");
  124. long lBBlank = 0;
  125. BOOL bRev = m_LpSemBase->GetBeamBlank(lBBlank);
  126. a_nBeamBlank = lBBlank;
  127. LogTrace(__FILE__, __LINE__, "GetSemBeamBlank(long a_nBeamBlank = %f)", a_nBeamBlank);
  128. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemBeamBlank &&&&&&&&&&&&&&&&");
  129. return bRev;
  130. }
  131. bool SetSemBeamBlank(long a_nBeamBlank)
  132. {
  133. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemBeamBlank ***************");
  134. LogInfoTrace(__FILE__, __LINE__, "SetSemBeamBlank(long a_nBeamBlank = %f)", a_nBeamBlank);
  135. BOOL bRev = m_LpSemBase->SetBeamBlank(a_nBeamBlank);
  136. LogTrace(__FILE__, __LINE__, "COTSControlFunExport::SetSemBeamBlank(long a_nBeamBlank = %f) ) bRev = %d ", a_nBeamBlank, bRev);
  137. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemBeamBlank &&&&&&&&&&&&&&&&");
  138. return bRev;
  139. }
  140. //获得亮度
  141. bool GetSemBrightness(double% a_dBrightness)
  142. {
  143. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemBrightness ***************");
  144. double dBriness = 0;
  145. BOOL bRev = m_LpSemBase->GetBrightness(dBriness);
  146. a_dBrightness = dBriness;
  147. LogTrace(__FILE__, __LINE__, "GetSemBrightness(double a_dBrightness = %f)", a_dBrightness);
  148. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemBrightness &&&&&&&&&&&&&&&&");
  149. return bRev;
  150. }
  151. //设置亮度
  152. bool SetSemBrightness(double a_dBrightness)
  153. {
  154. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemBrightness ***************");
  155. LogTrace(__FILE__, __LINE__, "SetSemBrightness(double a_dBrightness = %f)", a_dBrightness);
  156. BOOL bRev = m_LpSemBase->SetBrightness(a_dBrightness);
  157. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemBeamBlank &&&&&&&&&&&&&&&&");
  158. return bRev;
  159. }
  160. //获得对比度
  161. bool GetSemContrast(double% a_dContrast)
  162. {
  163. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemContrast ***************");
  164. double dContrast = 0;
  165. BOOL bRev = m_LpSemBase->GetContrast(dContrast);
  166. a_dContrast = dContrast;
  167. LogTrace(__FILE__, __LINE__, "GetSemContrast(double a_dContrast = %f)", a_dContrast);
  168. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemContrast &&&&&&&&&&&&&&&&");
  169. return bRev;
  170. }
  171. //设置对比度
  172. bool SetSemContrast(double a_dContrast)
  173. {
  174. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemContrast ***************");
  175. LogTrace(__FILE__, __LINE__, "SetSemContrast(double a_dContrast = %f)", a_dContrast);
  176. BOOL bRev = m_LpSemBase->SetContrast(a_dContrast);
  177. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemContrast &&&&&&&&&&&");
  178. return bRev;
  179. }
  180. //获得Z轴的工作距离
  181. bool GetSemWorkingDistance(double% a_dWorkingDistance)
  182. {
  183. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemWorkingDistance ***************");
  184. double dWDistance = 0;
  185. BOOL bRev = m_LpSemBase->GetWorkingDistance(dWDistance);
  186. a_dWorkingDistance = dWDistance;
  187. LogTrace(__FILE__, __LINE__, "GetSemWorkingDistance(double a_dWorkingDistance = %f)", a_dWorkingDistance);
  188. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemWorkingDistance &&&&&&&&&&&&&&&&");
  189. return bRev;
  190. }
  191. // 设置Z轴工作距离
  192. bool SetSemWorkingDistance(double a_dWorkingDistance)
  193. {
  194. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemWorkingDistance ***************");
  195. LogTrace(__FILE__, __LINE__, "SetSemWorkingDistance(double a_dWorkingDistance = %f)", a_dWorkingDistance);
  196. BOOL bRev = m_LpSemBase->SetWorkingDistance(a_dWorkingDistance);
  197. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemWorkingDistance &&&&&&&&&&&&&&&&");
  198. return bRev;
  199. }
  200. // 获得电压值
  201. bool GetSemHighTension(double% a_dKV)
  202. {
  203. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemHighTension ***************");
  204. double dDKV = 0;
  205. BOOL bRev = m_LpSemBase->GetHighTension(dDKV);
  206. a_dKV = dDKV;
  207. LogTrace(__FILE__, __LINE__, "GetSemHighTension(double a_dKV = %f)", a_dKV);
  208. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemHighTension &&&&&&&&&&&&&&&&");
  209. return bRev;
  210. }
  211. // 设置电压值
  212. bool SetSemHighTension(double a_dKV)
  213. {
  214. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemHighTension ***************");
  215. LogTrace(__FILE__, __LINE__, "SetSemHighTension(double a_dKV = %f)", a_dKV);
  216. BOOL bRev = m_LpSemBase->SetHighTension(a_dKV);
  217. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemHighTension &&&&&&&&&&&&&&&&");
  218. return bRev;
  219. }
  220. //获得放大倍数
  221. bool GetSemMagnification(double% a_dMagnification)
  222. {
  223. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemMagnification ***************");
  224. double dMagni = 0;
  225. BOOL bRev = m_LpSemBase->GetMagnification(dMagni);
  226. a_dMagnification = dMagni;
  227. LogTrace(__FILE__, __LINE__, "GetSemMagnification(double a_dMagnification = %f)", a_dMagnification);
  228. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemMagnification &&&&&&&&&&&&&&&&");
  229. return bRev;
  230. }
  231. //设置放大倍数
  232. bool SetSemMagnification(double a_dMagnification)
  233. {
  234. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemMagnification ***************");
  235. LogTrace(__FILE__, __LINE__, "SetSemMagnification(double a_dMagnification = %f)", a_dMagnification);
  236. BOOL bRev = m_LpSemBase->SetMagnification(a_dMagnification);
  237. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemMagnification &&&&&&&&&&&&&&&&");
  238. return bRev;
  239. }
  240. //获得扫描区域尺寸
  241. bool GetSemScanFieldSize(double% a_dScanFieldSizeX, double% a_dScanFieldSizeY)
  242. {
  243. LogInfoTrace(__FILE__, __LINE__, "****************** Enter GetSemScanFieldSize ***************");
  244. double dFSizeX = 0;
  245. double dFSizeY = 0;
  246. BOOL bRev = m_LpSemBase->GetScanFieldSize(dFSizeX, dFSizeY);
  247. a_dScanFieldSizeX = dFSizeX;
  248. a_dScanFieldSizeY = dFSizeY;
  249. LogTrace(__FILE__, __LINE__, "GetSemScanFieldSize(double a_dScanFieldSizeX = %f, double a_dScanFieldSizeY = %f", a_dScanFieldSizeX, a_dScanFieldSizeY);
  250. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemScanFieldSize &&&&&&&&&&&&&&&&");
  251. return bRev;
  252. }
  253. //设置扫描区域尺寸
  254. bool SetSemScanFieldSizeX(double a_dScanFieldSizeX)
  255. {
  256. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemScanFieldSizeX ***************");
  257. LogTrace(__FILE__, __LINE__, "SetSemScanFieldSizeX(double a_dScanFieldSizeX = %f)", a_dScanFieldSizeX);
  258. BOOL bRev = m_LpSemBase->SetScanFieldSizeX(a_dScanFieldSizeX);
  259. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemScanFieldSizeX &&&&&&&&&&&&&&&&");
  260. return bRev;
  261. }
  262. bool GetSemHTOnOff(BOOL% a_bHTValue)
  263. {
  264. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemHTOnOff ***************");
  265. BOOL bHTV = FALSE;
  266. BOOL bRev = m_LpSemBase->GetHTOnOff(bHTV);
  267. a_bHTValue = bHTV;
  268. LogTrace(__FILE__, __LINE__, "GetSemHTOnOff(BOOL a_bHTValue = %d)", a_bHTValue);
  269. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemHTOnOff &&&&&&&&&&&&&&&&");
  270. return bRev;
  271. }
  272. bool SetSemHTOnOff(BOOL a_bHTValue)
  273. {
  274. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemHTOnOff ***************");
  275. LogTrace(__FILE__, __LINE__, "SetSemHTOnOff(BOOL a_bHTValue = %d)", a_bHTValue);
  276. BOOL bRev = m_LpSemBase->SetHTOnOff(a_bHTValue);
  277. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemHTOnOff &&&&&&&&&&&&&&&&");
  278. return bRev;
  279. }
  280. //获得电镜位置
  281. bool GetSemPositionXY(double% a_dPositionX, double% a_dPositionY, double% a_dPositionR)
  282. {
  283. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemPositionXY ***************");
  284. double dPosX = 0;
  285. double dPosY = 0;
  286. double dPosR = 0;
  287. BOOL bRev = m_LpSemBase->GetPositionXY(dPosX, dPosY, dPosR);
  288. a_dPositionX = dPosX;
  289. a_dPositionY = dPosY;
  290. a_dPositionR = dPosR;
  291. LogTrace(__FILE__, __LINE__, "GetSemPositionXY(double a_dPositionX = %f, double a_dPositionY = %f, double a_dPositionR = %f)", \
  292. a_dPositionX, a_dPositionY, a_dPositionR);
  293. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemPositionXY &&&&&&&&&&&&&&&&");
  294. return bRev;
  295. }
  296. //设置电镜位置
  297. bool SetSemPositionXY(double a_dPositionX, double a_dPositionY, double a_dPositionR)
  298. {
  299. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemPositionXY ***************");
  300. LogTrace(__FILE__, __LINE__, "SetSemPositionXY(double a_dPositionX = %f, double a_dPositionY = %f, double a_dPositionR = %f)", \
  301. a_dPositionX, a_dPositionY, a_dPositionR);
  302. BOOL bRev = m_LpSemBase->SetPositionXY(a_dPositionX, a_dPositionY, a_dPositionR);
  303. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemPositionXY &&&&&&&&&&&&&&&&");
  304. return bRev;
  305. }
  306. //获得焦点尺寸
  307. bool GetSemSpotSize(double% a_dSpotSize)
  308. {
  309. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemSpotSize ***************");
  310. double dPSize = 0;
  311. BOOL bRev = m_LpSemBase->GetSpotSize(dPSize);
  312. a_dSpotSize = dPSize;
  313. LogTrace(__FILE__, __LINE__, "GetSemSpotSize(double a_dSpotSize = %f)", a_dSpotSize);
  314. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemSpotSize &&&&&&&&&&&&&&&&");
  315. return bRev;
  316. }
  317. //设置焦点尺寸
  318. bool SetSemSpotSize(double a_dSpotSize)
  319. {
  320. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemSpotSize ***************");
  321. LogTrace(__FILE__, __LINE__, "SetSemSpotSize(double a_dSpotSize = %f)", a_dSpotSize);
  322. BOOL bRev = m_LpSemBase->SetSpotSize(a_dSpotSize);
  323. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemSpotSize &&&&&&&&&&&&&&&&");
  324. return bRev;
  325. }
  326. // 获得扫描方式
  327. bool GetSemScanMode(long% a_nScanMode)
  328. {
  329. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemScanMode ***************");
  330. long lSMode = 0;
  331. BOOL bRev = m_LpSemBase->GetScanMode(lSMode);
  332. a_nScanMode = lSMode;
  333. LogTrace(__FILE__, __LINE__, "GetSemScanMode(long a_nScanMode = %d)", a_nScanMode);
  334. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemScanMode &&&&&&&&&&&&&&&&");
  335. return bRev;
  336. }
  337. //设置扫描方式
  338. bool SetSemScanMode(long a_nScanMode)
  339. {
  340. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemScanMode ***************");
  341. LogTrace(__FILE__, __LINE__, "SetSemScanMode(long a_nScanMode = %d)", a_nScanMode);
  342. BOOL bRev = m_LpSemBase->SetScanMode(a_nScanMode);
  343. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemScanMode &&&&&&&&&&&&&&&&");
  344. return bRev;
  345. }
  346. bool SetSemScanExternal(BOOL external)
  347. {
  348. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetSemScanExternal ***************");
  349. LogTrace(__FILE__, __LINE__, "SetSemScanExternal(BOOL external = %d)", external);
  350. BOOL bRev = m_LpSemBase->SetScanExternal(external);
  351. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetSemScanExternal &&&&&&&&&&&&&&&&");
  352. return bRev;
  353. }
  354. int GetSemExternalMode()
  355. {
  356. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetSemExternalMode ***************");
  357. BOOL bRev = m_LpSemBase->GetExternalMode();
  358. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetSemExternalMode &&&&&&&&&&&&&&&&");
  359. return bRev;
  360. }
  361. //移动电镜到指定的位置
  362. bool MoveSEMToPoint(double dPosX, double dPosY, double dRotation)
  363. {
  364. LogInfoTrace(__FILE__, __LINE__, "***************** Enter MoveSEMToPoint ***************");
  365. LogTrace(__FILE__, __LINE__, "MoveSEMToPoint(double dPosX = %f, double dPosY = %f, double dRotation = %f)", \
  366. dPosX,dPosY,dRotation);
  367. double dRota = dRotation;
  368. CPoint cPos;
  369. cPos.x = (LONG)dPosX;
  370. cPos.y = (LONG)dPosY;
  371. BOOL bRev = m_LpSemBase->MoveSEMToPoint(cPos, dRotation);
  372. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit MoveSEMToPoint &&&&&&&&&&&&&&&&");
  373. return bRev;
  374. }
  375. // 释放DLL
  376. void FreeDll()
  377. {
  378. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit FreeDll &&&&&&&&&&&&&&&&");
  379. if (NULL != m_LpHardWareMgr)
  380. {
  381. delete m_LpHardWareMgr;
  382. m_LpHardWareMgr = NULL;
  383. }
  384. }
  385. //EDS Interface
  386. //获取EDS名称
  387. //函数名称:GetEDSName()
  388. //输入参数:无
  389. //输出参数:类型:int,设备ID标识
  390. String^ GetEDSName()
  391. {
  392. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetEDSName ***************");
  393. CString a_str = (m_LpEDSBase->GetName());
  394. String^ strOut = gcnew String(a_str);
  395. LogTrace(__FILE__, __LINE__, _T("GetEDSName return %s"), a_str);
  396. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetEDSName &&&&&&&&&&&&&&&&");
  397. return strOut;
  398. }
  399. //获取EDS类型,Bruker是3.
  400. //函数名称:int EDSGetType()
  401. //输入参数:无
  402. //输出参数:类型:int,设备ID标识
  403. int EDSGetType()
  404. {
  405. LogInfoTrace(__FILE__, __LINE__, "***************** Enter EDSGetType ***************");
  406. int a_type = (int)EDSController::EDS_ID::BRUKER;
  407. LogTrace(__FILE__, __LINE__, _T("EDSGetType return %d"), a_type);
  408. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit EDSGetType &&&&&&&&&&&&&&&&");
  409. return a_type;
  410. }
  411. //EDS进程终止
  412. //函数名称:void EDSFinishedInstance()
  413. //输入参数:无
  414. //输出参数:无
  415. void EDSFinishedInstance()
  416. {
  417. LogInfoTrace(__FILE__, __LINE__, "***************** Enter EDSFinishedInstance ***************");
  418. m_LpEDSBase->FinishedInstance();
  419. LogTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit EDSFinishedInstance &&&&&&&&&&&&&&&&");
  420. }
  421. //EDS初始化
  422. //函数名称:bool EDSInit()
  423. //输入参数:无
  424. //输出参数:类型:bool,true,设备申请成功
  425. // false,设备申请失败
  426. bool EDSInit()
  427. {
  428. LogInfoTrace(__FILE__, __LINE__, "***************** Enter EDSInit ***************");
  429. bool bRet = m_LpEDSBase->Init();
  430. LogTrace(__FILE__, __LINE__, _T("EDSInit return %d"), bRet);
  431. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit EDSInit &&&&&&&&&&&&&&&&");
  432. return bRet;
  433. }
  434. //是否支持Xray采集
  435. //函数名称:bool IsSupportSetCollection()
  436. //输入参数:无
  437. //输出参数:类型:bool,true,支持采集
  438. // false,不支持采集
  439. bool IsSupportSetCollection()
  440. {
  441. LogInfoTrace(__FILE__, __LINE__, "***************** Enter IsSupportSetCollection ***************");
  442. bool bRet = m_LpEDSBase->IsSupportSetCollection();
  443. LogTrace(__FILE__, __LINE__, _T("IsSupportSetCollection return %d"), bRet);
  444. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit IsSupportSetCollection &&&&&&&&&&&&&&&&");
  445. return bRet;
  446. }
  447. bool CollectSpectrum(DWORD a_nMilliseconds, Point a_oPoint, array<long>^% a_XrayData)
  448. {
  449. LogInfoTrace(__FILE__, __LINE__, "***************** Enter CollectSpectrum ***************");
  450. CPoint pt;
  451. pt.x = a_oPoint.X;
  452. pt.y = a_oPoint.Y;
  453. bool bRet = m_LpEDSBase->CollectSpectrum(a_nMilliseconds, pt);
  454. DWORD* xrd;
  455. xrd = m_LpEDSBase->GetXRayData();
  456. /* pin_ptr<long> pi = &a_XrayData[0];
  457. long *pinp = pi;
  458. memcpy(pinp, xrd, (long)EDSConst::XANA_CHANNELS);*/
  459. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  460. {
  461. a_XrayData[i] = xrd[i];
  462. }
  463. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  464. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit CollectSpectrum &&&&&&&&&&&&&&&&");
  465. return bRet;
  466. }
  467. bool CollectSpectrum(DWORD a_nMilliseconds, array<long>^% a_XrayData, DWORD a_nBufferSize)
  468. {
  469. LogInfoTrace(__FILE__, __LINE__, "***************** Enter CollectSpectrum ***************");
  470. long* aData = new long[a_nBufferSize];
  471. memset(aData, 0, a_nBufferSize);
  472. bool bRet = m_LpEDSBase->CollectSpectrum(a_nMilliseconds, aData, a_nBufferSize);
  473. /*pin_ptr<long> pi = &a_XrayData[0];
  474. long *pinp = pi;
  475. memcpy(pinp, aData, a_nBufferSize);*/
  476. for (int i = a_nBufferSize; i <(int) a_nBufferSize; i++)
  477. {
  478. a_XrayData[i] = aData[i];
  479. }
  480. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  481. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit CollectSpectrum &&&&&&&&&&&&&&&&");
  482. delete[] aData;
  483. return bRet;
  484. }
  485. bool CollectSpectrum(DWORD a_nMilliseconds, array<long>^% a_XrayData)
  486. {
  487. LogInfoTrace(__FILE__, __LINE__, "***************** Enter CollectSpectrum ***************");
  488. bool bRet = m_LpEDSBase->CollectSpectrum(a_nMilliseconds);
  489. DWORD* xrd;
  490. xrd = m_LpEDSBase->GetXRayData();
  491. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  492. {
  493. a_XrayData[i] = xrd[i];
  494. }
  495. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  496. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit CollectSpectrum &&&&&&&&&&&&&&&&");
  497. return bRet;
  498. }
  499. bool GetXRayByPoints(DWORD a_nMilliseconds, array<long>^% a_XrayData)
  500. {
  501. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetXRayByPoints ***************");
  502. std::vector<CPosXrayPtr> listXRayPoints;
  503. CPosXrayPtr pXRayPoint = CPosXrayPtr(new CPosXray());
  504. pXRayPoint->SetPosition(CPoint(10, 10));
  505. listXRayPoints.push_back(pXRayPoint);
  506. bool bRet = m_LpEDSBase->GetXRayByPoints(listXRayPoints, a_nMilliseconds);
  507. DWORD* xrd;
  508. pXRayPoint = listXRayPoints[0];
  509. xrd = pXRayPoint->GetXrayData();
  510. /*pin_ptr<long> pi = &a_XrayData[0];
  511. long *pinp = pi;
  512. memcpy(pinp, xrd, (DWORD)EDSConst::XANA_CHANNELS);*/
  513. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  514. {
  515. a_XrayData[i] = xrd[i];
  516. }
  517. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  518. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetXRayByPoints &&&&&&&&&&&&&&&&");
  519. return bRet;
  520. }
  521. bool GetXRayByFeature(DWORD a_nMilliseconds, array<long>^% a_XrayData)
  522. {
  523. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetXRayByFeature ***************");
  524. std::vector<CPosXrayPtr> listXRayPoints;
  525. CPosXrayPtr pXRayPoint = CPosXrayPtr(new CPosXray());
  526. pXRayPoint->SetPosition(CPoint(10, 10));
  527. listXRayPoints.push_back(pXRayPoint);
  528. std::vector<BrukerSegment> listSegment;
  529. BrukerSegment oSegment;
  530. oSegment.XCount = 1;
  531. oSegment.XStart = 10;
  532. oSegment.Y = 10;
  533. listSegment.push_back(oSegment);
  534. std::vector<std::vector<BrukerSegment>>listFeatures;
  535. listFeatures.push_back(listSegment);
  536. bool bRet = m_LpEDSBase->GetXRayByFeatures(listXRayPoints, listFeatures, a_nMilliseconds);
  537. DWORD* xrd;
  538. pXRayPoint = listXRayPoints[0];
  539. xrd = pXRayPoint->GetXrayData();
  540. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  541. {
  542. a_XrayData[i] = xrd[i];
  543. }
  544. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  545. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetXRayByFeature &&&&&&&&&&&&&&&&");
  546. return bRet;
  547. }
  548. bool GetXRayByFeature(DWORD a_nMilliseconds, array<long>^% a_XrayData, bool a_bflag)
  549. {
  550. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetXRayByFeature ***************");
  551. std::vector<CPosXrayPtr> listXRayPoints;
  552. CPosXrayPtr pXRayPoint = CPosXrayPtr(new CPosXray());
  553. pXRayPoint->SetPosition(CPoint(10, 10));
  554. listXRayPoints.push_back(pXRayPoint);
  555. CPosXrayPtr pXRayPoint1 = CPosXrayPtr(new CPosXray());
  556. pXRayPoint1->SetPosition(CPoint(10, 20));
  557. listXRayPoints.push_back(pXRayPoint1);
  558. std::vector<BrukerSegment> listSegment;
  559. BrukerSegment oSegment;
  560. oSegment.XCount = 1;
  561. oSegment.XStart = 10;
  562. oSegment.Y = 10;
  563. listSegment.push_back(oSegment);
  564. std::vector<BrukerSegment> listSegment2;
  565. BrukerSegment oSegment2;
  566. oSegment2.XCount = 1;
  567. oSegment2.XStart = 20;
  568. oSegment2.Y = 10;
  569. BrukerSegment oSegment3;
  570. oSegment3.XCount = 3;
  571. oSegment3.XStart = 20;
  572. oSegment3.Y = 20;
  573. listSegment2.push_back(oSegment2);
  574. listSegment2.push_back(oSegment3);
  575. std::vector<std::vector<BrukerSegment>>listFeatures;
  576. listFeatures.push_back(listSegment);
  577. listFeatures.push_back(listSegment2);
  578. bool bRet = FALSE;
  579. // set get quantify info flag
  580. m_LpEDSBase->SetQuantification(TRUE);
  581. if (a_bflag)
  582. {
  583. bRet = m_LpEDSBase->GetXRayByFeatures(listXRayPoints, listFeatures, a_nMilliseconds);
  584. }
  585. else
  586. {
  587. bRet = m_LpEDSBase->GetXRayByFeaturesFromMultiPoint(listXRayPoints, listFeatures, a_nMilliseconds);
  588. }
  589. DWORD* xrd;
  590. pXRayPoint = listXRayPoints[0];
  591. xrd = pXRayPoint->GetXrayData();
  592. /*pin_ptr<long> pi = &a_XrayData[0];
  593. long *pinp = pi;
  594. memcpy(pinp, xrd, (DWORD)EDSConst::XANA_CHANNELS);*/
  595. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  596. {
  597. a_XrayData[i] = xrd[i];
  598. }
  599. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  600. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetXRayByFeature &&&&&&&&&&&&&&&&");
  601. return bRet;
  602. }
  603. // analysis elements
  604. bool GetXRayElements(DWORD a_nMilliseconds, array<long>^% a_XrayData, int^ % a_nElementNum, String^ % a_strResult)
  605. {
  606. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetXRayElements ***************");
  607. std::vector<CPosXrayPtr> listXRayPoints;
  608. CPosXrayPtr pXRayPoint = CPosXrayPtr(new CPosXray());
  609. pXRayPoint->SetPosition(CPoint(10, 10));
  610. listXRayPoints.push_back(pXRayPoint);
  611. CPosXrayPtr pXRayPoint1 = CPosXrayPtr(new CPosXray());
  612. pXRayPoint1->SetPosition(CPoint(20, 20));
  613. listXRayPoints.push_back(pXRayPoint1);
  614. // set get quantify info flag
  615. m_LpEDSBase->SetQuantification(TRUE);
  616. bool bRet = m_LpEDSBase->GetXRayByPoints(listXRayPoints, a_nMilliseconds);
  617. //bool bRet = m_LpEDSBase->GetXRayByFeaturesFromMultiPoint(listXRayPoints, listFeatures, a_nMilliseconds);
  618. DWORD* xrd;
  619. pXRayPoint = listXRayPoints[1];
  620. xrd = pXRayPoint->GetXrayData();
  621. // element quantify data
  622. CElementChemistriesList& listElement = listXRayPoints[1]->GetElementQuantifyData();
  623. int nElementNum = (int)listElement.size();
  624. LogInfoTrace(__FILE__, __LINE__, _T("GetXRayElements: get %d kinds of elements"), a_nElementNum);
  625. CString strElementResult = _T("");
  626. for(auto pElement: listElement)
  627. {
  628. CString strResult;
  629. CString strName = pElement->GetName();
  630. double dPercent = pElement->GetPercentage();
  631. strResult.Format(_T("%s: %f\n"), strName, dPercent);
  632. strElementResult += strResult;
  633. }
  634. LogInfoTrace(__FILE__, __LINE__, _T("GetXRayElements:result is strElementResult"), strElementResult);
  635. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  636. {
  637. a_XrayData[i] = xrd[i];
  638. }
  639. a_nElementNum = nElementNum;
  640. a_strResult = gcnew String(strElementResult);
  641. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  642. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetXRayElements &&&&&&&&&&&&&&&&");
  643. return bRet;
  644. }
  645. // analysis elements
  646. bool GetXRayAndElements(DWORD a_nMilliseconds,int a_BSEX, int a_BSEY, array<long>^% a_XrayData, int^ % a_nElementNum, String^ % a_strResult)
  647. {
  648. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetXRayElements ***************");
  649. std::vector<CPosXrayPtr> listXRayPoints;
  650. CPosXrayPtr pXRayPoint = CPosXrayPtr(new CPosXray());
  651. pXRayPoint->SetPosition(CPoint(a_BSEX, a_BSEY));
  652. listXRayPoints.push_back(pXRayPoint);
  653. CPosXrayPtr pXRayPoint1 = CPosXrayPtr(new CPosXray());
  654. pXRayPoint1->SetPosition(CPoint(a_BSEX, a_BSEY));
  655. listXRayPoints.push_back(pXRayPoint1);
  656. // set get quantify info flag
  657. m_LpEDSBase->SetQuantification(FALSE);
  658. bool bRet = m_LpEDSBase->GetXRayByPoints(listXRayPoints, a_nMilliseconds);
  659. //bool bRet = m_LpEDSBase->GetXRayByFeaturesFromMultiPoint(listXRayPoints, listFeatures, a_nMilliseconds);
  660. std::vector<CPosXrayPtr> listXRayPointsTemp;
  661. CPosXrayPtr pXRayPointTemp = CPosXrayPtr(new CPosXray());
  662. listXRayPointsTemp.push_back(pXRayPointTemp);
  663. for (int i = 0; i < 2; i++)
  664. {
  665. listXRayPointsTemp[0] = listXRayPoints[i];
  666. m_LpEDSBase->SetQuantification(TRUE);
  667. bool bRet = m_LpEDSBase->GetXRayByPoints(listXRayPointsTemp, a_nMilliseconds);
  668. listXRayPoints[i] = listXRayPointsTemp[0];
  669. }
  670. DWORD* xrd;
  671. pXRayPoint = listXRayPoints[1];
  672. xrd = pXRayPoint->GetXrayData();
  673. // element quantify data
  674. CElementChemistriesList& listElement = listXRayPoints[1]->GetElementQuantifyData();
  675. int nElementNum = (int)listElement.size();
  676. LogInfoTrace(__FILE__, __LINE__, _T("GetXRayElements: get %d kinds of elements"), a_nElementNum);
  677. CString strElementResult = _T("");
  678. for (auto pElement : listElement)
  679. {
  680. CString strResult;
  681. CString strName = pElement->GetName();
  682. double dPercent = pElement->GetPercentage();
  683. strResult.Format(_T("%s: %f\n"), strName, dPercent);
  684. strElementResult += strResult;
  685. }
  686. LogInfoTrace(__FILE__, __LINE__, _T("GetXRayElements:result is strElementResult"), strElementResult);
  687. for (int i = 0; i < (int)EDSConst::XANA_CHANNELS; i++)
  688. {
  689. a_XrayData[i] = xrd[i];
  690. }
  691. a_nElementNum = nElementNum;
  692. a_strResult = gcnew String(strElementResult);
  693. LogTrace(__FILE__, __LINE__, _T("CollectSpectrum return %d"), bRet);
  694. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetXRayElements &&&&&&&&&&&&&&&&");
  695. return bRet;
  696. }
  697. /// Set Amp Time Index for all detectors
  698. bool SetAmpTimeIndex(long a_lvalue)
  699. {
  700. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetAmpTimeIndex ***************");
  701. bool bRet = m_LpEDSBase->SetAmpTimeIndex(a_lvalue);
  702. LogTrace(__FILE__, __LINE__, _T("SetAmpTimeIndex return %d"), bRet);
  703. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetAmpTimeIndex &&&&&&&&&&&&&&&&");
  704. return bRet;
  705. }
  706. /// get live time
  707. float GetLiveTime(void)
  708. {
  709. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetLiveTime ***************");
  710. float fRet = m_LpEDSBase->GetLiveTime();
  711. LogTrace(__FILE__, __LINE__, _T("SetAmpTimeIndex return %f"), fRet);
  712. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetLiveTime &&&&&&&&&&&&&&&&");
  713. return fRet;
  714. }
  715. /// get x-ray point collection limit
  716. long GetMaxPointLimit(void)
  717. {
  718. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetMaxPointLimit ***************");
  719. long lRet = m_LpEDSBase->GetMaxPointLimit();
  720. LogTrace(__FILE__, __LINE__, _T("GetMaxPointLimit return %ld"), lRet);
  721. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetMaxPointLimit &&&&&&&&&&&&&&&&");
  722. return lRet;
  723. }
  724. DWORD GetNumberOfChannels(void)
  725. {
  726. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetNumberOfChannels ***************");
  727. DWORD nRet = m_LpEDSBase->GetNumberOfChannels();
  728. LogTrace(__FILE__, __LINE__, _T("GetNumberOfChannels return %d"), nRet);
  729. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetNumberOfChannels &&&&&&&&&&&&&&&&");
  730. return nRet;
  731. }
  732. //获取图像数据14741238434
  733. int AcquireBSEImage(int a_nMatrixIndex, int nReads, int nDwell, array<System::Byte>^% a_ImgData)
  734. {
  735. LogInfoTrace(__FILE__, __LINE__, "***************** Enter AcquireBSEImage ***************");
  736. int bRet = 0;
  737. CSize sz;
  738. int height, width;
  739. CBSEImgPtr pbseImg= nullptr;
  740. pbseImg = m_LpScanBase->AcquireBSEImage(a_nMatrixIndex, nReads, nDwell);
  741. sz = pbseImg->GetImageSize();
  742. height = sz.cx;
  743. width = sz.cy;
  744. bRet = height * width;
  745. BYTE* lpData = pbseImg->GetImageDataPointer();
  746. /*pin_ptr<unsigned char> pi = &a_ImgData[0];
  747. unsigned char *pinp = pi;
  748. memcpy(pinp, lpData, height * width); */
  749. for (int i = 0; i < bRet; i++)
  750. {
  751. a_ImgData[i] = lpData[i];
  752. }
  753. LogTrace(__FILE__, __LINE__, _T("AcquireBSEImage return %d"), bRet);
  754. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit AcquireBSEImage &&&&&&&&&&&&&&&&");
  755. return bRet;
  756. // return 0;
  757. }
  758. // 初始化
  759. bool ScanInit()
  760. {
  761. LogInfoTrace(__FILE__, __LINE__, "***************** Enter ScanInit ***************");
  762. bool bRet = m_LpScanBase->Init();
  763. LogTrace(__FILE__, __LINE__, _T("ScanInit return %d"), bRet);
  764. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit ScanInit &&&&&&&&&&&&&&&&");
  765. return bRet;
  766. }
  767. /// instance termination
  768. void ScanFinishedInstance()
  769. {
  770. LogInfoTrace(__FILE__, __LINE__, "***************** Enter ScanFinishedInstance ***************");
  771. m_LpScanBase->FinishedInstance();
  772. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit ScanFinishedInstance &&&&&&&&&&&&&&&&");
  773. }
  774. int GetScanType()
  775. {
  776. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetScanType ***************");
  777. int nRet = (int)ScanController::SCANNER_ID::BRUKER;
  778. LogTrace(__FILE__, __LINE__, _T("GetScanType return %d"), nRet);
  779. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetScanType &&&&&&&&&&&&&&&&");
  780. return nRet;
  781. }
  782. Size GetMatrixSize(int a_nMatrixIndex)
  783. {
  784. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetMatrixSize ***************");
  785. CSize cs;
  786. cs = m_LpScanBase->GetMatrixSize(a_nMatrixIndex);
  787. Size aa;
  788. aa.Height = (int)cs.cy;
  789. aa.Width = (int)cs.cx;
  790. LogTrace(__FILE__, __LINE__, _T("GetMatrixSize return (%d,%d)"), cs.cx, cs.cy);
  791. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetMatrixSize &&&&&&&&&&&&&&&&");
  792. return aa;
  793. }
  794. // move beam to point
  795. //bool MoveBeamTo(CPoint& a_beamPos);
  796. // Start Scan Table
  797. bool StartScanTable(int a_nMatrixIndex, unsigned int nP, array<System::Int16>^ pnxx, array<System::Int16>^ pnyy)
  798. {
  799. LogInfoTrace(__FILE__, __LINE__, "***************** Enter StartScanTable ***************");
  800. int*pnx = new int[nP];
  801. int*pny = new int[nP];
  802. memset(pnx, 0, sizeof(int)*nP);
  803. memset(pny, 0, sizeof(int)*nP);
  804. /*pin_ptr<short> pix = &pnxx[0];
  805. short *pinpx = pix;
  806. pin_ptr<short> piy = &pnyy[0];
  807. short *pinpy = piy;*/
  808. bool bRet = false;
  809. if (m_LpScanBase->StartScanTable(a_nMatrixIndex, nP, pnx, pny))
  810. {
  811. /*memcpy(pinpx, pnx, nP);
  812. memcpy(pinpy, pny, nP);*/
  813. for (int i = 0; i <(int) nP; i++)
  814. {
  815. pnxx[i] = pnx[i];
  816. pnyy[i] = pny[i];
  817. }
  818. bRet = true;
  819. }
  820. else
  821. {
  822. bRet = false;
  823. }
  824. delete[] pny;
  825. delete[] pnx;
  826. LogTrace(__FILE__, __LINE__, _T("StartScanTable return %d"), bRet);
  827. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit StartScanTable &&&&&&&&&&&&&&&&");
  828. return bRet;
  829. }
  830. // set Image Size
  831. bool SetImageSize(long nImageSize)
  832. {
  833. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetImageSize ***************");
  834. bool bRet = m_LpScanBase->SetImageSize(nImageSize);
  835. LogTrace(__FILE__, __LINE__, _T("SetImageSize return %d"), bRet);
  836. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetImageSize &&&&&&&&&&&&&&&&");
  837. return bRet;
  838. }
  839. /// set dwell time
  840. bool SetDwellTime(long nDwellTime)
  841. {
  842. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetDwellTime ***************");
  843. bool bRet = m_LpScanBase->SetDwellTime(nDwellTime);
  844. LogTrace(__FILE__, __LINE__, _T("SetDwellTime return %d"), bRet);
  845. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetDwellTime &&&&&&&&&&&&&&&&");
  846. return bRet;
  847. }
  848. Size GetFrameResolutionByIndex(const long a_nIndex)
  849. {
  850. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetFrameResolutionByIndex ***************");
  851. CSize cs;
  852. cs = m_LpScanBase->GetFrameResolutionByIndex(a_nIndex);
  853. Size aa;
  854. aa.Height = (int)cs.cx;
  855. aa.Width = (int)cs.cy;
  856. LogTrace(__FILE__, __LINE__, _T("GetFrameResolutionByIndex return (%d,%d)"), cs.cx, cs.cy);
  857. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetFrameResolutionByIndex &&&&&&&&&&&&&&&&");
  858. return aa;
  859. }
  860. bool SetFrameResolutionByIndex(const long a_nIndex)
  861. {
  862. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetFrameResolutionByIndex ***************");
  863. bool bRet = m_LpScanBase->SetFrameResolutionByIndex(a_nIndex);
  864. LogTrace(__FILE__, __LINE__, _T("SetDwellTime return %d"), bRet);
  865. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetFrameResolutionByIndex &&&&&&&&&&&&&&&&");
  866. return bRet;
  867. }
  868. long GetDwellTimeByIndex(const long a_nIndex)
  869. {
  870. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetDwellTimeByIndex ***************");
  871. long lRet = m_LpScanBase->GetDwellTimeByIndex(a_nIndex);
  872. LogTrace(__FILE__, __LINE__, _T("GetDwellTimeByIndex return %ld"), lRet);
  873. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetDwellTimeByIndex &&&&&&&&&&&&&&&&");
  874. return lRet;
  875. }
  876. bool SetDwellTimeByIndex(const long a_nIndex)
  877. {
  878. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetDwellTimeByIndex ***************");
  879. bool bRet = m_LpScanBase->SetDwellTimeByIndex(a_nIndex);
  880. LogTrace(__FILE__, __LINE__, _T("SetDwellTimeByIndex return %d"), bRet);
  881. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetDwellTimeByIndex &&&&&&&&&&&&&&&&");
  882. return bRet;
  883. }
  884. bool SetScanFieldSize(const int a_nWidth, const int a_nHeight)
  885. {
  886. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetScanFieldSize ***************");
  887. bool bRet =(bool)m_LpScanBase->SetScanFieldSize(a_nWidth, a_nHeight);
  888. LogTrace(__FILE__, __LINE__, _T("SetScanFieldSize is width = %d, height = %d"), a_nWidth, a_nHeight);
  889. LogTrace(__FILE__, __LINE__, _T("SetScanFieldSize return %d"), bRet);
  890. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetScanFieldSize &&&&&&&&&&&&&&&&");
  891. return bRet;
  892. }
  893. bool SetEMPosition(const int a_nPosX, const int a_nPosY)
  894. {
  895. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetEMPosition ***************");
  896. bool bRet = (bool)m_LpScanBase->SetScanFieldSize(a_nPosX, a_nPosY);
  897. LogTrace(__FILE__, __LINE__, _T("SetEMPosition is posX = %d, posY = %d"), a_nPosX, a_nPosY);
  898. LogTrace(__FILE__, __LINE__, _T("SetEMPosition return %d"), bRet);
  899. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetEMPosition &&&&&&&&&&&&&&&&");
  900. return bRet;
  901. }
  902. Size GetScanRange()
  903. {
  904. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetScanRange ***************");
  905. CSize cs = m_LpScanBase->GetScanRange();
  906. Size aa;
  907. aa.Height = (int)cs.cx;
  908. aa.Width = (int)cs.cy;
  909. LogTrace(__FILE__, __LINE__, _T("GetScanRange return Size is(%d,%d)"), aa.Height, aa.Width);
  910. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetScanRange &&&&&&&&&&&&&&&&");
  911. return aa;
  912. }
  913. int GetScanStepSize()
  914. {
  915. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetScanStepSize ***************");
  916. int nRet = m_LpScanBase->GetScanStepSize();
  917. LogTrace(__FILE__, __LINE__, _T("GetScanStepSize return is %d"), nRet);
  918. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetScanStepSize &&&&&&&&&&&&&&&&");
  919. return nRet;
  920. }
  921. int GetInterPixelDwell()
  922. {
  923. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetInterPixelDwell ***************");
  924. int nRet = m_LpScanBase->GetInterPixelDwell();
  925. LogTrace(__FILE__, __LINE__, _T("GetInterPixelDwell return is %d"), nRet);
  926. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetInterPixelDwell &&&&&&&&&&&&&&&&");
  927. return nRet;
  928. }
  929. int GetNumberOfReads()
  930. {
  931. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetNumberOfReads ***************");
  932. int nRet = m_LpScanBase->GetNumberOfReads();
  933. LogTrace(__FILE__, __LINE__, _T("GetNumberOfReads return is %d"), nRet);
  934. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetNumberOfReads &&&&&&&&&&&&&&&&");
  935. return nRet;
  936. }
  937. double GetMagnification()
  938. {
  939. LogInfoTrace(__FILE__, __LINE__, "***************** Enter GetMagnification ***************");
  940. double nRet = m_LpScanBase->GetMagnification();
  941. LogTrace(__FILE__, __LINE__, _T("GetMagnification return is %f"), nRet);
  942. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit GetMagnification &&&&&&&&&&&&&&&&");
  943. return nRet;
  944. }
  945. void SetScanRange(Size cs)
  946. {
  947. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetScanRange ***************");
  948. CSize sz;
  949. sz.cx = (LONG)cs.Height;
  950. sz.cy = (LONG)cs.Width;
  951. m_LpScanBase->SetScanRange(sz);
  952. LogTrace(__FILE__, __LINE__, _T("SetScanRange set (%d,%d)"), sz.cx, sz.cy);
  953. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetScanRange &&&&&&&&&&&&&&&&");
  954. }
  955. void SetScanStepSize(int size)
  956. {
  957. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetScanStepSize ***************");
  958. m_LpScanBase->SetScanStepSize(size);
  959. LogTrace(__FILE__, __LINE__, _T("SetScanStepSize set %d"), size);
  960. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetScanStepSize &&&&&&&&&&&&&&&&");
  961. }
  962. void SetInterPixelDwell(int i)
  963. {
  964. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetInterPixelDwell ***************");
  965. m_LpScanBase->SetInterPixelDwell(i);
  966. LogTrace(__FILE__, __LINE__, _T("SetInterPixelDwell set %d"), i);
  967. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetInterPixelDwell &&&&&&&&&&&&&&&&");
  968. }
  969. void SetNumberOfReads(int i)
  970. {
  971. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetNumberOfReads ***************");
  972. m_LpScanBase->SetNumberOfReads(i);
  973. LogTrace(__FILE__, __LINE__, _T("SetNumberOfReads set %d"), i);
  974. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetNumberOfReads &&&&&&&&&&&&&&&&");
  975. }
  976. void SetMagnification(double mag)
  977. {
  978. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetMagnification ***************");
  979. m_LpScanBase->SetMagnification(mag);
  980. LogTrace(__FILE__, __LINE__, _T("SetMagnification set %d"), mag);
  981. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetMagnification &&&&&&&&&&&&&&&&");
  982. }
  983. bool ScanIsBruker()
  984. {
  985. LogInfoTrace(__FILE__, __LINE__, "***************** Enter ScanIsBruker ***************");
  986. bool bRet = (bool)m_LpScanBase->IsBruker();
  987. LogTrace(__FILE__, __LINE__, _T("ScanIsBruker return %d"), bRet);
  988. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit ScanIsBruker &&&&&&&&&&&&&&&&");
  989. return bRet;
  990. }
  991. bool SetAndStartScan(void)
  992. {
  993. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetAndStartScan ***************");
  994. bool bRet = (bool)m_LpScanBase->SetAndStartScan();
  995. LogTrace(__FILE__, __LINE__, _T("SetAndStartScan return %d"), bRet);
  996. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetAndStartScan &&&&&&&&&&&&&&&&");
  997. return bRet;
  998. }
  999. bool MoveBeamTo(Point a_beamPos)
  1000. {
  1001. CPoint pt;
  1002. pt.x = a_beamPos.X;
  1003. pt.y = a_beamPos.Y;
  1004. LogInfoTrace(__FILE__, __LINE__, "***************** Enter MoveBeamTo ***************");
  1005. bool bRet = (bool)m_LpScanBase->MoveBeamTo(pt);
  1006. LogTrace(__FILE__, __LINE__, _T("MoveBeamTo return %d"), bRet);
  1007. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit MoveBeamTo &&&&&&&&&&&&&&&&");
  1008. return bRet;
  1009. }
  1010. bool SetPointScan(int a_nMatrixIndex)
  1011. {
  1012. LogInfoTrace(__FILE__, __LINE__, "***************** Enter SetPointScan ***************");
  1013. bool bRet = (bool)m_LpScanBase->SetPointScan(a_nMatrixIndex);
  1014. LogTrace(__FILE__, __LINE__, _T("SetPointScan set %d"), a_nMatrixIndex);
  1015. LogInfoTrace(__FILE__, __LINE__, "&&&&&&&&&&&&&&&&&& Exit SetPointScan &&&&&&&&&&&&&&&&");
  1016. return bRet;
  1017. }
  1018. private:
  1019. // COTSSEMBruker* m_LpSemBruker;
  1020. COTSSemBase* m_LpSemBase;
  1021. //Scan
  1022. COTSScanBase* m_LpScanBase;
  1023. //EDS
  1024. COTSEDSBase* m_LpEDSBase;
  1025. //COTSHardwareMgr
  1026. COTSHardwareMgr* m_LpHardWareMgr;
  1027. };
  1028. }