VceEntity.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Fsm;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.RT.OperationCenter;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using Aitex.Core.Utilities;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.Schedulers;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. using MECF.Framework.RT.ModuleLibrary.VceModules;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Linq;
  16. using System.Reflection;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19. using System.Windows;
  20. using Venus_Core;
  21. using Venus_RT.Devices;
  22. using Venus_RT.Devices.SMIF;
  23. using Venus_RT.Devices.TM;
  24. using Venus_RT.Devices.VCE;
  25. using Venus_RT.Modules.PMs;
  26. using Venus_RT.Modules.TM;
  27. using Venus_RT.Modules.TM.VenusEntity;
  28. namespace Venus_RT.Modules.VCE
  29. {
  30. #region 状态和消息
  31. public enum VceMSG
  32. {
  33. Home,
  34. Error,
  35. DoorOpen,
  36. DoorClose,
  37. Map,
  38. ReadMap,
  39. Load,
  40. UnLoad,
  41. LoadPrepare,
  42. LoadWithSMIF,
  43. UnLoadWithSMIF,
  44. Reset,
  45. Goto,
  46. GotoLP,
  47. SafeLoad,
  48. SafeUnload,
  49. Pump,
  50. Vent,
  51. Abort,
  52. None,
  53. ClearError
  54. }
  55. #endregion
  56. public class VceEntity : Entity, IEntity, IModuleEntity
  57. {
  58. private ModuleName _modulename;
  59. private readonly VceModuleBase _vce;
  60. private readonly ISMIF _smif;
  61. private bool _CassetteArrive;
  62. public bool IsIdle => fsm.State == (int)VceSTATE.Idle;
  63. public bool IsInit => fsm.State == (int)VceSTATE.Init || fsm.State == (int)VceSTATE.Unknown;
  64. public bool IsBusy => !IsInit && !IsError && !IsIdle;
  65. public bool IsError => fsm.State == (int)VceSTATE.Error;
  66. public bool VCEOutDoorClosed => !_vce.OutDoorIsOpen;
  67. public bool CassetteArrive => _CassetteArrive;
  68. public int CurrentSlot => currentSlot;
  69. private int currentSlot;
  70. private int targetSlot;
  71. private LoadRoutine _loadRoutine;
  72. private LoadPrepareRoutine _prepareRoutine;
  73. private UnloadRoutine _unloadRoutine;
  74. private LoadWithSMIFRoutine _loadwithSMIFRoutine;
  75. private UnloadWithSMIFRoutine _unloadwithSMIFRoutine;
  76. private readonly SEMFPumpRoutine _pumpRoutine;
  77. private readonly SEMFVentRoutine _ventRoutine;
  78. public VceEntity(ModuleName moduleName)
  79. {
  80. currentSlot = 0;
  81. _modulename = moduleName;
  82. _vce = new HongHuVce(25, _modulename);
  83. _smif = new FortrendPLUS500(_modulename);
  84. _loadRoutine = new LoadRoutine(_modulename, _vce);
  85. _prepareRoutine = new LoadPrepareRoutine(_modulename, _vce);
  86. _unloadRoutine = new UnloadRoutine(_modulename, _vce);
  87. _loadwithSMIFRoutine = new LoadWithSMIFRoutine(_modulename, _vce, _smif);
  88. _unloadwithSMIFRoutine = new UnloadWithSMIFRoutine(_modulename, _vce, _smif);
  89. if (moduleName == ModuleName.VCE1)
  90. {
  91. _pumpRoutine = new SEMFPumpRoutine(DEVICE.GetDevice<HongHuTM>("SETM"), _modulename);
  92. _ventRoutine = new SEMFVentRoutine(DEVICE.GetDevice<HongHuTM>("SETM"), _modulename);
  93. }
  94. else
  95. {
  96. _pumpRoutine = new SEMFPumpRoutine(DEVICE.GetDevice<HongHuDETM>("DETM"), _modulename);
  97. _ventRoutine = new SEMFVentRoutine(DEVICE.GetDevice<HongHuDETM>("DETM"), _modulename);
  98. }
  99. InitFsmMap();
  100. }
  101. protected override bool Init()
  102. {
  103. DATA.Subscribe($"{_modulename}.VCEOutDoorClosed", () => !VCEOutDoorClosed);
  104. DATA.Subscribe($"{_modulename}.CurrentSlot", () => currentSlot);
  105. DATA.Subscribe($"{_modulename}.FsmState", () => ((VceSTATE)fsm.State).ToString());
  106. DATA.Subscribe($"{_modulename}.CassetteArrive", () => CassetteArrive);
  107. //DATA.Subscribe($"{_modulename}.IsRunning", () => IsIdle);
  108. OP.Subscribe($"{_modulename}.HOME", (cmd, args) => { PostMsg(VceMSG.Home); return true; });
  109. OP.Subscribe($"{_modulename}.DoorOpen", (cmd, args) => { PostMsg(VceMSG.DoorOpen); return true; });
  110. OP.Subscribe($"{_modulename}.DoorClose", (cmd, args) => { PostMsg(VceMSG.DoorClose); return true; });
  111. OP.Subscribe($"{_modulename}.Map", (cmd, args) => { PostMsg(VceMSG.Map); return true; });
  112. OP.Subscribe($"{_modulename}.ReadMap", (cmd, args) => { PostMsg(VceMSG.ReadMap); return true; });
  113. OP.Subscribe($"{_modulename}.Load", (cmd, args) => { PostMsg(VceMSG.Load); return true; });
  114. OP.Subscribe($"{_modulename}.UnLoad", (cmd, args) => { PostMsg(VceMSG.UnLoad); return true; });
  115. OP.Subscribe($"{_modulename}.Reset", (cmd, args) => { PostMsg(VceMSG.Reset); return true; });
  116. OP.Subscribe($"{_modulename}.Goto", (cmd, args) => { PostMsg(VceMSG.Goto, args[0]); return true; });
  117. OP.Subscribe($"{_modulename}.GotoLP", (cmd, args) => { PostMsg(VceMSG.GotoLP); return true; });
  118. OP.Subscribe($"{_modulename}.Abort", (cmd, args) => { PostMsg(VceMSG.Abort); return true; });
  119. OP.Subscribe($"{_modulename}.PumpDown", (cmd, args) => { PostMsg(VceMSG.Pump); return true; });
  120. OP.Subscribe($"{_modulename}.Vent", (cmd, args) => { PostMsg(VceMSG.Vent); return true; });
  121. OP.Subscribe($"{_modulename}.ClearError", (cmd, args) => { PostMsg(VceMSG.ClearError); return true; });
  122. OP.Subscribe($"{_modulename}.LoadPrepare", (cmd, args) => { PostMsg(VceMSG.LoadPrepare); return true; });
  123. OP.Subscribe($"{_modulename}.SafeLoad", (cmd, args) => { PostMsg(VceMSG.SafeLoad); return true; });
  124. OP.Subscribe($"{_modulename}.SafeUnload", (cmd, args) => { PostMsg(VceMSG.SafeUnload); return true; });
  125. OP.Subscribe($"{_modulename}.LoadWithSMIF", (cmd, args) => { PostMsg(VceMSG.LoadWithSMIF); return true; });
  126. OP.Subscribe($"{_modulename}.UnLoadWithSMIF", (cmd, args) => { PostMsg(VceMSG.UnLoadWithSMIF); return true; });
  127. return true;
  128. }
  129. /// <summary>
  130. /// 定义状态机的迁移表
  131. /// </summary>
  132. private void InitFsmMap()
  133. {
  134. fsm = new StateMachine<VceEntity>(_modulename.ToString(), (int)VceSTATE.Init, 50);
  135. fsm.EnableRepeatedMsg(true);
  136. AnyStateTransition(VceMSG.Error, fnError, VceSTATE.Error);
  137. //AnyStateTransition(VceMSG.Abort, fnAbort, VceSTATE.Idle);
  138. AnyStateTransition(VceMSG.Home, fnStartHome, VceSTATE.Homing);
  139. AnyStateTransition(VceMSG.DoorOpen, fnStartOpenDoor, VceSTATE.DoorOpenning);
  140. //HOME init->homing idle->homing
  141. Transition(VceSTATE.Init, VceMSG.Home, fnStartHome, VceSTATE.Homing);
  142. Transition(VceSTATE.Idle, VceMSG.Home, fnStartHome, VceSTATE.Homing);
  143. Transition(VceSTATE.Error, VceMSG.Home, fnStartHome, VceSTATE.Homing);
  144. Transition(VceSTATE.Homing, FSM_MSG.TIMER, fnHomeTimeout, VceSTATE.Idle);
  145. //clear Error
  146. Transition(VceSTATE.Error, VceMSG.ClearError, fnStartClearError,VceSTATE.ClearError);
  147. Transition(VceSTATE.ClearError, FSM_MSG.TIMER, fnClearErrorTimeout, VceSTATE.Idle);
  148. //Open Door 开门
  149. Transition(VceSTATE.Idle, VceMSG.DoorOpen, fnStartOpenDoor, VceSTATE.DoorOpenning);
  150. Transition(VceSTATE.DoorOpenning, FSM_MSG.TIMER, fnOpenDoorTimeout, VceSTATE.Idle);
  151. //Close Door 关门
  152. Transition(VceSTATE.Idle, VceMSG.DoorClose, fnStartCloseDoor, VceSTATE.DoorClosing);
  153. Transition(VceSTATE.DoorClosing, FSM_MSG.TIMER, fnCloseDoorTimeout, VceSTATE.Idle);
  154. //Map 扫片
  155. Transition(VceSTATE.Idle, VceMSG.Map, fnStartMapping, VceSTATE.Mapping);
  156. Transition(VceSTATE.Mapping, FSM_MSG.TIMER, fnMappingTimeout, VceSTATE.Idle);
  157. //Load 取cassette
  158. Transition(VceSTATE.Idle, VceMSG.Load, fnStartLoading, VceSTATE.Loading);
  159. Transition(VceSTATE.Loading, FSM_MSG.TIMER, fnLoadingTimeout, VceSTATE.Idle);
  160. //UnLoad 放cassette
  161. Transition(VceSTATE.Idle, VceMSG.UnLoad, fnStartUnLoading, VceSTATE.UnLoading);
  162. Transition(VceSTATE.UnLoading, FSM_MSG.TIMER, fnUnLoadingTimeout, VceSTATE.Idle);
  163. //Goto 指定槽对准窗口
  164. Transition(VceSTATE.Idle, VceMSG.Goto, fnStartGoto, VceSTATE.Goting);
  165. Transition(VceSTATE.Goting, FSM_MSG.TIMER, fnGotingTimeout, VceSTATE.Idle);
  166. //ReadMap
  167. Transition(VceSTATE.Idle, VceMSG.ReadMap, fnStartReadingMap, VceSTATE.ReadingMap);
  168. Transition(VceSTATE.ReadingMap, FSM_MSG.TIMER, fnReadingMapTimeout, VceSTATE.Idle);
  169. //Load Prepare
  170. Transition(VceSTATE.Idle, VceMSG.LoadPrepare, fnStartLoadPrepare, VceSTATE.LoadPreparing);
  171. Transition(VceSTATE.LoadPreparing, FSM_MSG.TIMER, fnLoadingPrepareTimeout, VceSTATE.Idle);
  172. //Safe Load
  173. Transition(VceSTATE.Idle, VceMSG.SafeLoad, fnStartSafeLoad, VceSTATE.SafeLoading);
  174. Transition(VceSTATE.SafeLoading, FSM_MSG.TIMER, fnSafeLoadTimeout, VceSTATE.Idle);
  175. //LoadWithSMIF => LoadPrepare & SMIF Load & Load
  176. Transition(VceSTATE.Idle, VceMSG.LoadWithSMIF, fnStartLoadWithSMIF, VceSTATE.LoadingWithSMIF);
  177. Transition(VceSTATE.LoadingWithSMIF, FSM_MSG.TIMER, fnLoadWithSMIFTimeout, VceSTATE.Idle);
  178. //Safe UnLoad
  179. Transition(VceSTATE.Idle, VceMSG.SafeUnload, fnStartSafeUnLoad, VceSTATE.SafeUnloading);
  180. Transition(VceSTATE.SafeUnloading, FSM_MSG.TIMER, fnSafeUnLoadTimeout, VceSTATE.Idle);
  181. //UnLoad With SMIF => UnLoad with smif
  182. Transition(VceSTATE.Idle, VceMSG.UnLoadWithSMIF, fnStartUnLoadWithSMIF, VceSTATE.UnLoadingWithSMIF);
  183. Transition(VceSTATE.UnLoadingWithSMIF, FSM_MSG.TIMER, fnUnLoadWithSMIFTimeout, VceSTATE.Idle);
  184. //Goto LP
  185. Transition(VceSTATE.Idle, VceMSG.GotoLP, fnStartGotoLP, VceSTATE.GotingLP);
  186. Transition(VceSTATE.GotingLP, FSM_MSG.TIMER, fnGotoLPTimeout, VceSTATE.Idle);
  187. //Pump
  188. Transition(VceSTATE.Idle, VceMSG.Pump, fnStartPump, VceSTATE.Pumping);
  189. Transition(VceSTATE.Pumping, FSM_MSG.TIMER, fnPumpTimeout, VceSTATE.Idle);
  190. Transition(VceSTATE.Pumping, VceMSG.Abort, fnAbortPump, VceSTATE.Idle);
  191. //Vent
  192. Transition(VceSTATE.Idle, VceMSG.Vent, fnStartVent, VceSTATE.Venting);
  193. Transition(VceSTATE.Venting, FSM_MSG.TIMER, fnVentTimeout, VceSTATE.Idle);
  194. Transition(VceSTATE.Venting, VceMSG.Abort, fnAbortVent, VceSTATE.Idle);
  195. EnumLoop<VceSTATE>.ForEach((item) => { fsm.MapState((int)item, item.ToString()); });
  196. EnumLoop<VceMSG>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });
  197. Running = true;
  198. }
  199. private bool fnAbortVent(object[] param)
  200. {
  201. _ventRoutine.Abort();
  202. return true;
  203. }
  204. private bool fnVentTimeout(object[] param)
  205. {
  206. RState ret = _ventRoutine.Monitor();
  207. if (ret == RState.Timeout || ret == RState.Failed)
  208. {
  209. PostMsg(VceMSG.Error);
  210. return false;
  211. }
  212. return ret == RState.End;
  213. }
  214. private bool fnStartVent(object[] param)
  215. {
  216. return _ventRoutine.Start(param) == RState.Running;
  217. }
  218. private bool fnAbortPump(object[] param)
  219. {
  220. _pumpRoutine.Abort();
  221. return true;
  222. }
  223. private bool fnPumpTimeout(object[] param)
  224. {
  225. RState ret = _pumpRoutine.Monitor();
  226. if (ret == RState.Timeout || ret == RState.Failed)
  227. {
  228. PostMsg(VceMSG.Error);
  229. return false;
  230. }
  231. return ret == RState.End;
  232. }
  233. private bool fnStartPump(object[] param)
  234. {
  235. return _pumpRoutine.Start(param) == RState.Running;
  236. }
  237. private bool fnGotoLPTimeout(object[] param)
  238. {
  239. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  240. {
  241. PostMsg(VceMSG.Error);
  242. return false;
  243. }
  244. if (_vce.Status == RState.End)
  245. {
  246. currentSlot = targetSlot;
  247. }
  248. return _vce.Status == RState.End;
  249. }
  250. private bool fnStartGotoLP(object[] param)
  251. {
  252. if (_vce.GotoLP())
  253. {
  254. targetSlot = -1;
  255. return true;
  256. }
  257. else
  258. return false;
  259. }
  260. private bool fnSafeUnLoadTimeout(object[] param)
  261. {
  262. RState ret = _unloadRoutine.Monitor();
  263. if (ret == RState.Timeout || ret == RState.Failed)
  264. {
  265. PostMsg(VceMSG.Error);
  266. return false;
  267. }
  268. if (ret == RState.End)
  269. {
  270. _CassetteArrive = false;
  271. WaferManager.Instance.DeleteWafer(_modulename, 0, 25);
  272. }
  273. return ret == RState.End;
  274. }
  275. private bool fnStartClearError(object[] param)
  276. {
  277. if (_vce.ClearError())
  278. {
  279. return true;
  280. }
  281. else
  282. return false;
  283. }
  284. private bool fnClearErrorTimeout(object[] param)
  285. {
  286. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  287. {
  288. PostMsg(VceMSG.Error);
  289. return false;
  290. }
  291. if (_vce.Status == RState.End)
  292. {
  293. currentSlot = targetSlot;
  294. }
  295. return _vce.Status == RState.End;
  296. }
  297. private bool fnStartSafeUnLoad(object[] param)
  298. {
  299. return _unloadRoutine.Start(param) == RState.Running;
  300. }
  301. private bool fnSafeLoadTimeout(object[] param)
  302. {
  303. RState ret = _loadRoutine.Monitor();
  304. if (ret == RState.Timeout || ret == RState.Failed)
  305. {
  306. PostMsg(VceMSG.Error);
  307. return false;
  308. }
  309. if (ret == RState.End)
  310. {
  311. _CassetteArrive = true;
  312. }
  313. return ret == RState.End;
  314. }
  315. private bool fnStartLoadWithSMIF(object[] param)
  316. {
  317. return _loadwithSMIFRoutine.Start(param) == RState.Running;
  318. }
  319. private bool fnLoadWithSMIFTimeout(object[] param)
  320. {
  321. RState ret = _loadwithSMIFRoutine.Monitor();
  322. if (ret == RState.Timeout || ret == RState.Failed)
  323. {
  324. PostMsg(VceMSG.Error);
  325. return false;
  326. }
  327. if (ret == RState.End)
  328. {
  329. _CassetteArrive = true;
  330. }
  331. return ret == RState.End;
  332. }
  333. private bool fnStartUnLoadWithSMIF(object[] param)
  334. {
  335. return _unloadwithSMIFRoutine.Start(param) == RState.Running;
  336. }
  337. private bool fnUnLoadWithSMIFTimeout(object[] param)
  338. {
  339. RState ret = _unloadwithSMIFRoutine.Monitor();
  340. if (ret == RState.Timeout || ret == RState.Failed)
  341. {
  342. PostMsg(VceMSG.Error);
  343. return false;
  344. }
  345. if (ret == RState.End)
  346. {
  347. _CassetteArrive = false;
  348. WaferManager.Instance.DeleteWafer(_modulename, 0, 25);
  349. }
  350. return ret == RState.End;
  351. }
  352. private bool fnStartSafeLoad(object[] param)
  353. {
  354. return _loadRoutine.Start(param) == RState.Running;
  355. }
  356. private bool fnLoadingPrepareTimeout(object[] param)
  357. {
  358. RState ret = _prepareRoutine.Monitor();
  359. if (ret == RState.Timeout || ret == RState.Failed)
  360. {
  361. PostMsg(VceMSG.Error);
  362. return false;
  363. }
  364. return ret == RState.End;
  365. }
  366. private bool fnStartLoadPrepare(object[] param)
  367. {
  368. return _prepareRoutine.Start(param) == RState.Running;
  369. }
  370. private bool fnReadingMapTimeout(object[] param)
  371. {
  372. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  373. {
  374. PostMsg(VceMSG.Error);
  375. return false;
  376. }
  377. return _vce.Status == RState.End;
  378. }
  379. private bool fnStartReadingMap(object[] param)
  380. {
  381. return _vce.ReadMap();
  382. }
  383. //急停
  384. private bool fnAbort(object[] param)
  385. {
  386. return true;
  387. }
  388. //升降到槽位
  389. private bool fnStartGoto(object[] param)
  390. {
  391. if (_vce.Goto(Convert.ToInt32(param[0])))
  392. {
  393. targetSlot = Convert.ToInt32(param[0]);
  394. return true;
  395. }
  396. else
  397. return false;
  398. }
  399. private bool fnGotingTimeout(object[] param)
  400. {
  401. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  402. {
  403. PostMsg(VceMSG.Error);
  404. return false;
  405. }
  406. if(_vce.Status == RState.End)
  407. currentSlot = targetSlot;
  408. return _vce.Status == RState.End;
  409. }
  410. private bool fnError(object[] param)
  411. {
  412. return true;
  413. }
  414. private bool fnStartHome(object[] param)
  415. {
  416. return _vce.HomeALL();
  417. }
  418. private bool fnHomeTimeout(object[] param)
  419. {
  420. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  421. {
  422. PostMsg(VceMSG.Error);
  423. return false;
  424. }
  425. return _vce.Status == RState.End;
  426. }
  427. private bool fnStartOpenDoor(object[] param)
  428. {
  429. //卡压差
  430. if (Singleton<RouteManager>.Instance.seTM.VCEIsATM(_modulename) &&
  431. Singleton<RouteManager>.Instance.seTM.VCEPressure(_modulename) >= SC.GetValue<int>($"{_modulename}.OutDoorOpenPressure"))
  432. {
  433. //卡状态
  434. if (IsIdle || IsError && _vce.IsDashWaferError)
  435. return _vce.OpenDoor();
  436. else
  437. {
  438. LOG.Write(eEvent.WARN_VCE_COMMON_WARN,_modulename,$"Current Status is {(VceSTATE)fsm.State} && not Dash Wafer Error Cannot Open Door.");
  439. return false;
  440. }
  441. }
  442. else
  443. {
  444. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _modulename, $"{_modulename} is not ATM or Pressure not arrive {SC.GetValue<int>($"{_modulename}.OutDoorOpenPressure")}");
  445. return false;
  446. }
  447. }
  448. private bool fnOpenDoorTimeout(object[] param)
  449. {
  450. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  451. {
  452. PostMsg(VceMSG.Error);
  453. return false;
  454. }
  455. return _vce.Status == RState.End;
  456. }
  457. private bool fnStartCloseDoor(object[] param)
  458. {
  459. return _vce.CloseDoor();
  460. }
  461. private bool fnCloseDoorTimeout(object[] param)
  462. {
  463. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  464. {
  465. PostMsg(VceMSG.Error);
  466. return false;
  467. }
  468. return _vce.Status == RState.End;
  469. }
  470. private bool fnStartMapping(object[] param)
  471. {
  472. return _vce.Map();
  473. }
  474. private bool fnMappingTimeout(object[] param)
  475. {
  476. if(_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  477. {
  478. PostMsg(VceMSG.Error);
  479. return false;
  480. }
  481. return _vce.Status == RState.End;
  482. }
  483. private bool fnStartLoading(object[] param)
  484. {
  485. return _vce.Load();
  486. }
  487. private bool fnLoadingTimeout(object[] param)
  488. {
  489. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  490. {
  491. PostMsg(VceMSG.Error);
  492. return false;
  493. }
  494. return _vce.Status == RState.End;
  495. }
  496. private bool fnStartUnLoading(object[] param)
  497. {
  498. return _vce.UnLoad();
  499. }
  500. private bool fnUnLoadingTimeout(object[] param)
  501. {
  502. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  503. {
  504. PostMsg(VceMSG.Error);
  505. return false;
  506. }
  507. return _vce.Status == RState.End;
  508. }
  509. public bool Check(int msg, out string reason, params object[] args)
  510. {
  511. reason = "";
  512. return true;
  513. }
  514. public int Invoke(string function, params object[] args)
  515. {
  516. switch (function)
  517. {
  518. case "Home":
  519. CheckToPostMessage((int)VceMSG.Home);
  520. return (int)VceMSG.Home;
  521. }
  522. return (int)VceMSG.None;
  523. }
  524. public bool CheckToPostMessage(int msg, params object[] args)
  525. {
  526. if (!fsm.FindTransition(fsm.State, msg))
  527. {
  528. LOG.Write(eEvent.WARN_FSM_WARN, _modulename, $"{_modulename} is in {(VceSTATE)fsm.State} state,can not do {(VceMSG)msg}");
  529. return false;
  530. }
  531. Running = true;
  532. fsm.PostMsg(msg, args);
  533. return true;
  534. }
  535. public bool CheckAcked(int msg)
  536. {
  537. return fsm.CheckExecuted(msg);
  538. }
  539. public bool IsPrepareTransferReady(ModuleName module, EnumTransferType transferType, int slot)
  540. {
  541. return false;
  542. }
  543. }
  544. }