OTSSEMBruker.cpp 17 KB

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