TDKLoadPort.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.Device.Unit;
  7. using Aitex.Core.RT.Event;
  8. using Aitex.Core.RT.Log;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Sorter.Common;
  11. using MECF.Framework.Common.Communications;
  12. using TSC = Aitex.Sorter.Common;
  13. using Aitex.Core.Common;
  14. using MECF.Framework.Common.SubstrateTrackings;
  15. using Aitex.Core.RT.OperationCenter;
  16. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK
  17. {
  18. /// <summary>
  19. /// 代码说明:
  20. ///
  21. /// </summary>
  22. ///
  23. public enum CarrierOnLPState
  24. {
  25. Unknow=0,
  26. On,
  27. Off,
  28. }
  29. public class TDKLoadPort : LoadPort,IConnection
  30. {
  31. public string Address { get; set; }
  32. public bool IsConnected
  33. {
  34. get { return _port.IsOpen(); }
  35. }
  36. public bool UnlockKey
  37. {
  38. set
  39. {
  40. }
  41. }
  42. public bool Enable
  43. {
  44. set
  45. {
  46. if (_enableTrigger != null)
  47. {
  48. _enableTrigger.SetTrigger(value, out _);
  49. }
  50. }
  51. }
  52. public bool FFUIsOK { get; set; }
  53. private LoadportCassetteState _cassetteState = LoadportCassetteState.None;
  54. public override LoadportCassetteState CassetteState
  55. {
  56. get { return _cassetteState; }
  57. set
  58. {
  59. _cassetteState = value;
  60. }
  61. }
  62. public bool Processed { get; set; }
  63. public bool Communication
  64. {
  65. get
  66. {
  67. return _port == null ? !_commErr : !_commErr && _port.IsOpen();
  68. }
  69. }
  70. //
  71. public override bool IsBusy
  72. {
  73. get { return _foregroundHandler != null || _handlers.Count > 0 ; }
  74. }
  75. public override bool IsMoving
  76. {
  77. get { return _foregroundHandler != null && _handlers.Count > 0; }
  78. }
  79. public const string delimiter = "\r";
  80. public const int min_len = 3; //S00
  81. private static Object _locker = new Object();
  82. private AsyncSerial _port;
  83. private bool _commErr = false;
  84. private IHandler _eventHandler = null;
  85. private IHandler _foregroundHandler = null; //moving
  86. private Queue<IHandler> _handlers = new Queue<IHandler>();
  87. private IoSensor _sensorEnable = null;
  88. private IoTrigger _enableTrigger = null;
  89. public TDKLoadPort(string module, string name, string port, IoSensor sensorEnable, IoTrigger triggerEnable,
  90. EnumLoadPortType portType =EnumLoadPortType.LoadPort)
  91. : base(module, name )
  92. {
  93. _port = new AsyncSerial(port, 9600, 8);
  94. _port.OnDataChanged += (OnDataChanged);
  95. _port.OnErrorHappened += (OnErrorHandler);
  96. _eventHandler = new handler<OnEventHandler>(this, Name);
  97. _sensorEnable = sensorEnable;
  98. _enableTrigger = triggerEnable;
  99. Initalized = false;
  100. IsMapWaferByLoadPort = portType== EnumLoadPortType.LoadPort;
  101. PortType = portType;
  102. IndicatiorLoad = IndicatorState.UNKNOW;
  103. IndicatiorUnload = IndicatorState.UNKNOW;
  104. IndicatiorPresence = IndicatorState.UNKNOW;
  105. IndicatorAlarm = IndicatorState.UNKNOW;
  106. IndicatiorPlacement = IndicatorState.UNKNOW;
  107. IndicatiorOpAccess = IndicatorState.UNKNOW;
  108. IndicatiorStatus1 = IndicatorState.UNKNOW;
  109. IndicatiorStatus2 = IndicatorState.UNKNOW;
  110. IndicatiorAccessAuto = IndicatorState.UNKNOW;
  111. IndicatiorAccessManual = IndicatorState.UNKNOW;
  112. DoorState = FoupDoorState.Unknown;
  113. ClampState = FoupClampState.Unknown;
  114. CassetteState = LoadportCassetteState.Unknown;
  115. //if (!this.QueryState(out string reason))
  116. //{
  117. // EV.PostAlarmLog(module,$"Query state error.{reason}");
  118. //}
  119. Enable = true;
  120. Address = port;
  121. }
  122. public void SetCassetteState(LoadportCassetteState state)
  123. {
  124. _cassetteState = state;
  125. if (state == LoadportCassetteState.Normal)
  126. {
  127. _isPlaced = true;
  128. _isPresent = true;
  129. ConfirmAddCarrier();
  130. }
  131. else if(state == LoadportCassetteState.Absent)
  132. {
  133. _isPlaced = false;
  134. _isPresent = false;
  135. ConfirmRemoveCarrier();
  136. }
  137. else
  138. {
  139. _isPlaced = false;
  140. ConfirmRemoveCarrier();
  141. }
  142. }
  143. public override bool ReadRfId(out string reason)
  144. {
  145. OP.DoOperation("ReadCarrierId", Name);
  146. reason = "";
  147. return true;
  148. }
  149. public override bool Initialize()
  150. {
  151. base.Initialize();
  152. _commErr = true;
  153. ConnectionManager.Instance.Subscribe($"{Name}", this);
  154. Connect();
  155. //if (!RetryInstance.Instance().Execute<bool>(
  156. // ()=> _port.Open(),
  157. // SC.GetValue<int>("System.ComPortRetryDelayTime"),
  158. // SC.GetValue<int>("System.ComPortRetryCount"),
  159. // true
  160. //))
  161. //{
  162. // return false;
  163. //}
  164. return true;
  165. }
  166. public override bool Connect()
  167. {
  168. _commErr = false;
  169. Task.Factory.StartNew(() =>
  170. {
  171. int count = SC.ContainsItem("System.ComPortRetryCount") ? SC.GetValue<int>("System.ComPortRetryCount") : 5;
  172. int sleep = SC.ContainsItem("System.ComPortRetryDelayTime") ? SC.GetValue<int>("System.ComPortRetryDelayTime") : 2;
  173. if (sleep <= 0 || sleep > 10)
  174. sleep = 2;
  175. int retry = 0;
  176. do
  177. {
  178. _port.Close();
  179. Thread.Sleep(sleep * 1000);
  180. if (_port.Open())
  181. {
  182. //LOG.Write($"Connected with {Module}.{Name} .");
  183. EV.PostInfoLog(Module, $"Connected with {Module}.{Name} .");
  184. break;
  185. }
  186. if (count > 0 && retry++ > count)
  187. {
  188. LOG.Write($"Retry connect {Module}.{Name} stop retry.");
  189. EV.PostAlarmLog(Module, $"Can't connect to {Module}.{Name}.");
  190. break;
  191. }
  192. Thread.Sleep(sleep * 1000);
  193. LOG.Write($"Retry connect {Module}.{Name} for the {retry + 1} time.");
  194. } while (true);
  195. });
  196. return true;
  197. }
  198. public bool Disconnect()
  199. {
  200. return true;
  201. }
  202. public override void Terminate()
  203. {
  204. _port.Close();
  205. }
  206. public override bool IsEnableMapWafer()
  207. {
  208. if (IsIdle
  209. && _isPresent
  210. && _isPlaced
  211. && DoorState == FoupDoorState.Open
  212. && CassetteState == LoadportCassetteState.Normal
  213. )
  214. return true;
  215. return false;
  216. }
  217. public override bool IsEnableTransferWafer()
  218. {
  219. return IsEnableTransferWafer(out _);
  220. }
  221. public override bool IsEnableTransferWafer(out string reason)
  222. {
  223. reason = "";
  224. if (_isPlaced
  225. && _isPresent
  226. && _isMapped
  227. && IsIdle
  228. && DoorState==FoupDoorState.Open
  229. && CassetteState==LoadportCassetteState.Normal
  230. && IsWaferEnableTransfer()
  231. ) return true;
  232. return false;
  233. }
  234. public override void Monitor()
  235. {
  236. base.Monitor();
  237. }
  238. /// <summary>
  239. ///The Indicator is for EAP/Operator
  240. /// LOAD READY: LoadPort Ready to receive FOUP
  241. /// UNLOAD READY: FOUP ready to remove
  242. ///
  243. /// </summary>
  244. public void OnStateUpdated()
  245. {
  246. //if (!SC.ContainsItem("Process.OptionLoadportMonitor") || !SC.GetValue<bool>("Process.OptionLoadportMonitor"))
  247. // return;
  248. //if (_isPresent && _isPlaced && this.ClampState == FoupClampState.Open &&this.DockPOS == TDKY_AxisPos.Undock)
  249. //{
  250. // if (IndicatiorUnload != IndicatorState.ON)
  251. // SetIndicator(Indicator.UNLOAD, IndicatorState.ON);
  252. // if (IndicatiorLoad != IndicatorState.OFF)
  253. // SetIndicator(Indicator.LOAD, IndicatorState.OFF);
  254. // return;
  255. //}
  256. //if (!_isPresent || !_isPlaced)
  257. //{
  258. // if (IndicatiorUnload != IndicatorState.OFF)
  259. // SetIndicator(Indicator.UNLOAD, IndicatorState.OFF);
  260. // if (IndicatiorLoad != IndicatorState.ON)
  261. // SetIndicator(Indicator.LOAD, IndicatorState.ON);
  262. // return;
  263. //}
  264. //if (IndicatiorUnload != IndicatorState.OFF)
  265. // SetIndicator(Indicator.UNLOAD, IndicatorState.OFF);
  266. //if (IndicatiorLoad != IndicatorState.OFF)
  267. // SetIndicator(Indicator.LOAD, IndicatorState.OFF);
  268. }
  269. public void OnAccessButtonPushed()
  270. {
  271. if (_isPresent && _isPlaced)
  272. {
  273. }
  274. }
  275. /// <summary>
  276. ///reset load port error
  277. ///
  278. /// </summary>
  279. public override void Reset()
  280. {
  281. lock (_locker)
  282. {
  283. _foregroundHandler = null;
  284. _handlers.Clear();
  285. }
  286. FFUIsOK = true;
  287. _commErr = false;
  288. Enable = true;
  289. Error = false;
  290. base.Reset();
  291. }
  292. public override bool Home(out string reason)
  293. {
  294. reason = string.Empty;
  295. lock (_locker)
  296. {
  297. _foregroundHandler = null;
  298. _handlers.Clear();
  299. }
  300. return execute(new handler<HomeHandler>(this, Name), out reason);
  301. }
  302. public override bool ForceHome(out string reason)
  303. {
  304. reason = string.Empty;
  305. lock (_locker)
  306. {
  307. _foregroundHandler = null;
  308. _handlers.Clear();
  309. }
  310. return execute(new handler<ForceHomeHandler>(this, Name), out reason);
  311. }
  312. public override bool FOSBMode(out string reason)
  313. {
  314. reason = string.Empty;
  315. lock (_locker)
  316. {
  317. _foregroundHandler = null;
  318. _handlers.Clear();
  319. }
  320. return execute(new handler<FOSBModeHandler>(this, Name), out reason);
  321. }
  322. public override bool FOUPMode(out string reason)
  323. {
  324. reason = string.Empty;
  325. lock (_locker)
  326. {
  327. _foregroundHandler = null;
  328. _handlers.Clear();
  329. }
  330. return execute(new handler<FOUPModeHandler>(this, Name), out reason);
  331. }
  332. public override bool FOSBDock(out string reason)
  333. {
  334. reason = string.Empty;
  335. lock (_locker)
  336. {
  337. _foregroundHandler = null;
  338. _handlers.Clear();
  339. }
  340. return execute(new handler<DockPosHandler>(this, Name), out reason);
  341. }
  342. public override bool FOSBUnDock(out string reason)
  343. {
  344. reason = string.Empty;
  345. lock (_locker)
  346. {
  347. _foregroundHandler = null;
  348. _handlers.Clear();
  349. }
  350. return execute(new handler<UnDockPosHandler>(this, Name), out reason);
  351. }
  352. public override bool FOSBDoorOpen(out string reason)
  353. {
  354. reason = string.Empty;
  355. lock (_locker)
  356. {
  357. _foregroundHandler = null;
  358. _handlers.Clear();
  359. }
  360. return execute(new handler<DoorOpenHandler>(this, Name), out reason);
  361. }
  362. public override bool FOSBDoorClose(out string reason)
  363. {
  364. reason = string.Empty;
  365. lock (_locker)
  366. {
  367. _foregroundHandler = null;
  368. _handlers.Clear();
  369. }
  370. return execute(new handler<DoorCloseHandler>(this, Name), out reason);
  371. }
  372. public override bool FOSBDoorUp(out string reason)
  373. {
  374. reason = string.Empty;
  375. lock (_locker)
  376. {
  377. _foregroundHandler = null;
  378. _handlers.Clear();
  379. }
  380. return execute(new handler<DoorUpHandler>(this, Name), out reason);
  381. }
  382. public override bool FOSBDoorDown(out string reason)
  383. {
  384. reason = string.Empty;
  385. lock (_locker)
  386. {
  387. _foregroundHandler = null;
  388. _handlers.Clear();
  389. }
  390. return execute(new handler<DoorDownHandler>(this, Name), out reason);
  391. }
  392. /// <summary>
  393. /// Clear LP error
  394. /// </summary>
  395. public override bool ClearError(out string reason)
  396. {
  397. reason = string.Empty;
  398. Error = false;
  399. ExecuteError = false;
  400. reason = string.Empty;
  401. lock (_locker)
  402. {
  403. _foregroundHandler = null;
  404. _handlers.Clear();
  405. }
  406. return execute(new handler<ResetHandler>(this, Name), out reason);
  407. }
  408. public override bool Stop(out string reason)
  409. {
  410. reason = string.Empty;
  411. lock (_locker)
  412. {
  413. _foregroundHandler = null;
  414. _handlers.Clear();
  415. }
  416. return execute(new handler<MovHandler>(this, Name, MovType.STOP_), out reason);
  417. }
  418. public override bool FALoad(out string reason) //map and loads
  419. {
  420. reason = "";
  421. if (State != DeviceState.Idle)
  422. {
  423. reason = $"LoadPort is in {State}";
  424. return false;
  425. }
  426. OP.DoOperation("LoadFoup", Name);
  427. return true;
  428. }
  429. public override bool Load(out string reason) //map and loads
  430. {
  431. if (State != DeviceState.Idle)
  432. {
  433. reason = $"LoadPort is in {State}";
  434. return false;
  435. }
  436. return Move(MovType.CLDMP, out reason);
  437. }
  438. public override bool LoadWithoutMap(out string reason)
  439. {
  440. if (State != DeviceState.Idle)
  441. {
  442. reason = $"LoadPort is in {State}";
  443. return false;
  444. }
  445. return Move(MovType.CLOAD, out reason);
  446. }
  447. public override bool Unload(out string reason)
  448. {
  449. if (State != DeviceState.Idle)
  450. {
  451. reason = $"LoadPort is in {State}";
  452. return false;
  453. }
  454. return Move(MovType.CULOD, out reason);
  455. }
  456. public override bool Clamp(out string reason)
  457. {
  458. if (State != DeviceState.Idle)
  459. {
  460. reason = $"LoadPort is in {State}";
  461. return false;
  462. }
  463. return Move(MovType.PODCL, out reason);
  464. }
  465. public override bool Unclamp(out string reason)
  466. {
  467. if (State != DeviceState.Idle)
  468. {
  469. reason = $"LoadPort is in {State}";
  470. return false;
  471. }
  472. return Move(MovType.PODOP, out reason);
  473. }
  474. public override bool Dock(out string reason)
  475. {
  476. if (State != DeviceState.Idle)
  477. {
  478. reason = $"LoadPort is in {State}";
  479. return false;
  480. }
  481. return Move(MovType.CLDDK, out reason);
  482. }
  483. public override bool Undock(out string reason)
  484. {
  485. if (State != DeviceState.Idle)
  486. {
  487. reason = $"LoadPort is in {State}";
  488. return false;
  489. }
  490. return Move(MovType.CULFC, out reason); //????
  491. }
  492. public override bool OpenDoor(out string reason)
  493. {
  494. if (State != DeviceState.Idle)
  495. {
  496. reason = $"LoadPort is in {State}";
  497. return false;
  498. }
  499. return Move(MovType.CLMPO, out reason);
  500. }
  501. public override bool OpenDoorNoMap(out string reason)
  502. {
  503. if (State != DeviceState.Idle)
  504. {
  505. reason = $"LoadPort is in {State}";
  506. return false;
  507. }
  508. return Move(MovType.CLDOP, out reason);
  509. }
  510. public override bool CloseDoor(out string reason)
  511. {
  512. if (State != DeviceState.Idle)
  513. {
  514. reason = $"LoadPort is in {State}";
  515. return false;
  516. }
  517. return Move(MovType.CULDK, out reason);
  518. }
  519. public override bool SetIndicator(Indicator light, IndicatorState op, out string reason)
  520. {
  521. reason = string.Empty;
  522. return execute(new handler<IndicatorHandler>(this,Name, light, op), out reason);
  523. }
  524. public bool SetOnlineMode(out string reason)
  525. {
  526. reason = string.Empty;
  527. return execute(new handler<ModHandler>(this, Name, Mode.ONMGV), out reason);
  528. }
  529. public override bool QueryState(out string reason)
  530. {
  531. reason = string.Empty;
  532. return execute(new handler<QueryStateHandler>(this, Name), out reason);
  533. }
  534. public override bool QueryIndicator(out string reason)
  535. {
  536. reason = string.Empty;
  537. return execute(new handler<QueryIndicatorHandler>(this, Name), out reason);
  538. }
  539. public override bool QueryWaferMap(out string reason)
  540. {
  541. reason = string.Empty;
  542. return execute(new handler<QueryWaferMappingHandler>(this, DeviceID), out reason);
  543. }
  544. public override bool QueryFOSBMode(out string reason)
  545. {
  546. reason = string.Empty;
  547. return execute(new handler<QueryFOSBModeHandler>(this, DeviceID), out reason);
  548. }
  549. public bool Move(MovType fun, out string reason)
  550. {
  551. if (State != DeviceState.Idle)
  552. {
  553. reason = $"LoadPort is in {State}";
  554. return false;
  555. }
  556. reason = string.Empty;
  557. return execute(new handler<MovHandler>(this, Name, fun), out reason);
  558. }
  559. //public bool Query(QueryType type, out string reason)
  560. //{
  561. // reason = string.Empty;
  562. // return execute(new handler<QueryWaferMappingHandler>(Name), out reason);
  563. //}
  564. public bool SetEvent(EvtType fun, out string reason)
  565. {
  566. reason = string.Empty;
  567. return execute(new handler<SetEventHandler>(this, Name, fun), out reason);
  568. }
  569. public bool OnEvent(out string reason)
  570. {
  571. reason = string.Empty;
  572. lock (_locker)
  573. {
  574. if (!execute(new handler<QueryStateHandler>(this, Name), out reason))
  575. return false;
  576. return execute(new handler<QueryIndicatorHandler>(this, Name), out reason);
  577. }
  578. }
  579. private bool execute(IHandler handler1, out string reason)
  580. {
  581. reason = string.Empty;
  582. lock (_locker)
  583. {
  584. if (_foregroundHandler == null)
  585. {
  586. if (!handler1.Execute(ref _port))
  587. {
  588. reason = "Communication failed, please recovery it.";
  589. return false;
  590. }
  591. _foregroundHandler = handler1;
  592. }
  593. else
  594. {
  595. var type = handler1.GetType();
  596. string name = type.Name;
  597. if (type.GenericTypeArguments.Length > 0)
  598. name = type.GenericTypeArguments[0].Name;
  599. LOG.Info(string.Format("Add command {0}", name));
  600. _handlers.Enqueue(handler1);
  601. }
  602. }
  603. return true;
  604. }
  605. private bool execute(out string reason)
  606. {
  607. reason = string.Empty;
  608. lock(_locker)
  609. {
  610. if (_handlers.Count > 0)
  611. {
  612. IHandler handler = _handlers.Dequeue();
  613. if (!handler.Execute(ref _port))
  614. {
  615. reason = " communication failed, please recovery it.";
  616. LOG.Error(reason);
  617. EV.PostMessage(Name, EventEnum.DefaultWarning, "【Reader】" + reason);
  618. return false;
  619. }
  620. _foregroundHandler = handler;
  621. }
  622. }
  623. return true;
  624. }
  625. private void OnDataChanged(string package)
  626. {
  627. try
  628. {
  629. package = package.ToUpper();
  630. string[] msgs = Regex.Split(package, delimiter);
  631. foreach (string msg in msgs)
  632. {
  633. if (msg.Length > min_len)
  634. {
  635. bool completed = false;
  636. string resp = msg.Substring(3, msg.Length - min_len);
  637. lock (_locker)
  638. {
  639. if (_foregroundHandler != null && _foregroundHandler.OnMessage(ref _port, resp, out completed))
  640. {
  641. string reason = string.Empty;
  642. if (!_foregroundHandler.IsBackground)
  643. {
  644. _foregroundHandler = null;
  645. execute(out reason);
  646. OnActionDone(true);
  647. }
  648. else
  649. {
  650. if (completed)
  651. {
  652. _foregroundHandler = null;
  653. QueryState(out reason);
  654. if (_foregroundHandler is handler<HomeHandler>)
  655. {
  656. QueryIndicator(out reason);
  657. }
  658. }
  659. }
  660. }
  661. else
  662. {
  663. _eventHandler.OnMessage(ref _port, resp, out completed); //process event
  664. }
  665. }
  666. }
  667. }
  668. }
  669. catch (ExcuteFailedException ex)
  670. {
  671. EV.PostWarningLog(Module, $"{Name} action failed, "+ex.Message);
  672. _foregroundHandler = null;
  673. OnError( $"{ Name} action failed");
  674. }
  675. catch (InvalidPackageException ex)
  676. {
  677. EV.PostWarningLog(Module, $"{Name} received unprocessed message, {ex.Message}" );
  678. OnError($"{Name} received unprocessed message");
  679. }
  680. catch (Exception ex)
  681. {
  682. LOG.Write($" {Name} has exception:" + ex.Message);
  683. }
  684. }
  685. private void OnErrorHandler(ErrorEventArgs args)
  686. {
  687. _commErr = true;
  688. Initalized = false;
  689. EV.PostAlarmLog(Module, $"{Display} Communication error, {args.Reason}");
  690. OnError($"{Display} Communication error");
  691. }
  692. public void OnCarrierNotPlaced()
  693. {
  694. _isPlaced = false;
  695. }
  696. public void OnCarrierNotPresent()
  697. {
  698. _isPresent = false;
  699. }
  700. public void OnCarrierPlaced()
  701. {
  702. //if (SC.ContainsItem("CarrierInfo.InfoPadType") && (SC.GetValue<int>("CarrierInfo.InfoPadType") == 0)) //0 is TDK sensor
  703. //{
  704. // int cindex = (IsInfoPadAOn ? 8 : 0) + (IsInfoPadBOn ? 4 : 0) + (IsInfoPadCOn ? 2 : 0) + (IsInfoPadDOn ? 1 : 0);
  705. // InfoPadCarrierIndex = cindex;
  706. // if (SC.ContainsItem($"CarrierInfo.CarrierName{cindex}"))
  707. // InfoPadCarrierType = SC.GetStringValue($"CarrierInfo.CarrierName{cindex}");
  708. // if (SC.ContainsItem($"CarrierInfo.{Name}CarrierIndex"))
  709. // SC.SetItemValue($"CarrierInfo.{Name}CarrierIndex", cindex);
  710. // LOG.Write($"{Name} detect carrier Type:{InfoPadCarrierType}");
  711. //}
  712. _isPlaced = true;
  713. _isPresent = true;
  714. }
  715. public void OnCarrierPresent()
  716. {
  717. _isPresent = true;
  718. }
  719. public void OnSwitchKey1()
  720. {
  721. _isAccessSwPressed = true;
  722. }
  723. public void OnSwitchKey2()
  724. {
  725. }
  726. public void OffSwitchKey1()
  727. {
  728. _isAccessSwPressed = false;
  729. }
  730. public void OffSwitchKey2()
  731. {
  732. }
  733. public void SetIndicator(Indicator led, IndicatorState state)
  734. {
  735. SetIndicator(led, state, out string reason);
  736. }
  737. //impment E84 interface
  738. public bool ReadyForLoad()
  739. {
  740. return CassetteState == LoadportCassetteState.Absent;
  741. }
  742. public bool ReadyForUnload()
  743. {
  744. return CassetteState == LoadportCassetteState.Normal;
  745. }
  746. public bool FoupArrirved()
  747. {
  748. return CassetteState == LoadportCassetteState.Normal;
  749. }
  750. public bool FoupRemoved()
  751. {
  752. return CassetteState == LoadportCassetteState.Absent;
  753. }
  754. public LPTransferState GetTransferState()
  755. {
  756. return LPTransferState.IN_SERVICE;
  757. }
  758. public LPAccessMode GetAccessMode()
  759. {
  760. return LPAccessMode.AUTO;
  761. }
  762. public LPReservedState GetReservedState()
  763. {
  764. return LPReservedState.NOT_RESERVED;
  765. }
  766. public void LPTSTrans(LPTransferState lpts)
  767. {
  768. return;
  769. }
  770. public bool IsSystemAutoMode()
  771. {
  772. return false;
  773. }
  774. public void SetAccessMode(bool isauto)
  775. {
  776. return;
  777. }
  778. public void E84Retry()
  779. {
  780. throw new NotImplementedException();
  781. }
  782. public void SetCompleted()
  783. {
  784. return;
  785. }
  786. }
  787. }