TruPlasmaRF1000Handler.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. using Aitex.Core.Common.DeviceData;
  2. using MECF.Framework.Common.Communications;
  3. using MECF.Framework.Common.Utilities;
  4. using Newtonsoft.Json.Linq;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.RFs.TruPlasmaRF
  10. {
  11. public abstract class TruPlasmaRF1000Handler : HandlerBase
  12. {
  13. public TruPlasmaRF1000 Device { get; }
  14. public string _command;
  15. protected string _parameter;
  16. protected TruPlasmaRF1000Handler(TruPlasmaRF1000 device, string command, string parameter = null)
  17. : base(BuildMessage(ToByteArray(command), ToByteArray(parameter)))
  18. {
  19. Device = device;
  20. _command = command;
  21. _parameter = parameter;
  22. Name = command;
  23. }
  24. protected TruPlasmaRF1000Handler(TruPlasmaRF1000 device, string command, byte[] parameter)
  25. : base(BuildMessage(ToByteArray(command), parameter))
  26. {
  27. Device = device;
  28. _command = command;
  29. //_parameter = parameter;
  30. Name = command;
  31. }
  32. private static byte _GS = 0x00;
  33. //private static byte _stop = 0x55;
  34. private static byte[] BuildMessage(byte[] commandArray, byte[] argumentArray)
  35. {
  36. List<byte> buffer = new List<byte>();
  37. int length = 1 + (commandArray != null ? commandArray.Length : 0) + (argumentArray != null ? argumentArray.Length : 0);
  38. buffer.Add((byte)length);
  39. buffer.Add(_GS);
  40. if (commandArray != null && commandArray.Length > 0)
  41. {
  42. //skip ManualExecuteCommand
  43. if (!(commandArray.Length == 1 && commandArray[0] == 0))
  44. {
  45. buffer.AddRange(commandArray);
  46. }
  47. }
  48. if (argumentArray != null && argumentArray.Length > 0)
  49. {
  50. buffer.AddRange(argumentArray);
  51. }
  52. return buffer.ToArray();
  53. }
  54. public override bool HandleMessage(MessageBase msg, out bool transactionComplete)
  55. {
  56. TruPlasmaRF1000Message response = msg as TruPlasmaRF1000Message;
  57. ResponseMessage = msg;
  58. if (response.IsError)
  59. {
  60. Device.NoteError(response.ErrorCode);
  61. }
  62. else
  63. {
  64. Device.NoteError(null);
  65. }
  66. if (response.IsAck)
  67. {
  68. SetState(EnumHandlerState.Acked);
  69. }
  70. if (this.IsAcked && response.IsComplete)
  71. {
  72. if(response.Command == _command)
  73. {
  74. SetState(EnumHandlerState.Completed);
  75. transactionComplete = true;
  76. return true;
  77. }
  78. else
  79. Device.NoteError($"command mismatch set command={_command} response command={response.Command}");
  80. }
  81. transactionComplete = false;
  82. return false;
  83. }
  84. protected static byte[] ToByteArray(string parameter)
  85. {
  86. if (parameter == null)
  87. return new byte[] { };
  88. return parameter.Split(',').Select(para => Convert.ToByte(para, 16)).ToArray();
  89. }
  90. }
  91. public class TruPlasmaRF1000RawCommandHandler : TruPlasmaRF1000Handler
  92. {
  93. public TruPlasmaRF1000RawCommandHandler(TruPlasmaRF1000 device, string command, string parameter = null)
  94. : base(device, command, parameter)
  95. {
  96. }
  97. public override bool HandleMessage(MessageBase msg, out bool handled)
  98. {
  99. if(base.HandleMessage(msg, out handled))
  100. {
  101. var result = msg as TruPlasmaRF1000Message;
  102. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  103. }
  104. return true;
  105. }
  106. }
  107. //public class TruPlasmaRF1000ReleaseControlHandler : TruPlasmaRF1000Handler
  108. //{
  109. // public TruPlasmaRF1000ReleaseControlHandler(TruPlasmaRF1000 device)
  110. // : base(device, "05,02,00,00", "FF")
  111. // {
  112. // }
  113. // public override bool HandleMessage(MessageBase msg, out bool handled)
  114. // {
  115. // if (base.HandleMessage(msg, out handled))
  116. // {
  117. // var result = msg as TruPlasmaRF1000Message;
  118. // Device.NoteInterfaceActived(false);
  119. // }
  120. // return true;
  121. // }
  122. //}
  123. //Pi=forward power
  124. public class TruPlasmaRF1000PreSetPiValueHandler : TruPlasmaRF1000Handler
  125. {
  126. private static byte _STAT = 0x00;//No error, data follows.
  127. private static byte _TYP = 0x06;//UINT16
  128. public TruPlasmaRF1000PreSetPiValueHandler(TruPlasmaRF1000 device, int piValue)
  129. : base(device, "02,09,00,01", IntToByteArray(piValue))
  130. {
  131. }
  132. private static byte[] IntToByteArray(int num)
  133. {
  134. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  135. tmp.AddRange(BitConverter.GetBytes((ushort)num));
  136. return tmp.ToArray();
  137. }
  138. public override bool HandleMessage(MessageBase msg, out bool handled)
  139. {
  140. if (base.HandleMessage(msg, out handled))
  141. {
  142. var result = msg as TruPlasmaRF1000Message;
  143. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  144. }
  145. return true;
  146. }
  147. }
  148. //Pi=forward power
  149. public class TruPlasmaRF1000ReadPiValueHandler : TruPlasmaRF1000Handler
  150. {
  151. public TruPlasmaRF1000ReadPiValueHandler(TruPlasmaRF1000 device)
  152. : base(device, "01,0C,00,01", "FF")
  153. {
  154. }
  155. public override bool HandleMessage(MessageBase msg, out bool handled)
  156. {
  157. if (base.HandleMessage(msg, out handled))
  158. {
  159. var result = msg as TruPlasmaRF1000Message;
  160. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  161. if(result.Data != null && result.Data.Length == 4)
  162. {
  163. Device.ForwardPower = BitConverter.ToUInt32(result.Data, 0);
  164. }
  165. }
  166. return true;
  167. }
  168. }
  169. //Pr=Reflected power
  170. public class TruPlasmaRF1000ReadPrValueHandler : TruPlasmaRF1000Handler
  171. {
  172. public TruPlasmaRF1000ReadPrValueHandler(TruPlasmaRF1000 device)
  173. : base(device, "01,0D,00,01", "FF")
  174. {
  175. }
  176. public override bool HandleMessage(MessageBase msg, out bool handled)
  177. {
  178. if (base.HandleMessage(msg, out handled))
  179. {
  180. var result = msg as TruPlasmaRF1000Message;
  181. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  182. if (result.Data != null && result.Data.Length == 4)
  183. {
  184. Device.ReflectPower = BitConverter.ToUInt32(result.Data, 0);
  185. }
  186. }
  187. return true;
  188. }
  189. }
  190. public class TruPlasmaRF1000ReadProcessStatusHandler : TruPlasmaRF1000Handler
  191. {
  192. public TruPlasmaRF1000ReadProcessStatusHandler(TruPlasmaRF1000 device)
  193. : base(device, "01,1E,00,01", "FF")
  194. {
  195. }
  196. public override bool HandleMessage(MessageBase msg, out bool handled)
  197. {
  198. if (base.HandleMessage(msg, out handled))
  199. {
  200. var result = msg as TruPlasmaRF1000Message;
  201. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  202. if (result.Data != null && result.Data.Length > 0)
  203. {
  204. //Bit 0 = Alarm is pending.
  205. var status = result.Data[0];
  206. Device.IsError = (status & 0x01) > 0;
  207. }
  208. }
  209. return true;
  210. }
  211. }
  212. public class TruPlasmaRF1000SetPowerOnOffHandler : TruPlasmaRF1000Handler
  213. {
  214. private static byte _STAT = 0x00;//No error, data follows.
  215. private static byte _TYP = 0x07;//UINT32
  216. public TruPlasmaRF1000SetPowerOnOffHandler(TruPlasmaRF1000 device, bool isOn)
  217. : base(device, "02,6F,00,01", IntToByteArray(isOn ? 1: 0))
  218. {
  219. }
  220. private static byte[] IntToByteArray(int num)
  221. {
  222. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  223. tmp.AddRange(BitConverter.GetBytes((uint)num));
  224. return tmp.ToArray();
  225. }
  226. public override bool HandleMessage(MessageBase msg, out bool handled)
  227. {
  228. if (base.HandleMessage(msg, out handled))
  229. {
  230. var result = msg as TruPlasmaRF1000Message;
  231. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  232. }
  233. return true;
  234. }
  235. }
  236. public class TruPlasmaRF1000ReadPowerOnOffHandler : TruPlasmaRF1000Handler
  237. {
  238. public TruPlasmaRF1000ReadPowerOnOffHandler(TruPlasmaRF1000 device)
  239. : base(device, "01,6F,00,01", "FF")
  240. {
  241. }
  242. private static byte[] IntToByteArray(int num)
  243. {
  244. byte[] bytes = BitConverter.GetBytes(num);
  245. return bytes;
  246. }
  247. public override bool HandleMessage(MessageBase msg, out bool handled)
  248. {
  249. if (base.HandleMessage(msg, out handled))
  250. {
  251. var result = msg as TruPlasmaRF1000Message;
  252. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  253. if (result.Data != null && result.Data.Length == 4)
  254. {
  255. Device.IsPowerOn = BitConverter.ToUInt32(result.Data, 0) > 0;
  256. }
  257. }
  258. return true;
  259. }
  260. }
  261. public class TruPlasmaRF1000SetPulseModeHandler : TruPlasmaRF1000Handler
  262. {
  263. private static byte _STAT = 0x00;//No error, data follows.
  264. private static byte _TYP = 0x04;//INT32
  265. public TruPlasmaRF1000SetPulseModeHandler(TruPlasmaRF1000 device, EnumRfPowerWorkMode pulseMode)
  266. : base(device, "02,6A,01,01", IntToByteArray(pulseMode == EnumRfPowerWorkMode.PulsingMode ? 1 : 0))
  267. {
  268. }
  269. private static byte[] IntToByteArray(int num)
  270. {
  271. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  272. tmp.AddRange(BitConverter.GetBytes(num));
  273. return tmp.ToArray();
  274. }
  275. public override bool HandleMessage(MessageBase msg, out bool handled)
  276. {
  277. if (base.HandleMessage(msg, out handled))
  278. {
  279. var result = msg as TruPlasmaRF1000Message;
  280. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  281. }
  282. return true;
  283. }
  284. }
  285. public class TruPlasmaRF1000ReadPulseModeHandler : TruPlasmaRF1000Handler
  286. {
  287. public TruPlasmaRF1000ReadPulseModeHandler(TruPlasmaRF1000 device)
  288. : base(device, "01,6A,01,01", "FF")
  289. {
  290. }
  291. private static byte[] IntToByteArray(int num)
  292. {
  293. byte[] bytes = BitConverter.GetBytes(num);
  294. return bytes;
  295. }
  296. public override bool HandleMessage(MessageBase msg, out bool handled)
  297. {
  298. if (base.HandleMessage(msg, out handled))
  299. {
  300. var result = msg as TruPlasmaRF1000Message;
  301. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  302. if (result.Data != null && result.Data.Length == 4)
  303. {
  304. Device.WorkMode = BitConverter.ToInt32(result.Data, 0) == 1 ? EnumRfPowerWorkMode.PulsingMode : EnumRfPowerWorkMode.ContinuousWaveMode;
  305. }
  306. }
  307. return true;
  308. }
  309. }
  310. //820
  311. public class TruPlasmaRF1000SetFreqHandler : TruPlasmaRF1000Handler
  312. {
  313. private static byte _STAT = 0x00;//No error, data follows.
  314. private static byte _TYP = 0x04;//INT32
  315. //unit is Hz
  316. //the colck offset ode must be set to FrequencyOffset
  317. public TruPlasmaRF1000SetFreqHandler(TruPlasmaRF1000 device, int freq)
  318. : base(device, "02,34,03,01", IntToByteArray(freq))
  319. {
  320. }
  321. private static byte[] IntToByteArray(int num)
  322. {
  323. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  324. tmp.AddRange(BitConverter.GetBytes(num));
  325. return tmp.ToArray();
  326. }
  327. public override bool HandleMessage(MessageBase msg, out bool handled)
  328. {
  329. if (base.HandleMessage(msg, out handled))
  330. {
  331. var result = msg as TruPlasmaRF1000Message;
  332. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  333. }
  334. return true;
  335. }
  336. }
  337. public class TruPlasmaRF1000ReadFreqHandler : TruPlasmaRF1000Handler
  338. {
  339. public TruPlasmaRF1000ReadFreqHandler(TruPlasmaRF1000 device)
  340. : base(device, "01,63,00,01", "FF")
  341. {
  342. }
  343. private static byte[] IntToByteArray(int num)
  344. {
  345. byte[] bytes = BitConverter.GetBytes(num);
  346. return bytes;
  347. }
  348. public override bool HandleMessage(MessageBase msg, out bool handled)
  349. {
  350. if (base.HandleMessage(msg, out handled))
  351. {
  352. var result = msg as TruPlasmaRF1000Message;
  353. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  354. if (result.Data != null && result.Data.Length == 4)
  355. {
  356. Device.Frequency = BitConverter.ToUInt32(result.Data, 0)/1000.0f;//unit=Hz to kHz
  357. }
  358. }
  359. return true;
  360. }
  361. }
  362. //866
  363. public class TruPlasmaRF1000SetClockModeHandler : TruPlasmaRF1000Handler
  364. {
  365. private static byte _STAT = 0x00;//No error, data follows.
  366. private static byte _TYP = 0x05;//UINT8
  367. //0=manual;1=auto
  368. public TruPlasmaRF1000SetClockModeHandler(TruPlasmaRF1000 device, EnumRfPowerClockMode clockMode)
  369. : base(device, "02,62,03,01", IntToByteArray(GetValue(clockMode)))
  370. {
  371. }
  372. private static int GetValue(EnumRfPowerClockMode clockMode)
  373. {
  374. if (clockMode == EnumRfPowerClockMode.FreqAuto)
  375. return 1;
  376. if (clockMode == EnumRfPowerClockMode.FreqManual)
  377. return 0;
  378. return 0;
  379. }
  380. private static byte[] IntToByteArray(int num)
  381. {
  382. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  383. tmp.Add((byte)num);
  384. return tmp.ToArray();
  385. }
  386. public override bool HandleMessage(MessageBase msg, out bool handled)
  387. {
  388. if (base.HandleMessage(msg, out handled))
  389. {
  390. var result = msg as TruPlasmaRF1000Message;
  391. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  392. }
  393. return true;
  394. }
  395. }
  396. public class TruPlasmaRF1000ReadClockModeHandler : TruPlasmaRF1000Handler
  397. {
  398. public TruPlasmaRF1000ReadClockModeHandler(TruPlasmaRF1000 device)
  399. : base(device, "01,62,03,01", "FF")
  400. {
  401. }
  402. private static byte[] IntToByteArray(int num)
  403. {
  404. byte[] bytes = BitConverter.GetBytes(num);
  405. return bytes;
  406. }
  407. public override bool HandleMessage(MessageBase msg, out bool handled)
  408. {
  409. if (base.HandleMessage(msg, out handled))
  410. {
  411. var result = msg as TruPlasmaRF1000Message;
  412. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  413. if (result.Data != null && result.Data.Length > 0)
  414. {
  415. Device.ClockMode = GetMode(result.Data[0]);
  416. }
  417. }
  418. return true;
  419. }
  420. private EnumRfPowerClockMode GetMode(int mode)
  421. {
  422. if (mode == 1)
  423. return EnumRfPowerClockMode.FreqAuto;
  424. if (mode == 0)
  425. return EnumRfPowerClockMode.FreqManual;
  426. return EnumRfPowerClockMode.FreqAuto;
  427. }
  428. }
  429. public class TruPlasmaRF1000SetGainHandler : TruPlasmaRF1000Handler
  430. {
  431. private static byte _STAT = 0x00;//No error, data follows.
  432. private static byte _TYP = 0x06;//UINT16
  433. public TruPlasmaRF1000SetGainHandler(TruPlasmaRF1000 device, int gain)
  434. : base(device, "02,5C,03,01", IntToByteArray(gain))
  435. {
  436. }
  437. private static byte[] IntToByteArray(int num)
  438. {
  439. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  440. tmp.AddRange(BitConverter.GetBytes((ushort)num));
  441. return tmp.ToArray();
  442. }
  443. public override bool HandleMessage(MessageBase msg, out bool handled)
  444. {
  445. if (base.HandleMessage(msg, out handled))
  446. {
  447. var result = msg as TruPlasmaRF1000Message;
  448. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  449. }
  450. return true;
  451. }
  452. }
  453. public class TruPlasmaRF1000SetRelativeGainHandler : TruPlasmaRF1000Handler
  454. {
  455. private static byte _STAT = 0x00;//No error, data follows.
  456. private static byte _TYP = 0x06;//UINT16
  457. public TruPlasmaRF1000SetRelativeGainHandler(TruPlasmaRF1000 device, int gain)
  458. : base(device, "02,5D,03,01", IntToByteArray(gain))
  459. {
  460. }
  461. private static byte[] IntToByteArray(int num)
  462. {
  463. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  464. tmp.AddRange(BitConverter.GetBytes((ushort)num));
  465. return tmp.ToArray();
  466. }
  467. public override bool HandleMessage(MessageBase msg, out bool handled)
  468. {
  469. if (base.HandleMessage(msg, out handled))
  470. {
  471. var result = msg as TruPlasmaRF1000Message;
  472. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  473. }
  474. return true;
  475. }
  476. }
  477. //858
  478. public class TruPlasmaRF1000SetModulationDeviationHandler : TruPlasmaRF1000Handler
  479. {
  480. private static byte _STAT = 0x00;//No error, data follows.
  481. private static byte _TYP = 0x06;//UINT16
  482. public TruPlasmaRF1000SetModulationDeviationHandler(TruPlasmaRF1000 device, int deviation)
  483. : base(device, "02,5A,03,01", IntToByteArray(deviation))
  484. {
  485. }
  486. private static byte[] IntToByteArray(int num)
  487. {
  488. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  489. tmp.AddRange(BitConverter.GetBytes((ushort)num));
  490. return tmp.ToArray();
  491. }
  492. public override bool HandleMessage(MessageBase msg, out bool handled)
  493. {
  494. if (base.HandleMessage(msg, out handled))
  495. {
  496. var result = msg as TruPlasmaRF1000Message;
  497. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  498. }
  499. return true;
  500. }
  501. }
  502. //857
  503. public class TruPlasmaRF1000SetRelativeModulationDeviationHandler : TruPlasmaRF1000Handler
  504. {
  505. private static byte _STAT = 0x00;//No error, data follows.
  506. private static byte _TYP = 0x06;//UINT16
  507. public TruPlasmaRF1000SetRelativeModulationDeviationHandler(TruPlasmaRF1000 device, int deviation)
  508. : base(device, "02,59,03,01", IntToByteArray(deviation))
  509. {
  510. }
  511. private static byte[] IntToByteArray(int num)
  512. {
  513. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  514. tmp.AddRange(BitConverter.GetBytes((ushort)num));
  515. return tmp.ToArray();
  516. }
  517. public override bool HandleMessage(MessageBase msg, out bool handled)
  518. {
  519. if (base.HandleMessage(msg, out handled))
  520. {
  521. var result = msg as TruPlasmaRF1000Message;
  522. Device.NoteRawCommandInfo(_command, string.Join(",", result.RawMessage.Select(bt => bt.ToString("X2")).ToArray()));
  523. }
  524. return true;
  525. }
  526. }
  527. public class TruPlasmaRF1000GetControlHandler : TruPlasmaRF1000Handler
  528. {
  529. public TruPlasmaRF1000GetControlHandler(TruPlasmaRF1000 device)
  530. : base(device, "05,01,00,00", "FF")
  531. {
  532. }
  533. public override bool HandleMessage(MessageBase msg, out bool handled)
  534. {
  535. if (base.HandleMessage(msg, out handled))
  536. {
  537. var result = msg as TruPlasmaRF1001Message;
  538. Device.NoteInterfaceActived(true);
  539. }
  540. return true;
  541. }
  542. }
  543. public class TruPlasmaRF1000ResetHandler : TruPlasmaRF1000Handler
  544. {
  545. private static byte _STAT = 0x00;//No error, data follows.
  546. private static byte _TYP = 0x04;//INT32
  547. public TruPlasmaRF1000ResetHandler(TruPlasmaRF1000 device)
  548. : base(device, "02,4D,00,01", IntToByteArray(0xAA))
  549. {
  550. }
  551. private static byte[] IntToByteArray(int num)
  552. {
  553. List<byte> tmp = new List<byte>() { _STAT, _TYP };
  554. tmp.AddRange(BitConverter.GetBytes(num));
  555. return tmp.ToArray();
  556. }
  557. public override bool HandleMessage(MessageBase msg, out bool handled)
  558. {
  559. if (base.HandleMessage(msg, out handled))
  560. {
  561. }
  562. return true;
  563. }
  564. }
  565. }