Handler.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306
  1. using System;
  2. using System.Text;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Sorter.Common;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.SubstrateTrackings;
  7. using System.Text.RegularExpressions;
  8. using Aitex.Core.RT.Log;
  9. using System.Collections.Generic;
  10. namespace Aitex.Sorter.RT.Device.Robot.NX100
  11. {
  12. /*
  13. * A command is transmitted from the host in the following format.
  14. * $ UNo (SeqNo) COMMAND Parameter Sum CR\
  15. * • $: Start mark (1 byte)
  16. Indicates the start of the message.
  17. • UNo: Unit No. (1 byte)
  18. Indicates the unit number
  19. • SeqNo: Sequence number (Non/1/2/3 bytes)
  20. Sequence number is used to avoid duplicate motion when sending of
  21. commands improperly. An integer parameter can specify the length of
  22. SeqNo. (Non/1/2/3 bytes). See parameter table for more details. (Default:
  23. Non), 设置 2bytes
  24. • Parameter: Parameter (Differs depending on the command.)
  25. Sets the operation axis, the moving amount, etc. following a command.
  26. • Sum: Checksum (2 bytes)
  27. This information is used for the communications error check.
  28. Calculate the sum of the ASCII characters (‘0’ to ‘9’ and ‘A’ to ‘F’), in “Uno”,
  29. “COMMAND” and “Parameter” section, and take the lowest tow digit.
  30. */
  31. public class handler<T> : IHandler where T : ITransferMsg, new()
  32. {
  33. public int ID { get; set; }
  34. public int Unit { get; set; }
  35. public bool IsBackground { get { return _imp.background; } }
  36. private static int retry_time = 3;
  37. private int retry_count = retry_time;
  38. private object[] _objs = null;
  39. private TokenGenerator _generator;
  40. private T _imp = new T();
  41. private List<string> _words = new List<string>();
  42. public handler()
  43. {
  44. }
  45. public handler(ref TokenGenerator gen, params object[] objs)
  46. {
  47. this._generator = gen;
  48. this._objs = objs;
  49. }
  50. public bool Execute<TPort>(ref TPort port) where TPort : ICommunication
  51. {
  52. retry_count = retry_time;
  53. ID = _generator.create();
  54. return port.Write(string.Format("{0}{1}{2}", ProtocolTag.tag_cmd_start, package().Replace(",", ""), ProtocolTag.tag_end));
  55. }
  56. /// <summary>
  57. /// return value: bhandle
  58. /// </summary>
  59. /// <typeparam name="TPort"></typeparam>
  60. /// <param name="port"></param>
  61. /// <param name="msg"></param>
  62. /// <param name="completed"></param>
  63. /// <returns></returns>
  64. ///
  65. public bool OnMessage<TPort>(ref TPort port, string message, out bool completed) where TPort : ICommunication
  66. {
  67. //$1E000003AC0300010
  68. //message = ">,1,EVNT,100,2018/11/16 17:01:06,2BA0,A1";
  69. //message = " !,1,36,40,2BA0,MTRS,002200,-0011931,-0610171,00179995,00049818,00186336,57";
  70. //message = "!,1,16,40,0000,MTCH,000483,-0011862,00000000,00179516,00090369,00172882,0A";
  71. //message = "$156000000RMAPC2FF01OK02OK03OK04OK05OK06OK07OK08OK09--10--11--12--13--14--15--16--17--18--19--20--21--22--23--24--25--96";
  72. //message =!283000000MALNE5.
  73. try
  74. {
  75. completed = false;
  76. string package = message;
  77. _words.Clear();
  78. string type = package.Substring(0,1);
  79. _words.Add(type);
  80. int unit = int.Parse(package.Substring(1, 1));
  81. _words.Add(package.Substring(1, 1));
  82. string sum = package.Substring(package.Length - 2, 2);
  83. string check = Checksum(package);
  84. if (sum != check)
  85. {
  86. throw (new InvalidPackageException(string.Format("check sum error{0}", package)));
  87. }
  88. if (type != ProtocolTag.resp_tag_event && type != ProtocolTag.resp_tag_error)
  89. {
  90. _words.Add(package.Substring(2, 2));
  91. int seq = int.Parse(package.Substring(2,2));
  92. if (seq != ID)
  93. return false;
  94. if (unit != Unit)
  95. {
  96. throw (new InvalidPackageException(string.Format("invalid unit {0}", package)));
  97. }
  98. }
  99. if (type == ProtocolTag.resp_tag_error)
  100. {
  101. //? Ackcd Sum CR
  102. string error = package.Substring(1,4);
  103. //‘1’: Warning 1 (W1), ‘2’: Warning 2 (W2), ‘3’: Important alarm 1 (A1), ‘4’: Important alarm 2 (A2),
  104. //‘5’: Serious alarm (F)
  105. if (error[0] != '1' || error[0] != '2')
  106. {
  107. string warning = string.Format("can't execute retry, {0}", error);
  108. LOG.Warning(warning);
  109. throw (new ExcuteFailedException(warning));
  110. }
  111. if (retry_count-- <= 0)
  112. {
  113. string warning = string.Format("retry over {0} times", retry_time);
  114. LOG.Warning(warning);
  115. throw (new ExcuteFailedException(warning));
  116. }
  117. port.Write(string.Format("{0}{1}{2}", ProtocolTag.tag_cmd_start, this.package(), ProtocolTag.tag_end));
  118. return true;
  119. }
  120. else if (type == ProtocolTag.resp_tag_event)
  121. {
  122. //0 1 2-3 4-7 8-10
  123. //> UNo SeqNo COMMAND EvNo EvData Sum CR
  124. //• COMMAND : Command (4 Byte) EVNT(Fixed length)
  125. //• EvNo: Event number(
  126. _words.Add(package.Substring(4, 4)); //stsN
  127. string evtType = package.Substring(8, 10);
  128. _words.Add(evtType); //Errcd
  129. string evtInfo = package.Substring(11, package.Length - 10 -2 );
  130. _words.Add(evtInfo); //Errcd
  131. if (_imp.evt)
  132. completed = _imp.unpackage(type, _words.ToArray());
  133. return _imp.evt;
  134. }
  135. else
  136. {
  137. //0 1 2,3 4,5 6-9
  138. //! UNo (SeqNo) StsN Errcd COMMAND Sum
  139. _words.Add(package.Substring(4, 2)); //stsN
  140. string error = package.Substring(6, 4);
  141. //int intError = Convert.ToInt32(error, 16);
  142. if (error != "0000")
  143. {
  144. string warning = string.Format("Robot execute failed, return error {0}", error);
  145. throw (new ExcuteFailedException(warning));
  146. }
  147. _words.Add(error); //Errcd
  148. _words.Add(package.Substring(10, package.Length - 10 -2)) ; //COMMAND
  149. completed = _imp.unpackage(type, _words.ToArray());
  150. if (completed)
  151. {
  152. _generator.release(ID);
  153. if (_imp.background)
  154. {
  155. ID = this._generator.create();
  156. port.Write(string.Format("{0}{1}{2}", ProtocolTag.tag_cmd_start, ackn(), ProtocolTag.tag_end));
  157. _generator.release(ID);
  158. }
  159. //wait 2ms
  160. return true;
  161. }
  162. return true;
  163. }
  164. }
  165. catch (ExcuteFailedException e)
  166. {
  167. throw (e);
  168. }
  169. catch (InvalidPackageException e)
  170. {
  171. throw e;
  172. }
  173. catch (Exception ex)
  174. {
  175. LOG.Write(ex);
  176. throw (new InvalidPackageException(message));
  177. }
  178. }
  179. private string Checksum(string package)
  180. {
  181. int start = package.IndexOf(ProtocolTag.cmd_token);
  182. int end = package.LastIndexOf(ProtocolTag.cmd_token);
  183. start = 1;
  184. end = package.Length - 2 - 1;
  185. int len = end - start + 1;
  186. if (len > 1)
  187. {
  188. string data = package.Substring(start, len);
  189. return Checksum(Encoding.Default.GetBytes(data));
  190. }
  191. return "";
  192. }
  193. private string Checksum(byte[] bytes)
  194. {
  195. int sum = 0;
  196. foreach (byte code in bytes)
  197. {
  198. sum += code;
  199. }
  200. string hex = String.Format("{0:X2}", sum % 256);
  201. return hex;
  202. }
  203. private string package()
  204. {
  205. //$,<UNo>(,<SeqNo>),<Command>,<Parameter>(,<Sum>)<CR>
  206. string data = string.Empty;
  207. data = string.Format("{0:D1}{1:D2}{2}", Unit, ID, _imp.package(this._objs).Replace(",",""));
  208. string sum = Checksum(Encoding.ASCII.GetBytes(data));
  209. return data + sum;
  210. }
  211. private string ackn()
  212. {
  213. //$<UNo>(<SeqNo>)ACKN(<Sum>)<CR>
  214. string data = string.Empty;
  215. data = string.Format("{0:D1}{1:D2}ACKN", Unit, ID);
  216. string sum = Checksum(Encoding.ASCII.GetBytes(data));
  217. return data + sum;
  218. }
  219. }
  220. public class RobotMotionHandler : ITransferMsg
  221. {
  222. public bool background { get; protected set; }
  223. public bool evt { get { return false; } }
  224. public string deviceID { private get; set; }
  225. public string _cmd = string.Empty;
  226. protected Robot _device;
  227. public RobotMotionHandler()
  228. {
  229. background = false;
  230. _device = DEVICE.GetDevice<Robot>(DeviceName.Robot);
  231. }
  232. public virtual string package(params object[] args)
  233. {
  234. return "";
  235. }
  236. public bool unpackage(string type, string[] items)
  237. {
  238. //! <UNo> (<SeqNo>) <StsN> <Errcd> MTRG <Sum> <CR>
  239. int value = Convert.ToInt32(items[3],16);
  240. _device.Status = value;
  241. int error = Convert.ToInt32(items[4], 16);
  242. _device.ErrorCode = error;
  243. if(error > 0)
  244. _device.LastErrorCode = error;
  245. if (type.Equals(ProtocolTag.resp_tag_excute))
  246. {
  247. //_device.ElapseTime = int.Parse(items[6]);
  248. //_device.Rotation = int.Parse(items[7]);
  249. //_device.Extension = int.Parse(items[8]);
  250. //_device.Wrist1= int.Parse(items[9]);
  251. //_device.Wrist2= int.Parse(items[10]);
  252. //_device.Evevation = int.Parse(items[11]);
  253. if (error == 0)
  254. {
  255. update(items);
  256. }
  257. return true;
  258. }
  259. return !background;
  260. }
  261. protected virtual void update(string[] data)
  262. {
  263. }
  264. }
  265. public class RbInitHandler : RobotMotionHandler
  266. {
  267. public RbInitHandler()
  268. {
  269. background = true;
  270. }
  271. public override string package(params object[] args)
  272. {
  273. //$ <UNo> (<SeqNo>) INIT<IMode> <Sum> <CR>
  274. // IMode: Initialization mode(2 Byte)
  275. //• ”00”: Error clear, servo ON and all axes move to home position
  276. //• ”01”: Servo ON and all axes move to home position
  277. //• ”05”: Error clear, servo ON and arm moves to home position.
  278. //• ”06”: Servo ON and arm moves to home position
  279. //• ”10”: Error clear and servo ON
  280. updateBefore();
  281. return ",INIT,00,";
  282. }
  283. protected void updateBefore()
  284. {
  285. _device.Blade1Target = ModuleName.Robot;
  286. _device.Blade2Target = ModuleName.Robot;
  287. }
  288. protected override void update(string[] data)
  289. {
  290. _device.Initalized = true;
  291. _device.Swap = false;
  292. }
  293. }
  294. public class RbHomeHandler : RobotMotionHandler
  295. {
  296. public RbHomeHandler()
  297. {
  298. background = true;
  299. }
  300. public override string package(params object[] args)
  301. {
  302. //$ < UNo > > (< SeqNo >) MHOM<MMode> < Sum > < CR >
  303. //• UNo: Unit number(1 byte)
  304. //• ‘1’ to ‘4’: Unit specified
  305. //• SeqNo: Sequence number(Non/ 1 / 2 / 3 byte)
  306. //• MMode: Motion mode(1 byte)
  307. //• ‘F’: All axes
  308. //• ‘A’: Arm(s) only
  309. updateBefore();
  310. return ",MHOM,F,";
  311. }
  312. protected void updateBefore()
  313. {
  314. _device.Blade1Target = ModuleName.Robot;
  315. _device.Blade2Target = ModuleName.Robot;
  316. }
  317. protected override void update(string[] data)
  318. {
  319. _device.Initalized = true;
  320. _device.Swap = false;
  321. }
  322. }
  323. public class RbClearErrorHandler : RobotMotionHandler
  324. {
  325. public RbClearErrorHandler()
  326. {
  327. background = true;
  328. }
  329. //$ <UNo> (<SeqNo>) CCLR <CMode> <Sum> <CR>
  330. public override string package(params object[] args)
  331. {
  332. //• CMode: Clear mode(1 byte)
  333. //• ‘E’: Releases the error status.
  334. //• ‘H’: Clears the error history.
  335. return ",CCLR,E,";
  336. }
  337. }
  338. public class RbGripHandler : RobotMotionHandler
  339. {
  340. Hand _hand;
  341. public RbGripHandler()
  342. {
  343. background = true;
  344. }
  345. //Command wafer hold/release signal to the solenoid of the specified unit.
  346. //$ <UNo> (<SeqNo>) CSOL <Fork> <Sw> <Sum> <CR>
  347. //• Fork: Fork specified(1 byte)
  348. //• ‘A’: Extension axis 1 (Blade 1), pre-aligner
  349. //• ‘B’: Extension axis 2 (Blade 2)
  350. //• Sw: Chucking command(1 byte)
  351. //• ‘0’: Chucking OFF
  352. //• ‘1’: Chucking ON
  353. public override string package(params object[] args)
  354. {
  355. _hand = (Hand)args[0];
  356. bool bHold = (bool)args[1];
  357. if(bHold)
  358. return string.Format(",CSOL,{0},1,",RobotConvertor.hand2string(_hand));
  359. return string.Format(",CSOL,{0},0,", RobotConvertor.hand2string(_hand));
  360. }
  361. }
  362. public class RbStopHandler : RobotMotionHandler
  363. {
  364. public RbStopHandler()
  365. {
  366. background = true;
  367. }
  368. //$ <UNo> (<SeqNo>) CHLTs <Sum> <CR>
  369. //Pause (decelerate and stop) the motion of the specified unit during the drive command execution.
  370. public override string package(params object[] args)
  371. {
  372. bool isEmergency = (bool)args[0];
  373. if (isEmergency)
  374. return ",CEMG,";
  375. //$ < UNo > (< SeqNo >) CHLT<Sum> < CR >
  376. return ",CHLT,";
  377. //return ",MHOM,F,";
  378. }
  379. }
  380. public class RbResumeHandler : RobotMotionHandler
  381. {
  382. public RbResumeHandler()
  383. {
  384. background = true;
  385. }
  386. //$ <UNo> (<SeqNo>) CRSM <Sum> <CR>
  387. public override string package(params object[] args)
  388. {
  389. return ",CRSM,";
  390. }
  391. }
  392. public class PickHandler : RobotMotionHandler
  393. {
  394. private ModuleName _chamber;
  395. private int _slot;
  396. private Hand _hand;
  397. public PickHandler()
  398. {
  399. background = true;
  400. }
  401. public override string package(params object[] args)
  402. {
  403. //Move To Ready position and wafer Get motion(MTRS+MGET)
  404. //$ <UNo> (<SeqNo>) MTRG <TrsSt> <SlotNo> <MtnMode> <Posture> <Sum> <CR>
  405. // • TrsSt: Transfer station(2 bytes)
  406. //• "C1" to "C8": When cassette stage specified
  407. //• "S1" to "SC": When transfer stage specified
  408. //• "P1" to “P2”: When P/ A stage specified
  409. //Note: P2 station is effective only when two or more PA stations exist.
  410. //• SlotNo: Slot number(2 bytes)
  411. //< Manipulator >
  412. //• "01" to "XX": When cassette stage is specified by < TrsST >
  413. //(The maximum value of "XX" is in the ASCII code of the number of slots specified by parameter.)
  414. //• "00": When transfer stage or P / A stage specified by < TrsSt >
  415. //• MtnMode: Motion mode(2 bytes)
  416. //• "GA": Wafer Get motion at extension axis 1(Blade 1).
  417. //• "GB": Wafer Get motion at extension axis 2(Blade 2).
  418. //• "GW": Wafer Get motion with extension axis 1 and 2(Blade 1 and 2). < WGet motion >
  419. _chamber = (ModuleName)args[0];
  420. _slot = (int)args[1];
  421. _hand = (Hand)args[2];
  422. updateBefore();
  423. if (_hand == Hand.Both)
  424. {
  425. return string.Format(",MTRG,{0},{1:D2},G{2},A,",
  426. RobotConvertor.chamber2staion(_chamber),
  427. RobotConvertor.chamberSlot2Slot(_chamber, _slot + 1) ,
  428. RobotConvertor.hand2string(_hand));
  429. }
  430. return string.Format(",MTRG,{0},{1:D2},G{2},A,",
  431. RobotConvertor.chamber2staion(_chamber),
  432. RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  433. RobotConvertor.hand2string(_hand));
  434. }
  435. private void updateBefore()
  436. {
  437. _device.Blade1Target = _chamber;
  438. _device.Blade2Target = _chamber;
  439. }
  440. protected override void update(string[] data)
  441. {
  442. if (_hand == Hand.Blade1)
  443. {
  444. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleName.Robot, (int)Hand.Blade1);
  445. }
  446. else if (_hand == Hand.Blade2)
  447. {
  448. for (int i = 0; i < _device.Blade2Slots; i++)
  449. WaferManager.Instance.WaferMoved(_chamber, _slot + i, ModuleName.Robot, (int)Hand.Blade2 + i);
  450. }
  451. else
  452. {
  453. for (int i = 0; i < _device.Blade2Slots + 1; i++)
  454. WaferManager.Instance.WaferMoved(_chamber, _slot + i, ModuleName.Robot, (int)Hand.Blade1 + i);
  455. }
  456. _device.Blade1Target = ModuleName.Robot;
  457. _device.Blade2Target = ModuleName.Robot;
  458. }
  459. }
  460. public class PlaceHandler : RobotMotionHandler
  461. {
  462. private ModuleName _chamber;
  463. private int _slot;
  464. private Hand _hand;
  465. public PlaceHandler()
  466. {
  467. background = true;
  468. }
  469. public override string package(params object[] args)
  470. {
  471. // $ <UNo> (<SeqNo>) MTRP <TrsSt> <SlotNo> <MtnMode> <Posture> <Sum> <CR>
  472. _chamber = (ModuleName)args[0];
  473. _slot = (int)args[1];
  474. _hand = (Hand)args[2];
  475. updateBefore();
  476. if (_hand == Hand.Both)
  477. {
  478. return string.Format(",MTRP,{0},{1:D2},P{2},A,",
  479. RobotConvertor.chamber2staion(_chamber),
  480. RobotConvertor.chamberSlot2Slot(_chamber, _slot + 1),
  481. RobotConvertor.hand2string(_hand));
  482. }
  483. return string.Format(",MTRP,{0},{1:D2},P{2},A,",
  484. RobotConvertor.chamber2staion(_chamber),
  485. RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  486. RobotConvertor.hand2string(_hand));
  487. }
  488. private void updateBefore()
  489. {
  490. _device.Blade1Target = _chamber;
  491. _device.Blade2Target = _chamber;
  492. }
  493. protected override void update(string[] data)
  494. {
  495. if (_hand == Hand.Blade1)
  496. {
  497. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade1, _chamber, _slot);
  498. }
  499. else if (_hand == Hand.Blade2)
  500. {
  501. for (int i = 0; i < _device.Blade2Slots; i++)
  502. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade2 +i, _chamber, _slot + i);
  503. }
  504. else
  505. {
  506. for (int i = 0; i < _device.Blade2Slots + 1; i++)
  507. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade1 + i, _chamber, _slot + i);
  508. }
  509. _device.Blade1Target = ModuleName.Robot;
  510. _device.Blade2Target = ModuleName.Robot;
  511. }
  512. }
  513. public class ExchangeHandler : RobotMotionHandler
  514. {
  515. private ModuleName _chamber;
  516. private int _slot;
  517. private Hand _hand;
  518. public ExchangeHandler()
  519. {
  520. background = true;
  521. }
  522. public override string package(params object[] args)
  523. {
  524. // $ <UNo> (<SeqNo>) MTRE <TrsSt> <SlotNo> <MtnMode> <Posture> <Sum> <CR>
  525. _chamber = (ModuleName)args[0];
  526. _slot = (int)args[1];
  527. _hand = (Hand)args[2];
  528. if (_hand == Hand.Blade1)
  529. _hand = Hand.Blade2;
  530. else
  531. _hand = Hand.Blade1;
  532. updateBefore();
  533. return string.Format(",MTRE,{0},{1:D2},E{2},A,",
  534. RobotConvertor.chamber2staion(_chamber),
  535. RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  536. RobotConvertor.hand2string(_hand));
  537. }
  538. private void updateBefore()
  539. {
  540. _device.Blade1Target = _chamber;
  541. _device.Blade2Target = _chamber;
  542. _device.Swap = true;
  543. _device.PlaceBalde = _hand;
  544. }
  545. protected override void update(string[] data)
  546. {
  547. if (_hand == Hand.Blade2)
  548. {
  549. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleName.Robot, (int)Hand.Blade2);
  550. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade1, _chamber, _slot);
  551. }
  552. else
  553. {
  554. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleName.Robot, (int)Hand.Blade1);
  555. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade2, _chamber, _slot);
  556. }
  557. _device.Swap = false;
  558. _device.Blade1Target = ModuleName.Robot;
  559. _device.Blade2Target = ModuleName.Robot;
  560. }
  561. }
  562. public class GotoHandler : RobotMotionHandler
  563. {
  564. private ModuleName _chamber;
  565. private int _slot;
  566. private Motion _next;
  567. private Hand _hand;
  568. public GotoHandler()
  569. {
  570. background = true;
  571. }
  572. public override string package(params object[] args)
  573. {
  574. //Move to ready position with specified adjustment offset
  575. //$<UNo>(<SeqNo>) MTRO <TrsSt> <SlotNo> <NextMtn> <Posture> <OffsetX> <OffsetY> <OffsetZ> <Sum>
  576. //• OffsetN: Offset(5 bytes each)
  577. //• OffsetX: X direction offset
  578. //• OffsetY: Y direction offset
  579. //• OffsetZ: Z direction offset
  580. //• Specified in the range between "-9999" and "99999"(Resolution: 0.01[mm])
  581. //• If value is less than 5 digits, fill the higher digit with ‘0’ so that the field always has 5 digits.
  582. _chamber = (ModuleName)args[0];
  583. _slot = (int)args[1];
  584. _next = (Motion)args[2];
  585. _hand = (Hand)args[3];
  586. int x = (int)args[4];
  587. int y = (int)args[5];
  588. int z = (int)args[6];
  589. updateBefore();
  590. return string.Format(",MTRO,{0},{1:D2},{2},A,{3},{4},{5}",
  591. RobotConvertor.chamber2staion(_chamber),
  592. RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  593. RobotConvertor.NextMotion2String(_next, _hand),
  594. RobotConvertor.Offset2String(x),
  595. RobotConvertor.Offset2String(y),
  596. RobotConvertor.Offset2String(z)
  597. ); ;
  598. }
  599. private void updateBefore()
  600. {
  601. if(_hand == Hand.Blade1)
  602. _device.Blade1Target = _chamber;
  603. else if (_hand == Hand.Blade2)
  604. _device.Blade2Target = _chamber;
  605. else
  606. {
  607. _device.Blade1Target = _chamber;
  608. _device.Blade2Target = _chamber;
  609. }
  610. }
  611. }
  612. public class PickHandlerEx : RobotMotionHandler
  613. {
  614. private ModuleName _chamber;
  615. private int _slot;
  616. private Hand _hand;
  617. public PickHandlerEx()
  618. {
  619. background = true;
  620. }
  621. public override string package(params object[] args)
  622. {
  623. //Move to ready position and get wafer with adjustment offset(MTRO+MGET)
  624. //$ < UNo > (< SeqNo >) MTGO<TrsSt> < SlotNo > < NextMtn > < Posture > < OffsetX > < OffsetY > < OffsetZ > < Sum > < CR >
  625. //• UNo: Unit number(1 byte)
  626. //• ‘1’ to ‘4’: Unit specified
  627. //• SeqNo: Sequence number(Non/ 1 / 2 / 3 byte)
  628. //• TrsSt: Transfer station(2 bytes)
  629. //• "C1" to "C8": When cassette stage specified
  630. //• "S1" to "SC": When transfer stage specified
  631. //• "P1" to “P2”: When P/ A stage specified
  632. //Note: P2 station is effective only when two or more PA stations exist.
  633. //• SlotNo: Slot number(2 bytes)
  634. //• "01" to "XX": When cassette stage specified by<TrsST>
  635. //(The maximum value of "XX" is in the ASCII code of the number of slots specified by parameter.)
  636. //• "00": When transfer stage or P / A stage specified by < TrsSt >
  637. //• NextMtn: Next motion mode(2 bytes)
  638. //• "GA": Next motion is wafer Get motion with extension axis 1(Blade 1).
  639. //• "GB": Next motion is wafer Get motion with extension axis 2(Blade 2).
  640. //• "GW": Next motion is wafer Get motion with extension axis 1 and 2(Blade 1 and 2). < WGet motion >
  641. //Note 1.The motion of extension axis 2(or blade 2) is available only for a dual-arm manipulator and dual blade
  642. //linear motion manipulator.
  643. //2.The WGet motion is available for a dual-arm manipulator and dual blade linear motion manipulator.
  644. _chamber = (ModuleName)args[0];
  645. _slot = (int)args[1];
  646. _hand = (Hand)args[2];
  647. int x = (int)args[3];
  648. int y = (int)args[4];
  649. int z = (int)args[5];
  650. updateBefore();
  651. if (_hand == Hand.Both)
  652. {
  653. return string.Format(",MTGO,{0},{1:D2},G{2},A,{3},{4},{5}",
  654. RobotConvertor.chamber2staion(_chamber),
  655. RobotConvertor.chamberSlot2Slot(_chamber, _slot + 1),
  656. RobotConvertor.hand2string(_hand),
  657. RobotConvertor.Offset2String(x),
  658. RobotConvertor.Offset2String(y),
  659. RobotConvertor.Offset2String(z)
  660. );
  661. }
  662. return string.Format(",MTGO,{0},{1:D2},G{2},A,{3},{4},{5}",
  663. RobotConvertor.chamber2staion(_chamber),
  664. RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  665. RobotConvertor.hand2string(_hand),
  666. RobotConvertor.Offset2String(x),
  667. RobotConvertor.Offset2String(y),
  668. RobotConvertor.Offset2String(z)
  669. );
  670. }
  671. private void updateBefore()
  672. {
  673. _device.Blade1Target = _chamber;
  674. _device.Blade2Target = _chamber;
  675. }
  676. protected override void update(string[] data)
  677. {
  678. if (_hand == Hand.Blade1)
  679. {
  680. WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleName.Robot, (int)Hand.Blade1);
  681. }
  682. else if (_hand == Hand.Blade2)
  683. {
  684. for (int i = 0; i < _device.Blade2Slots; i++)
  685. WaferManager.Instance.WaferMoved(_chamber, _slot + i, ModuleName.Robot, (int)Hand.Blade2 + i);
  686. }
  687. else
  688. {
  689. for (int i = 0; i < _device.Blade2Slots + 1; i++)
  690. WaferManager.Instance.WaferMoved(_chamber, _slot + i, ModuleName.Robot, (int)Hand.Blade1 + i);
  691. }
  692. _device.Blade1Target = ModuleName.Robot;
  693. _device.Blade2Target = ModuleName.Robot;
  694. }
  695. }
  696. public class PlaceHandlerEx : RobotMotionHandler
  697. {
  698. private ModuleName _chamber;
  699. private int _slot;
  700. private Hand _hand;
  701. public PlaceHandlerEx()
  702. {
  703. background = true;
  704. }
  705. public override string package(params object[] args)
  706. {
  707. _chamber = (ModuleName)args[0];
  708. _slot = (int)args[1];
  709. _hand = (Hand)args[2];
  710. int x = (int)args[3];
  711. int y = (int)args[4];
  712. int z = (int)args[5];
  713. updateBefore();
  714. if (_hand == Hand.Both)
  715. {
  716. return string.Format(",MTPO,{0},{1:D2},P{2},A,{3},{4},{5}",
  717. RobotConvertor.chamber2staion(_chamber),
  718. RobotConvertor.chamberSlot2Slot(_chamber, _slot + 1),
  719. RobotConvertor.hand2string(_hand),
  720. RobotConvertor.Offset2String(x),
  721. RobotConvertor.Offset2String(y),
  722. RobotConvertor.Offset2String(z)
  723. );
  724. }
  725. return string.Format(",MTPO,{0},{1:D2},P{2},A,{3},{4},{5}",
  726. RobotConvertor.chamber2staion(_chamber),
  727. RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  728. RobotConvertor.hand2string(_hand),
  729. RobotConvertor.Offset2String(x),
  730. RobotConvertor.Offset2String(y),
  731. RobotConvertor.Offset2String(z)
  732. );
  733. }
  734. private void updateBefore()
  735. {
  736. _device.Blade1Target = _chamber;
  737. _device.Blade2Target = _chamber;
  738. }
  739. protected override void update(string[] data)
  740. {
  741. if (_hand == Hand.Blade1)
  742. {
  743. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade1, _chamber, _slot);
  744. }
  745. else if (_hand == Hand.Blade2)
  746. {
  747. for (int i = 0; i < _device.Blade2Slots; i++)
  748. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade2 + i, _chamber, _slot + i);
  749. }
  750. else
  751. {
  752. for (int i = 0; i < _device.Blade2Slots + 1; i++)
  753. WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade1 + i, _chamber, _slot + i);
  754. }
  755. _device.Blade1Target = ModuleName.Robot;
  756. _device.Blade2Target = ModuleName.Robot;
  757. }
  758. }
  759. //not support with offset
  760. //public class ExchangeHandlerEx : RobotMotionHandler
  761. //{
  762. // private ModuleName _chamber;
  763. // private int _slot;
  764. // private Hand _hand;
  765. // public ExchangeHandlerEx()
  766. // {
  767. // background = true;
  768. // }
  769. // public override string package(params object[] args)
  770. // {
  771. // // $ <UNo> (<SeqNo>) MEXG <Sum> <CR>
  772. // _chamber = (ModuleName)args[0];
  773. // _slot = (int)args[1];
  774. // _hand = (Hand)args[2];
  775. // if (_hand == Hand.Blade1)
  776. // _hand = Hand.Blade2;
  777. // else
  778. // _hand = Hand.Blade1;
  779. // updateBefore();
  780. // int x = (int)args[3];
  781. // int y = (int)args[4];
  782. // int z = (int)args[5];
  783. // updateBefore();
  784. // if (_hand == Hand.Both)
  785. // {
  786. // return string.Format(",MTPO,{0},{1:D2},G{2},A,{3},{4},{5}",
  787. // RobotConvertor.chamber2staion(_chamber),
  788. // RobotConvertor.chamberSlot2Slot(_chamber, _slot + 1),
  789. // RobotConvertor.hand2string(_hand),
  790. // RobotConvertor.Offset2String(x),
  791. // RobotConvertor.Offset2String(y),
  792. // RobotConvertor.Offset2String(z)
  793. // );
  794. // }
  795. // return string.Format(",MTPO,{0},{1:D2},G{2},A,{3},{4},{5}",
  796. // RobotConvertor.chamber2staion(_chamber),
  797. // RobotConvertor.chamberSlot2Slot(_chamber, _slot),
  798. // RobotConvertor.hand2string(_hand),
  799. // RobotConvertor.Offset2String(x),
  800. // RobotConvertor.Offset2String(y),
  801. // RobotConvertor.Offset2String(z));
  802. // }
  803. // private void updateBefore()
  804. // {
  805. // _device.Blade1Target = _chamber;
  806. // _device.Blade2Target = _chamber;
  807. // _device.Swap = true;
  808. // _device.PlaceBalde = _hand;
  809. // }
  810. // protected override void update(string[] data)
  811. // {
  812. // if (_hand == Hand.Blade2)
  813. // {
  814. // WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleName.Robot, (int)Hand.Blade2);
  815. // WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade1, _chamber, _slot);
  816. // }
  817. // else
  818. // {
  819. // WaferManager.Instance.WaferMoved(_chamber, _slot, ModuleName.Robot, (int)Hand.Blade1);
  820. // WaferManager.Instance.WaferMoved(ModuleName.Robot, (int)Hand.Blade2, _chamber, _slot);
  821. // }
  822. // _device.Swap = false;
  823. // _device.Blade1Target = ModuleName.Robot;
  824. // _device.Blade2Target = ModuleName.Robot;
  825. // }
  826. //}
  827. public class RBWaferMappingHandler : RobotMotionHandler
  828. {
  829. private ModuleName _chamber;
  830. public RBWaferMappingHandler()
  831. {
  832. background = true;
  833. }
  834. public override string package(params object[] args)
  835. {
  836. //$ <UNo> (<SeqNo>) MMAP <TrsSt> <SlotNo> <Sum> <CR>
  837. // SlotNo: Slot number(2 bytes)
  838. //• "FF": When all slots specified
  839. //• ”01” to ”XX”: When cassette stage is specified by < TrsSt >
  840. //(The maximum value of "XX" is in ASCII code of the number of slots specified by parameter.)
  841. //• ”00”: When transfer stage or P / A stage specified by<TrsSt>
  842. // Note: Specific slot section definition cannot be performed.
  843. //• Reception rejected: Responds with the error code.
  844. _chamber = (ModuleName)args[0];
  845. //_slot = (int)args[1];
  846. //_hand = (Hand)args[2];
  847. updateBefore();
  848. return string.Format(",MMAP,{0},FF,",
  849. RobotConvertor.chamber2staion(_chamber));
  850. }
  851. private void updateBefore()
  852. {
  853. _device.Blade1Target = _chamber;
  854. _device.Blade2Target = _chamber;
  855. }
  856. }
  857. public class RBQueryWaferMapHandler : ITransferMsg
  858. {
  859. public bool background { get; protected set; }
  860. public bool evt { get { return false; } }
  861. public string deviceID { private get; set; }
  862. public string _cmd = string.Empty;
  863. private ModuleName _chamber;
  864. protected Robot _device;
  865. public RBQueryWaferMapHandler()
  866. {
  867. background = false;
  868. _device = DEVICE.GetDevice<Robot>(DeviceName.Robot);
  869. }
  870. //$ <UNo> (<SeqNo>) RMAP <TrsSt> <SlotNo> <Sum> <CR>
  871. public string package(params object[] args)
  872. {
  873. _chamber = (ModuleName)args[0];
  874. return string.Format(",RMAP,{0},FF,",
  875. RobotConvertor.chamber2staion(_chamber));
  876. }
  877. public bool unpackage(string type, string[] items)
  878. {
  879. //$,<UNo>(,<SeqNo>),<Sts>,<Ackcd>,RMAP,<TrsSt>,<Slot>,
  880. //01:<Result1>…,N:<ResultN>(,<Sum>)<CR>
  881. //• UNo : Unit number (1 byte)
  882. //• SeqNo : Sequence number (None / 2 bytes)
  883. //• Sts : Status (2 bytes)
  884. //• Ackcd : Response code (4 bytes)
  885. //• TrsSt : Transfer station (3 bytes)
  886. //• Slot : Slot number (2 bytes)
  887. //• Result* : Mapping result (2 bytes each)
  888. //• “--” : No wafer detected.
  889. //• “OK” : Wafer inserted correctly.
  890. //• “CW” : Wafer inserted incorrectly (inclined).
  891. //• “DW” : Wafer inserted incorrectly (duplicated).
  892. //Note) Responds with the number of slots of the specified transfer station.
  893. //$,1,00,0000,RMAP,C02,00,
  894. //01:OK,02:DW,03:OK,04:CW,05:CW,06:OK,07:OK,08:--,09:OK,10:OK
  895. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  896. if (items.Length > 5)
  897. {
  898. string data = items[5];
  899. StringBuilder sb = new StringBuilder();
  900. for (int i = 0; i < data.Length; i += 4)
  901. {
  902. string value = data.Substring(i + 2, 2);
  903. switch (value)
  904. {
  905. case "--":
  906. sb.Append("0");
  907. break;
  908. case "OK":
  909. sb.Append("1");
  910. break;
  911. case "CW":
  912. sb.Append("2");
  913. break;
  914. case "DW":
  915. sb.Append("W");
  916. break;
  917. }
  918. }
  919. _device.NotifySlotMapResult(_chamber, sb.ToString());
  920. return true;
  921. }
  922. return !background;
  923. }
  924. }
  925. // Transfer speed level setting
  926. public class RbSetSpeedHandler : RobotMotionHandler
  927. {
  928. private int _speed = 0;
  929. public RbSetSpeedHandler()
  930. {
  931. background = false;
  932. }
  933. public override string package(params object[] args)
  934. {
  935. _speed = (int)args[0];
  936. //$ < UNo > (< SeqNo >) SSLV<Level> < Sum > < CR >
  937. ///
  938. /// • ’H’ : High speed level
  939. //• ’M’ : Medium speed level
  940. //• ’L’ : Low speed level
  941. ///
  942. if(_speed == 1)
  943. return string.Format(",SSLV,H,");
  944. else if (_speed == 2)
  945. return string.Format(",SSLV,M,");
  946. return string.Format(",SSLV,L,");
  947. }
  948. }
  949. // Transfer speed level setting
  950. public class RbSetOffsetHandler : RobotMotionHandler
  951. {
  952. public RbSetOffsetHandler()
  953. {
  954. background = false;
  955. }
  956. public override string package(params object[] args)
  957. {
  958. //$ <UNo> (<SeqNo>) SOFS <Mem> <TrsSt> <Offset1> <Offset2> … <Offset5> <Sum> <CR>
  959. ///Mem: Memory (1 byte) ‘V’: Volatile memory ‘N’: Non -volatile memory
  960. //• TrsSt: Transfer station(2 bytes)
  961. //• "C1" to "C8": When cassette stage specified
  962. //• "S1" to "SC": When transfer stage specified
  963. //• "P1" to “P2”: When P/ A stage specified
  964. //Note: P2 station is effective only when two or more PA stations exist.
  965. //• Offset: Transfer offset(4 bytes each)
  966. //• Offset1: Downward offset
  967. //• Offset2: Upward offset
  968. //• Offset3: Offset in the extending direction(with the edge - grip - type fork)
  969. //• Offset4: Offset in the retracting direction(with the edge - grip - type fork)
  970. //• Offset5: Put downward offset(with the edge - grip - type fork)
  971. //Note: Offset3 to Offset5 are omitted when the fork type is not the edge - grip type.
  972. //• About Offset3 to Offset5, it is omissible with a parameter setup.
  973. //• Specified in the range between "-999" and "9999"(resolution: 0.01[mm])
  974. //• If a value is less than specified digits, fill the higher digit with ‘0’ so that the field always has specfied digits.
  975. ModuleName _chamber = (ModuleName)args[0];
  976. int down = (int)args[1];
  977. int up = (int)args[2];
  978. int extend = (int)args[2];
  979. int retract = (int)args[2];
  980. int pdown = (int)args[2];
  981. return string.Format(",SOFS,V,{0},{1:D4},{2:D4},{3:D4},{4:D4},",
  982. RobotConvertor.chamber2staion(_chamber),
  983. down,
  984. up,
  985. extend,
  986. retract,
  987. pdown
  988. );
  989. }
  990. }
  991. public class RBQueryStateHandler : ITransferMsg
  992. {
  993. public bool background { get; protected set; }
  994. public bool evt { get { return false; } }
  995. public string deviceID { private get; set; }
  996. public string _cmd = string.Empty;
  997. protected Robot _device;
  998. public RBQueryStateHandler()
  999. {
  1000. background = false;
  1001. _device = DEVICE.GetDevice<Robot>(DeviceName.Robot);
  1002. }
  1003. //$ <UNo> (<SeqNo>) <StsN> <Ackcd> <Sum> <CR>
  1004. //$ <UNo> (<SeqNo>) <StsN> <Ackcd> <Errcd> <Status1> … <Status4> <Sum> <CR>
  1005. public string package(params object[] args)
  1006. {
  1007. return ",RSTS,";
  1008. }
  1009. public bool unpackage(string type, string[] items)
  1010. {
  1011. return !background;
  1012. }
  1013. }
  1014. public class RbEventHandler : ITransferMsg
  1015. {
  1016. public bool background { get { return false; } }
  1017. public bool evt { get { return true; } }
  1018. public string deviceID { private get; set; }
  1019. public string _cmd = string.Empty;
  1020. protected Robot _device;
  1021. public RbEventHandler()
  1022. {
  1023. _device = DEVICE.GetDevice<Robot>(DeviceName.Robot);
  1024. }
  1025. //$,<UNo>(,<SeqNo>),RSTS(,<Sum>)<CR>
  1026. public string package(params object[] args)
  1027. {
  1028. return "";
  1029. }
  1030. public bool unpackage(string type, string[] items)
  1031. {
  1032. string evtType = items[3];
  1033. if (evtType.Equals(ProtocolTag.resp_evt_error))
  1034. {
  1035. int error = Convert.ToInt32(items[5], 16);
  1036. _device.ErrorCode = error;
  1037. if (error > 0)
  1038. _device.LastErrorCode = error;
  1039. return true;
  1040. }
  1041. return false;
  1042. }
  1043. }
  1044. public class RBQueryPositionHandler : ITransferMsg
  1045. {
  1046. public bool background { get; protected set; }
  1047. public bool evt { get { return false; } }
  1048. public string deviceID { private get; set; }
  1049. public string _cmd = string.Empty;
  1050. protected Robot _device;
  1051. public RBQueryPositionHandler()
  1052. {
  1053. background = false;
  1054. _device = DEVICE.GetDevice<Robot>(DeviceName.Robot);
  1055. }
  1056. //$ <UNo> (<SeqNo>) RPOS <TrsSt> <Fork> <Posture> <Sum> <CR>
  1057. // • TrsSt: Transfer station(2 bytes)
  1058. //• "C1" to "C8": When the lowest-layer position of the cassette stage specified
  1059. //• "H1" to "H8": When the highest-layer position of the cassette stage specified
  1060. //• "S1" to "SC": When transfer stage specified
  1061. //• "P1" to “P2”: When P/A stage specified
  1062. //Note: P2 station is effective only when two or more PA stations exist.
  1063. //• "FF": When current position specified
  1064. //• "FE": When specify the feedback of present location
  1065. //<Three-axis pre-aligner, Edge-grip pre-aligner>
  1066. //• "FF": When current position specified
  1067. //• "FE": When specify the feedback of present location
  1068. //• Fork: Fork specified(1 byte)
  1069. //• ‘A’: When extension axis 1 (Blade 1) specified
  1070. //• ‘B’: When extension axis 2 (Blade 2) specified(for dual-arm manipulator and dual blade linear motion
  1071. //manipulator only)
  1072. //Note: Fixed to ‘A’ when the current position and feedback of present location are specified at<TrsSt>
  1073. public string package(params object[] args)
  1074. {
  1075. return ",RPOS,FF,A,A,";
  1076. }
  1077. public bool unpackage(string type, string[] items)
  1078. {
  1079. //$ <UNo> (<SeqNo>) <StsN> <Ackcd> <Value1> … <ValueN> <Sum> <CR>
  1080. // • ValueN: Coordinate(8 bytes each)
  1081. //• Specified in the range as follows (The resolution is 0.01[mm] or[deg])
  1082. //8 Byte: between "-9999999" ~"99999999"
  1083. //• If a value is less than specified digits, fill the higher digit with ‘0’ so that the field always has specfied digits.
  1084. //• The sign is added to the highest digit.
  1085. //• The number of “ValueN” depends on the unit type.
  1086. //Responds with as many axis numbers as the specified unit has.See the table bellow.
  1087. //Unit Value1 Value2 Value3 Value4 Value5 Value6
  1088. //Single - arm manipulator Rotation //Elevation //(Track
  1089. //Dual - arm manipulator Rotation //Extension //axis 1 //axis 2 //(Track
  1090. if (items.Length > 7)
  1091. {
  1092. _device.Rotation = int.Parse(items[7]);
  1093. _device.Extension = int.Parse(items[8]);
  1094. _device.Wrist1 = int.Parse(items[9]);
  1095. _device.Wrist2 = int.Parse(items[10]);
  1096. _device.Evevation = int.Parse(items[11]);
  1097. return true;
  1098. }
  1099. return !background;
  1100. }
  1101. }
  1102. }