OTSSEMBruker.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. #include "stdafx.h"
  2. #include "OTSSEMBruker.h"
  3. namespace OTSController {
  4. // constructor
  5. COTSSEMBruker::COTSSEMBruker()
  6. : m_bConnected(FALSE)
  7. {
  8. }
  9. // destructor
  10. COTSSEMBruker::~COTSSEMBruker()
  11. {
  12. }
  13. // check if connected
  14. // return true if setup success
  15. BOOL COTSSEMBruker::IsConnected()
  16. {
  17. return m_bConnected;
  18. }
  19. // connect client dll
  20. BOOL COTSSEMBruker::Connect()
  21. {
  22. // doing nothing if m_pBrukerImplPtr is not nullptr
  23. if (!m_pBrukerImplPtr)
  24. {
  25. // get bruker initialize controller
  26. m_pBrukerImplPtr = COTSBrukerImpl::GetInstance();
  27. }
  28. // make sure m_pBrukerImplPtr is OK
  29. if (m_pBrukerImplPtr)
  30. {
  31. // initialize the bruker controller as a SEM controller
  32. LogTrace(__FILE__, __LINE__, _T("Init BrukerImpl..."));
  33. if (m_pBrukerImplPtr->Init(CONTROL_TYPE::BRUKER_SEM))
  34. {
  35. // check connection
  36. if (!m_pBrukerImplPtr->CheckConnection(m_bConnected))
  37. {
  38. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::Connect: failed to call CheckConnection."));
  39. m_pBrukerImplPtr.reset();
  40. m_bConnected = FALSE;
  41. return FALSE;
  42. }
  43. }
  44. // connection is ok?
  45. if (!m_bConnected)
  46. {
  47. // connection
  48. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::Connect(): connecting failed."));
  49. m_pBrukerImplPtr.reset();
  50. return FALSE;
  51. }
  52. }
  53. // ok, return TRUE
  54. return TRUE;
  55. }
  56. BOOL COTSSEMBruker::Disconnect()
  57. {
  58. if (m_bConnected)
  59. {
  60. m_pBrukerImplPtr->DisConnect();
  61. m_bConnected = false;
  62. return true;
  63. }
  64. else
  65. {
  66. return true;
  67. }
  68. }
  69. // set beam blank
  70. BOOL COTSSEMBruker::SetBeamBlank(long a_nBeamBlank)
  71. {
  72. // m_pBrukerImplPtr check
  73. ASSERT(m_pBrukerImplPtr);
  74. if (!m_pBrukerImplPtr)
  75. {
  76. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetBeamBlank: m_pBrukerImplPtr is invalid."));
  77. return FALSE;
  78. }
  79. // turn Bean off if a_nBeamBlank > 0
  80. if (a_nBeamBlank > 0)
  81. {
  82. if (!m_pBrukerImplPtr->SwitchSEMOff(FALSE, FALSE, TRUE))
  83. {
  84. // failed to call SwitchSEMOff method
  85. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetBeamBlank : failed to call SwitchSEMOff method."));
  86. return FALSE;
  87. }
  88. }
  89. // ok, return TRUE
  90. return TRUE;
  91. }
  92. // brightness
  93. BOOL COTSSEMBruker::GetBrightness(double& a_dBrightness)
  94. {
  95. // m_pBrukerImplPtr check
  96. ASSERT(m_pBrukerImplPtr);
  97. if (!m_pBrukerImplPtr)
  98. {
  99. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetBrightness: m_pBrukerImplPtr is invalid."));
  100. return FALSE;
  101. }
  102. // get brightness and contrast
  103. double dBrightness, dContrast;
  104. if (!m_pBrukerImplPtr->GetSEMBCData(dBrightness, dContrast))
  105. {
  106. // failed to call GetSEMBCData method
  107. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetBrightness: failed to call GetSEMBCData method."));
  108. return FALSE;
  109. }
  110. a_dBrightness = dBrightness;
  111. // ok, return TRUE
  112. return TRUE;
  113. }
  114. BOOL COTSSEMBruker::SetBrightness(double a_dBrightness)
  115. {
  116. // m_pBrukerImplPtr check
  117. ASSERT(m_pBrukerImplPtr);
  118. if (!m_pBrukerImplPtr)
  119. {
  120. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetBrightness: m_pBrukerImplPtr is invalid."));
  121. return FALSE;
  122. }
  123. // get current brightness and contrast
  124. double dBrightness, dContrast;
  125. if (!m_pBrukerImplPtr->GetSEMBCData(dBrightness, dContrast))
  126. {
  127. // failed to call GetSEMBCData method
  128. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetBrightness: failed to call GetSEMBCData method."));
  129. return FALSE;
  130. }
  131. // set brightness and contrast
  132. dBrightness = a_dBrightness;
  133. if (!m_pBrukerImplPtr->SetSEMBCData(dBrightness, dContrast))
  134. {
  135. // failed to call GetSEMBCData method
  136. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetBrightness: failed to call SetSEMBCData method."));
  137. return FALSE;
  138. }
  139. // ok, return TRUE
  140. return TRUE;
  141. }
  142. // contrast
  143. BOOL COTSSEMBruker::GetContrast(double& a_dContrast)
  144. {
  145. // m_pBrukerImplPtr check
  146. ASSERT(m_pBrukerImplPtr);
  147. if (!m_pBrukerImplPtr)
  148. {
  149. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetContrast: m_pBrukerImplPtr is invalid."));
  150. return FALSE;
  151. }
  152. // get brightness and contrast
  153. double dBrightness, dContrast;
  154. if (!m_pBrukerImplPtr->GetSEMBCData(dBrightness, dContrast))
  155. {
  156. // failed to call GetSEMBCData method
  157. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetContrast: failed to call GetSEMBCData method."));
  158. return FALSE;
  159. }
  160. a_dContrast = dContrast;
  161. // ok, return TRUE
  162. return TRUE;
  163. }
  164. BOOL COTSSEMBruker::SetContrast(double a_dContrast)
  165. {
  166. // m_pBrukerImplPtr check
  167. ASSERT(m_pBrukerImplPtr);
  168. if (!m_pBrukerImplPtr)
  169. {
  170. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetContrast: m_pBrukerImplPtr is invalid."));
  171. return FALSE;
  172. }
  173. // get current brightness and contrast
  174. double dBrightness, dContrast;
  175. if (!m_pBrukerImplPtr->GetSEMBCData(dBrightness, dContrast))
  176. {
  177. // failed to call GetSEMBCData method
  178. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetContrast: failed to call GetSEMBCData method."));
  179. return FALSE;
  180. }
  181. // set brightness and contrast
  182. dContrast = a_dContrast;
  183. if (!m_pBrukerImplPtr->SetSEMBCData(dBrightness, dContrast))
  184. {
  185. // failed to call SetSEMBCData method
  186. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetContrast: failed to call SetSEMBCData method."));
  187. return FALSE;
  188. }
  189. // ok, return TRUE
  190. return TRUE;
  191. }
  192. // working distance
  193. BOOL COTSSEMBruker::GetWorkingDistance(double& a_dWorkingDistance)
  194. {
  195. // m_pBrukerImplPtr check
  196. ASSERT(m_pBrukerImplPtr);
  197. if (!m_pBrukerImplPtr)
  198. {
  199. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetWorkingDistance: m_pBrukerImplPtr is invalid."));
  200. return FALSE;
  201. }
  202. // get mag, KV and working distance
  203. double dMagnification, dHighVoltage, dWorkingDistance;
  204. if (!m_pBrukerImplPtr->GetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  205. {
  206. // failed to call GetSEMData method
  207. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetWorkingDistance: failed to call SetSEMData method."));
  208. return FALSE;
  209. }
  210. a_dWorkingDistance = dWorkingDistance;
  211. // ok, return TRUE
  212. return TRUE;
  213. }
  214. BOOL COTSSEMBruker::SetWorkingDistance(double a_dWorkingDistance)
  215. {
  216. // m_pBrukerImplPtr check
  217. ASSERT(m_pBrukerImplPtr);
  218. if (!m_pBrukerImplPtr)
  219. {
  220. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetWorkingDistance: m_pBrukerImplPtr is invalid."));
  221. return FALSE;
  222. }
  223. // get current mag, KV and working distance
  224. double dMagnification, dHighVoltage, dWorkingDistance;
  225. if (!m_pBrukerImplPtr->GetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  226. {
  227. // failed to call GetSEMData method
  228. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetWorkingDistance: failed to call GetSEMData method."));
  229. return FALSE;
  230. }
  231. // set mag, KV and working distance
  232. dWorkingDistance = a_dWorkingDistance;
  233. if (!m_pBrukerImplPtr->SetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  234. {
  235. // failed to call SetSEMData method
  236. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetWorkingDistance: failed to call SetSEMData method."));
  237. return FALSE;
  238. }
  239. // ok, return TRUE
  240. return TRUE;
  241. }
  242. // high tension (KV)
  243. BOOL COTSSEMBruker::GetHighTension(double& a_dKV)
  244. {
  245. // m_pBrukerImplPtr check
  246. ASSERT(m_pBrukerImplPtr);
  247. if (!m_pBrukerImplPtr)
  248. {
  249. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetHighTension: m_pBrukerImplPtr is invalid."));
  250. return FALSE;
  251. }
  252. // get mag, KV and working distance
  253. double dMagnification, dHighVoltage, dWorkingDistance;
  254. if (!m_pBrukerImplPtr->GetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  255. {
  256. // failed to call GetSEMData method
  257. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetHighTension: failed to call SetSEMData method."));
  258. return FALSE;
  259. }
  260. a_dKV = dHighVoltage;
  261. // ok, return TRUE
  262. return TRUE;
  263. }
  264. BOOL COTSSEMBruker::SetHighTension(double a_dKV)
  265. {
  266. // m_pBrukerImplPtr check
  267. ASSERT(m_pBrukerImplPtr);
  268. if (!m_pBrukerImplPtr)
  269. {
  270. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetHighTension: m_pBrukerImplPtr is invalid."));
  271. return FALSE;
  272. }
  273. // get current mag, KV and working distance
  274. double dMagnification, dHighVoltage, dWorkingDistance;
  275. if (!m_pBrukerImplPtr->GetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  276. {
  277. // failed to call GetSEMData method
  278. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetHighTension: failed to call GetSEMData method."));
  279. return FALSE;
  280. }
  281. // set mag, KV and working distance
  282. dHighVoltage = a_dKV;
  283. if (!m_pBrukerImplPtr->SetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  284. {
  285. // failed to call SetSEMData method
  286. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetHighTension: failed to call SetSEMData method."));
  287. return FALSE;
  288. }
  289. // ok, return TRUE
  290. return TRUE;
  291. }
  292. // magnification
  293. BOOL COTSSEMBruker::GetMagnification(double& a_dMagnification)
  294. {
  295. // m_pBrukerImplPtr check
  296. ASSERT(m_pBrukerImplPtr);
  297. if (!m_pBrukerImplPtr)
  298. {
  299. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetMagnification: m_pBrukerImplPtr is invalid."));
  300. return FALSE;
  301. }
  302. // get mag, KV and working distance
  303. double dMagnification, dHighVoltage, dWorkingDistance;
  304. if (!m_pBrukerImplPtr->GetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  305. {
  306. // failed to call GetSEMData method
  307. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetMagnification: failed to call SetSEMData method."));
  308. return FALSE;
  309. }
  310. a_dMagnification = dMagnification;
  311. // ok, return TRUE
  312. return TRUE;
  313. }
  314. BOOL COTSSEMBruker::SetMagnification(double a_dMagnification)
  315. {
  316. // m_pBrukerImplPtr check
  317. ASSERT(m_pBrukerImplPtr);
  318. if (!m_pBrukerImplPtr)
  319. {
  320. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetMagnification: m_pBrukerImplPtr is invalid."));
  321. return FALSE;
  322. }
  323. // get current mag, KV and working distance
  324. double dMagnification, dHighVoltage, dWorkingDistance;
  325. if (!m_pBrukerImplPtr->GetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  326. {
  327. // failed to call GetSEMData method
  328. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetMagnification: failed to call GetSEMData method."));
  329. return FALSE;
  330. }
  331. // set mag, KV and working distance
  332. dMagnification = a_dMagnification;
  333. if (!m_pBrukerImplPtr->SetSEMData(dMagnification, dHighVoltage, dWorkingDistance))
  334. {
  335. // failed to call SetSEMData method
  336. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetMagnification: failed to call SetSEMData method."));
  337. return FALSE;
  338. }
  339. // ok, return TRUE
  340. return TRUE;
  341. }
  342. // scan field size
  343. BOOL COTSSEMBruker::GetScanFieldSize(double& a_dScanFieldSizeX, double& a_dScanFieldSizeY)
  344. {
  345. // get magnification
  346. double dMag = 0;
  347. if (!GetMagnification(dMag))
  348. {
  349. // failed to call GetMagnification method
  350. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetScanFieldSize: failed to call GetMagnification method."));
  351. return FALSE;
  352. }
  353. // calculate scan field size
  354. double dScanFieldSizeX, dScanFieldSizeY;
  355. if (!MagToScanFieldSize(dMag, dScanFieldSizeX, dScanFieldSizeY))
  356. {
  357. // failed to call MagToScanFieldSize method
  358. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetScanFieldSize: failed to call MagToScanFieldSize method."));
  359. return FALSE;
  360. }
  361. // calculate scan field size and set output values
  362. a_dScanFieldSizeX = dScanFieldSizeX;
  363. a_dScanFieldSizeY = dScanFieldSizeY;
  364. // ok, return TRUE
  365. return TRUE;
  366. }
  367. BOOL COTSSEMBruker::SetScanFieldSizeX(double a_dScanFieldSizeX)
  368. {
  369. // calculate magnification
  370. double dMag = 0;
  371. if (!ScanFieldSizeToMag(dMag, a_dScanFieldSizeX))
  372. {
  373. // failed to call ScanFieldSizeToMag method
  374. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetScanFieldSizeX: filed to call ScanFieldSizeToMag method."));
  375. return FALSE;
  376. }
  377. // set magnification
  378. if(!SetMagnification(dMag))
  379. {
  380. // failed to call ScanFieldSizeToMag method
  381. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetScanFieldSizeX: filed to call SetMagnification method."));
  382. return FALSE;
  383. }
  384. // ok, return TRUE
  385. return TRUE;
  386. }
  387. // high tension off
  388. // note: a_bHTValue is FALSE will turn HT off
  389. BOOL COTSSEMBruker::SetHTOnOff(BOOL a_bHTValue)
  390. {
  391. // m_pBrukerImplPtr check
  392. ASSERT(m_pBrukerImplPtr);
  393. if (!m_pBrukerImplPtr)
  394. {
  395. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetHTOnOff: m_pBrukerImplPtr is invalid."));
  396. return FALSE;
  397. }
  398. // turn HT off if a_bHTValue is FALSE
  399. if (!a_bHTValue)
  400. {
  401. if (!m_pBrukerImplPtr->SwitchSEMOff(TRUE, FALSE, FALSE))
  402. {
  403. // failed to call SwitchSEMOff method
  404. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetHTOnOff : failed to call SwitchSEMOff method."));
  405. return FALSE;
  406. }
  407. }
  408. // ok, return TRUE
  409. return TRUE;
  410. }
  411. // position
  412. BOOL COTSSEMBruker::GetPositionXY(double& a_dPositionX, double& a_dPositionY, double& a_dPositionR)
  413. {
  414. // m_pBrukerImplPtr check
  415. ASSERT(m_pBrukerImplPtr);
  416. if (!m_pBrukerImplPtr)
  417. {
  418. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetPositionXY: m_pBrukerImplPtr is invalid."));
  419. return FALSE;
  420. }
  421. // get position
  422. double dPositionX, dPositionY, dPositionZ, dTilt, dRotation;
  423. if (!m_pBrukerImplPtr->GetSEMStageData(dPositionX, dPositionY, dPositionZ, dTilt, dRotation))
  424. {
  425. // failed to call GetSEMStageData method
  426. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetPositionXY : failed to call GetSEMStageData method."));
  427. return FALSE;
  428. }
  429. // need to convert dPositionX, dPositionY from SEM position to OTS position
  430. // set output values
  431. a_dPositionX = dPositionX;
  432. a_dPositionY = dPositionY;
  433. a_dPositionR = dRotation;
  434. // ok, return TRUE
  435. return TRUE;
  436. }
  437. BOOL COTSSEMBruker::SetPositionXY(double a_dPositionX, double a_dPositionY, double a_dPositionR)
  438. {
  439. // m_pBrukerImplPtr check
  440. ASSERT(m_pBrukerImplPtr);
  441. if (!m_pBrukerImplPtr)
  442. {
  443. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetPositionXY: m_pBrukerImplPtr is invalid."));
  444. return FALSE;
  445. }
  446. // get position
  447. double dPositionX, dPositionY, dPositionZ, dTilt, dRotation;
  448. if (!m_pBrukerImplPtr->GetSEMStageData(dPositionX, dPositionY, dPositionZ, dTilt, dRotation))
  449. {
  450. // failed to call GetSEMStageData method
  451. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetPositionXY : failed to call GetSEMStageData method."));
  452. return FALSE;
  453. }
  454. // need to convert a_dPositionX, a_dPositionY from OTS position to SEM position
  455. // set position
  456. dPositionX = a_dPositionX;
  457. dPositionY = a_dPositionY;
  458. dRotation = a_dPositionR;
  459. LogTrace(__FILE__, __LINE__, _T("COTSSEMBruker::Start to SetPositionXY "));
  460. if (!m_pBrukerImplPtr->SetSEMStageData(dPositionX, dPositionY, dPositionZ, dTilt, dRotation))
  461. {
  462. // failed to call SetSEMStageData method
  463. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetPositionXY : failed to call SetSEMStageData method."));
  464. return FALSE;
  465. }
  466. LogTrace(__FILE__, __LINE__, _T("COTSSEMBruker::Finished SetPositionXY "));
  467. // ok, return TRUE
  468. return TRUE;
  469. }
  470. // spot size
  471. BOOL COTSSEMBruker::GetSpotSize(double& a_dSpotSize)
  472. {
  473. // m_pBrukerImplPtr check
  474. ASSERT(m_pBrukerImplPtr);
  475. if (!m_pBrukerImplPtr)
  476. {
  477. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetSpotSize: m_pBrukerImplPtr is invalid."));
  478. return FALSE;
  479. }
  480. // get spot size
  481. double dSpotSize;
  482. if (!m_pBrukerImplPtr->GetSEMSpotSize(dSpotSize))
  483. {
  484. // failed to call GetSEMSpotSize method
  485. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::GetSpotSize : failed to call GetSEMSpotSize method."));
  486. return FALSE;
  487. }
  488. a_dSpotSize = dSpotSize;
  489. // ok, return TRUE
  490. return TRUE;
  491. }
  492. BOOL COTSSEMBruker::SetSpotSize(double a_dSpotSize)
  493. {
  494. // m_pBrukerImplPtr check
  495. ASSERT(m_pBrukerImplPtr);
  496. if (!m_pBrukerImplPtr)
  497. {
  498. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetSpotSize: m_pBrukerImplPtr is invalid."));
  499. return FALSE;
  500. }
  501. // set spot size
  502. if (!m_pBrukerImplPtr->SetSEMSpotSize(a_dSpotSize))
  503. {
  504. // failed to call GetSEMSpotSize method
  505. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetSpotSize : failed to call SetSEMSpotSize method."));
  506. return FALSE;
  507. }
  508. // ok, return TRUE
  509. return TRUE;
  510. }
  511. // external mode
  512. BOOL COTSSEMBruker::SetScanExternal(BOOL a_bExternalOn)
  513. {
  514. // m_pBrukerImplPtr check
  515. ASSERT(m_pBrukerImplPtr);
  516. if (!m_pBrukerImplPtr)
  517. {
  518. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetScanExternal: m_pBrukerImplPtr is invalid."));
  519. return FALSE;
  520. }
  521. if (a_bExternalOn)
  522. {
  523. // turn external on
  524. if (!m_pBrukerImplPtr->SetSEMExternalOn())
  525. {
  526. // failed to call GetSEMSpotSize method
  527. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetScanExternal: failed to call SetSEMExternalOn method."));
  528. return FALSE;
  529. }
  530. }
  531. else
  532. {
  533. // turn external off
  534. if (!m_pBrukerImplPtr->SetSEMExternalOff())
  535. {
  536. // failed to call SetSEMExternalOff method
  537. LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetScanExternal: failed to call SetSEMExternalOff method."));
  538. return FALSE;
  539. }
  540. }
  541. // ok, return TRUE
  542. return TRUE;
  543. }
  544. }