broadcastModule.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Sockets;
  6. using System.Runtime.InteropServices;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. using ONNONLed5KSDKD;
  11. namespace BroadcastModule
  12. {
  13. public class BroadcastBoardManager
  14. {
  15. public List<BroadcastBoard> boardList;
  16. public Led5kSDK.bx_5k_area_header header_model;
  17. public BroadcastBoardManager()
  18. {
  19. header_model = new Led5kSDK.bx_5k_area_header();
  20. header_model.AreaType = 0x06;
  21. //横向偏移
  22. header_model.AreaX = 0;
  23. //纵向偏移
  24. header_model.AreaY = 0;
  25. //宽度,需将点数除以8
  26. header_model.AreaWidth = 32 / 8;
  27. //高度
  28. header_model.AreaHeight = 32;
  29. //0自动循环显示 1完成后停留在最后一页 2超时未完成删除该信息
  30. header_model.RunMode = 0;
  31. header_model.Reserved1 = 0;
  32. header_model.Reserved2 = 0;
  33. header_model.Reserved3 = 0;
  34. //1静止显示 2快速打出 3向左移动 4向右移动 5向上移动 6向下移动
  35. header_model.DisplayMode = 0x02;
  36. header_model.ExitMode = 0x00;
  37. //1快-24慢
  38. header_model.Speed = 5;
  39. //多少个0.5s
  40. header_model.StayTime = 6;
  41. //1单行 2多行
  42. header_model.SingleLine = 0x01;
  43. //1手动换行 2自动
  44. header_model.NewLine = 0x01;
  45. header_model.Timeout = 2;
  46. Led5kSDK.InitSdk(2, 2);
  47. boardList = new List<BroadcastBoard>();
  48. //初始化时启动连接检查线程
  49. Task.Factory.StartNew(() =>
  50. {
  51. while (!Monitor.Monitor.isClosing)
  52. {
  53. Thread.Sleep(5000);
  54. foreach (BroadcastBoard bb in boardList)
  55. {
  56. try
  57. {
  58. bb.CheckConnection(5);
  59. }
  60. catch(Exception e) { Console.WriteLine("LED"+bb.boardParams.id+"连接:\n"+e.StackTrace); }
  61. }
  62. }
  63. });
  64. }
  65. /// <summary>
  66. /// 增加屏幕
  67. /// </summary>
  68. /// <param name="id"></param>
  69. /// <param name="led_ip"></param>
  70. /// <param name="led_port"></param>
  71. /// <param name="card_type"></param>
  72. /// <param name="tmout_sec"></param>
  73. /// <param name="mode"></param>
  74. /// <returns></returns>
  75. public bool AddScreen(int id, byte[] led_ip, uint led_port, Led5kSDK.bx_5k_card_type card_type, int tmout_sec, int mode)
  76. {
  77. uint hand = Led5kSDK.CreateClient(led_ip, led_port, card_type, tmout_sec, mode, null);
  78. BroadcastBoard bb = new BroadcastBoard(id, led_ip, led_port, card_type, hand);
  79. if (hand == 0)
  80. {
  81. boardList.Add(bb);
  82. return false;
  83. }
  84. else
  85. {
  86. bb.connected = true;
  87. bb.InitBoard(hand);
  88. boardList.Add(bb);
  89. return true;
  90. }
  91. }
  92. /// <summary>
  93. /// 关闭所有屏幕连接
  94. /// </summary>
  95. public void DestroyAll()
  96. {
  97. foreach (BroadcastBoard bb in boardList)
  98. {
  99. //bb.RemoveDynamicAreas(bb.boardParams.handle);
  100. Led5kSDK.Destroy(bb.boardParams.handle);
  101. }
  102. }
  103. /// <summary>
  104. /// 删除特定屏幕连接
  105. /// </summary>
  106. /// <param name="index"></param>
  107. public void DestroyBoard(int index)
  108. {
  109. foreach (BroadcastBoard bb in boardList)
  110. {
  111. if (bb.boardParams.id == index)
  112. {
  113. bb.RemoveDynamicAreas(bb.boardParams.handle);
  114. Led5kSDK.Destroy(bb.boardParams.handle);
  115. }
  116. }
  117. }
  118. /// <summary>
  119. /// 时间同步
  120. /// </summary>
  121. public bool UpdateTimeAll()
  122. {
  123. foreach (BroadcastBoard bb in boardList)
  124. {
  125. if (bb.boardParams.handle != 0)
  126. {
  127. int err = ONNONLed5KSDKD.Led5kSDK.CON_SytemClockCorrect(bb.boardParams.handle);
  128. if (err != 0)
  129. {
  130. return false;
  131. }
  132. }
  133. }
  134. return true;
  135. }
  136. }
  137. public class BroadcastBoard
  138. {
  139. public BoardParams boardParams;
  140. public bool connected;
  141. private Dictionary<uint, List<Led5kSDK.bx_5k_area_header>> handleDynamicAreasMap;
  142. private int volume = 10;
  143. public Led5kSDK.bx_5k_area_header header_model;
  144. public int ledScanState;// 0空闲 1正常 2前超界 3后超界 4左超界 5右超界 6测量失败
  145. private int[] dispStatus;
  146. private bool isDisplaying;
  147. private object area1Lock;
  148. private object area2Lock;
  149. private string[] arrows = { "\\T001arrU64|\\n", "\\T001arrD64|\\n", "\\T001arrL64|\\n", "\\T001arrR64|\\n" };
  150. //************************************************ 方法块 **************************************************
  151. // *************** 公有方法 ***************
  152. public BroadcastBoard(int id, byte[] ip, uint port, Led5kSDK.bx_5k_card_type card_type, uint handle)
  153. {
  154. ledScanState = -1;
  155. isDisplaying = false;
  156. dispStatus = new int[2];
  157. handleDynamicAreasMap = new Dictionary<uint, List<Led5kSDK.bx_5k_area_header>>();
  158. header_model = new Led5kSDK.bx_5k_area_header();
  159. area1Lock = new object();
  160. area2Lock = new object();
  161. boardParams = new BoardParams(id, ip, port, card_type, handle);
  162. }
  163. /// <summary>
  164. /// 检查连接状态
  165. /// </summary>
  166. /// <returns></returns>
  167. public bool CheckConnection(int sleptSec)
  168. {
  169. int count = 3;
  170. int result = -1;
  171. while (count > 0)
  172. {
  173. if (boardParams.handle != 0)
  174. {
  175. // 检查是否有内容在显示
  176. int displaying = 0;
  177. lock (area1Lock)
  178. {
  179. displaying = dispStatus[0];
  180. }
  181. lock (area2Lock)
  182. {
  183. displaying += dispStatus[1];
  184. }
  185. if (displaying <= 0 && isDisplaying)
  186. {
  187. UpdateText("欢迎光临智象停车", 2, 0);
  188. UpdateArrow(-1, 2, 0);
  189. Console.WriteLine("LED清屏");
  190. isDisplaying = false;
  191. }
  192. else
  193. {
  194. lock (area1Lock)
  195. {
  196. dispStatus[0] = dispStatus[0] >= 0 ? (dispStatus[0] - sleptSec) : 0;
  197. }
  198. lock (area2Lock)
  199. {
  200. dispStatus[1] = dispStatus[1] >= 0 ? (dispStatus[1] - sleptSec) : 0;
  201. }
  202. }
  203. result = Led5kSDK.CON_PING(boardParams.handle);
  204. Console.WriteLine("屏幕ping结果: " + result);
  205. if (result == 0)
  206. break;
  207. }
  208. else
  209. {
  210. boardParams.handle = Led5kSDK.CreateClient(boardParams.ip, boardParams.port, boardParams.card_type, 1, 2, null);
  211. }
  212. count--;
  213. if (count == 0 && result != 0 && boardParams.handle != 0)
  214. {
  215. Led5kSDK.Destroy(boardParams.handle);
  216. boardParams.handle = 0;
  217. }
  218. }
  219. connected = (result == 0 ? true : false);
  220. return connected;
  221. }
  222. /// <summary>
  223. /// 初始化控制板
  224. /// </summary>
  225. /// <param name="handle"></param>
  226. /// <returns></returns>
  227. public bool InitBoard(uint handle)
  228. {
  229. if (boardParams == null)
  230. return false;
  231. RemoveDynamicAreas(handle);
  232. //第一行128*16显示文字,上下8像素留空
  233. AreaInfo area1 = new AreaInfo(handle, 0, Encoding.Default.GetBytes(""));
  234. area1.header.AreaWidth = 16;// 2=16/8
  235. area1.header.AreaHeight = 16;//96
  236. area1.header.AreaX = 0 / 8; // 8/8
  237. area1.header.AreaY = 8; // 0
  238. area1.header.SingleLine = 0x01;
  239. area1.header.NewLine = 0x02;
  240. area1.header.DisplayMode = 0x03;
  241. area1.header.StayTime = 10;
  242. area1.header.RunMode = 2;
  243. area1.header.Speed = 2;
  244. area1.header.Timeout = 20;
  245. //bb.header_model.AreaY = 16;
  246. area1.index = AddDynamicArea(handle, area1.header);
  247. if (area1.index != -1)
  248. {
  249. UpdateArea(handle, area1.index, Encoding.Default.GetBytes(""));
  250. boardParams.areas.Add(area1);
  251. }
  252. else
  253. {
  254. return false;
  255. }
  256. //第二、三行64*64显示一个指示标志
  257. AreaInfo area2 = new AreaInfo(handle, 1, Encoding.Default.GetBytes(""));
  258. area2.header.AreaWidth = 8;// 8=64/8
  259. area2.header.AreaHeight = 64;
  260. area2.header.AreaX = 32 / 8; // 8/8
  261. area2.header.AreaY = 32; // 8/8
  262. area2.header.SingleLine = 0x01;
  263. area2.header.NewLine = 0x01;
  264. area2.header.DisplayMode = 0x02;
  265. area2.header.StayTime = 20;
  266. area2.header.RunMode = 2;
  267. //area2.header.AreaX = (32 + 16) / 8;
  268. //area2.header.AreaY = 16;
  269. area2.index = AddDynamicArea(handle, area2.header);
  270. if (area2.index != -1)
  271. {
  272. UpdateArea(handle, area2.index, Encoding.Default.GetBytes(""));
  273. boardParams.areas.Add(area2);
  274. //bb.UpdateArea(handle, areaNoArrU, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|"));
  275. }
  276. else
  277. {
  278. return false;
  279. }
  280. //顶角右偏32像素的8*8块专用于播放声音
  281. AreaInfo areaSound = new AreaInfo(handle, 2, Encoding.Default.GetBytes(""));
  282. areaSound.header.AreaWidth = 2;// 2=16/8
  283. areaSound.header.AreaHeight = 16;
  284. areaSound.header.SingleLine = 0x02;
  285. areaSound.header.NewLine = 0x02;
  286. areaSound.header.DisplayMode = 0x02;
  287. areaSound.header.StayTime = 1;
  288. areaSound.header.RunMode = 2;
  289. areaSound.header.AreaX = 0;// 32 / 8;
  290. areaSound.header.AreaY = 64; //0
  291. areaSound.header.Speed = 4;
  292. areaSound.index = AddDynamicArea(handle, areaSound.header);
  293. if (areaSound.index != -1)
  294. {
  295. UpdateArea(handle, areaSound.index, Encoding.Default.GetBytes(""));
  296. boardParams.areas.Add(areaSound);
  297. //bb.UpdateArea(handle, areaNoArrU, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|"));
  298. }
  299. else
  300. {
  301. return false;
  302. }
  303. return true;
  304. }
  305. /// <summary>
  306. /// 更新第一块区域文字信息
  307. /// </summary>
  308. /// <param name="sentence"></param>
  309. /// <param name="slice"></param>
  310. public bool UpdateText(string sentence, int waitSec, int runMode = -1,int dispMode = -1, bool horizontal = true, int slice = 6)
  311. {
  312. List<string> sentenceContent = new List<string>();
  313. int i = 0;
  314. if (boardParams.handle == 0 || boardParams.areas.Count < 2)
  315. return false;
  316. // 竖屏
  317. if (!horizontal)
  318. {
  319. while (i < sentence.Length)
  320. {
  321. if ((i + slice) % slice == 0)
  322. {
  323. if (i < sentence.Length - slice + 1)
  324. {
  325. char[] temp = (sentence.Substring(i, slice)).ToCharArray();
  326. temp = temp.Reverse().ToArray();
  327. sentenceContent.Add(new String(temp));
  328. i = i + slice - 1;
  329. }
  330. else
  331. {
  332. sentenceContent.Add(new String(sentence.Substring(i).ToCharArray().Reverse().ToArray()));
  333. break;
  334. }
  335. }
  336. i++;
  337. }
  338. lock (area1Lock)
  339. {
  340. Task.Factory.StartNew(() =>
  341. {
  342. int count = 0;
  343. UpdateArea(boardParams.handle, boardParams.areas[2].index, Encoding.Default.GetBytes(""), true, Encoding.Default.GetBytes(sentence), 10);
  344. while (count < sentenceContent.Count)
  345. {
  346. UpdateArea(boardParams.handle, boardParams.areas[0].index, Encoding.Default.GetBytes(sentenceContent[count]));
  347. Thread.Sleep(waitSec * 1000);
  348. count++;
  349. }
  350. });
  351. }
  352. }
  353. // 横屏
  354. else
  355. {
  356. Task.Factory.StartNew(() =>
  357. {
  358. lock (area1Lock)
  359. {
  360. dispStatus[0] = waitSec;
  361. UpdateArea(boardParams.handle, boardParams.areas[2].index, Encoding.Default.GetBytes(""), true, Encoding.Default.GetBytes(sentence), 10, runMode, waitSec);
  362. UpdateArea(boardParams.handle, boardParams.areas[0].index, Encoding.Default.GetBytes(sentence + "\\n"), runMode, waitSec, dispMode);
  363. }
  364. if (sentence != "欢迎光临智象停车")
  365. {
  366. isDisplaying = true;
  367. }
  368. Console.WriteLine("index: " + boardParams.areas[0].index);
  369. Console.WriteLine("sentence: " + sentence);
  370. //if (runMode != 0)
  371. //{
  372. // Thread.Sleep(waitSec*1000);
  373. // dispStatus[0] = false;
  374. //}
  375. });
  376. }
  377. return true;
  378. }
  379. /// <summary>
  380. /// 更新下方箭头显示
  381. /// </summary>
  382. /// <param name="index"></param>
  383. /// <returns></returns>
  384. public bool UpdateArrow(int index, int waitSec = 5, int runMode = -1)
  385. {
  386. if (index > 3)
  387. return false;
  388. if (boardParams.handle == 0 || boardParams.areas.Count < 2)
  389. return false;
  390. Task.Factory.StartNew(() =>
  391. {
  392. lock (area2Lock)
  393. {
  394. dispStatus[1] = waitSec;
  395. if (index < 0)
  396. {
  397. UpdateArea(boardParams.handle, boardParams.areas[1].index, Encoding.Default.GetBytes(" "), runMode, waitSec);
  398. }
  399. else
  400. {
  401. UpdateArea(boardParams.handle, boardParams.areas[1].index, Encoding.Default.GetBytes(arrows[index]), runMode, waitSec);
  402. isDisplaying = true;
  403. }
  404. }
  405. //if (runMode != 0)
  406. //{
  407. // Thread.Sleep(waitSec*1000);
  408. // dispStatus[1] = false;
  409. //}
  410. });
  411. return true;
  412. }
  413. /// <summary>
  414. /// 删除某屏幕所有动态区
  415. /// </summary>
  416. /// <param name="handle"></param>
  417. /// <returns></returns>
  418. public bool RemoveDynamicAreas(uint handle)
  419. {
  420. if (!handleDynamicAreasMap.ContainsKey(handle))
  421. {
  422. return false;
  423. }
  424. else
  425. {
  426. List<Led5kSDK.bx_5k_area_header> list;
  427. handleDynamicAreasMap.TryGetValue(handle, out list);
  428. int err = 0;
  429. if (list != null)
  430. {
  431. for (int i = 0; i < list.Count; i++)
  432. {
  433. err += Led5kSDK.SCREEN_DelDynamicArea(handle, (byte)i);
  434. }
  435. }
  436. return err == 0 ? true : false;
  437. }
  438. }
  439. /// <summary>
  440. /// 删除某屏幕特定编号的动态区
  441. /// </summary>
  442. /// <param name="handle"></param>
  443. /// <param name="index"></param>
  444. /// <returns></returns>
  445. public bool RemoveDynamicAreas(uint handle, int index)
  446. {
  447. if (!handleDynamicAreasMap.ContainsKey(handle))
  448. {
  449. return false;
  450. }
  451. else
  452. {
  453. List<Led5kSDK.bx_5k_area_header> list;
  454. handleDynamicAreasMap.TryGetValue(handle, out list);
  455. int err = 0;
  456. if (list != null)
  457. {
  458. for (int i = 0; i < list.Count; i++)
  459. {
  460. if (list[i].DynamicAreaLoc == index)
  461. {
  462. err = Led5kSDK.SCREEN_DelDynamicArea(handle, list[i].DynamicAreaLoc);
  463. return true;
  464. }
  465. }
  466. }
  467. return err == 0 ? true : false;
  468. }
  469. }
  470. // *************** 私有方法 ***************
  471. /// <summary>
  472. /// 增加动态区
  473. /// </summary>
  474. /// <param name="handle"></param>
  475. /// <param name="header"></param>
  476. private int AddDynamicArea(uint handle, Led5kSDK.bx_5k_area_header header)
  477. {
  478. List<Led5kSDK.bx_5k_area_header> list;
  479. if (!handleDynamicAreasMap.ContainsKey(handle))
  480. {
  481. list = new List<Led5kSDK.bx_5k_area_header>();
  482. list.Add(header);
  483. header.DynamicAreaLoc = 0;
  484. handleDynamicAreasMap.Add(handle, list);
  485. return 0;
  486. }
  487. else
  488. {
  489. handleDynamicAreasMap.TryGetValue(handle, out list);
  490. if (list != null)
  491. {
  492. int no = list[list.Count - 1].DynamicAreaLoc + 1;
  493. header.DynamicAreaLoc = (byte)(no);
  494. list.Add(header);
  495. return no;
  496. }
  497. return -1;
  498. }
  499. }
  500. /// <summary>
  501. /// 动态区域更新函数
  502. /// </summary>
  503. /// <param name="i"></param>
  504. private bool UpdateArea(uint handle, int index, byte[] areaText, int runMode = -1, int waitSec = -1, int dispMode = -1)
  505. {
  506. int err = -1;
  507. List<Led5kSDK.bx_5k_area_header> list;
  508. if (!handleDynamicAreasMap.ContainsKey(handle))
  509. {
  510. return false;
  511. }
  512. else
  513. {
  514. handleDynamicAreasMap.TryGetValue(handle, out list);
  515. if (list != null)
  516. {
  517. for (int i = 0; i < list.Count; i++)
  518. {
  519. if (index == list[i].DynamicAreaLoc)
  520. {
  521. Led5kSDK.bx_5k_area_header temp = list[i];
  522. if (runMode >= 0 && runMode < 3)
  523. {
  524. temp.RunMode = (byte)runMode;
  525. }
  526. if(dispMode >= 0 && dispMode < 7)
  527. {
  528. temp.DisplayMode = (byte)dispMode;
  529. }
  530. if (waitSec >= 0)
  531. {
  532. temp.Timeout = (short)waitSec;
  533. }
  534. temp.DataLen = areaText.Length;
  535. handleDynamicAreasMap[handle][i] = temp;
  536. err = Led5kSDK.SCREEN_SendDynamicArea(handle, temp, (ushort)temp.DataLen, areaText);
  537. break;
  538. }
  539. }
  540. if (err == 0)
  541. return true;
  542. else
  543. return false;
  544. }
  545. else
  546. return false;
  547. }
  548. }
  549. /// <summary>
  550. /// 动态区域更新函数
  551. /// </summary>
  552. /// <param name="i"></param>
  553. private bool UpdateArea(uint handle, int index, byte[] areaText, bool soundOnly, byte[] soundText, int sound, int runMode = -1, int waitSec = -1, int dispMode = -1)
  554. {
  555. int err = -1;
  556. sound = sound > 10 ? 10 : sound;
  557. sound = sound < 1 ? 1 : sound;
  558. List<Led5kSDK.bx_5k_area_header> list;
  559. if (!handleDynamicAreasMap.ContainsKey(handle))
  560. {
  561. return false;
  562. }
  563. else
  564. {
  565. handleDynamicAreasMap.TryGetValue(handle, out list);
  566. if (list != null)
  567. {
  568. for (int i = 0; i < list.Count; i++)
  569. {
  570. if (index == list[i].DynamicAreaLoc)
  571. {
  572. Led5kSDK.bx_5k_area_header temp = list[i];
  573. if (runMode >= 0 && runMode < 3)
  574. {
  575. temp.RunMode = (byte)runMode;
  576. }
  577. if (dispMode >= 0 && dispMode < 7)
  578. {
  579. temp.DisplayMode = (byte)dispMode;
  580. }
  581. if (waitSec >= 0)
  582. {
  583. temp.Timeout = (short)waitSec;
  584. }
  585. temp.DataLen = areaText.Length;
  586. handleDynamicAreasMap[handle][i] = temp;
  587. if (!soundOnly)
  588. err = Led5kSDK.SCREEN_SendSoundDynamicArea(handle, temp, (ushort)temp.DataLen, areaText, 2, 0, (byte)sound, 5, soundText.Length, soundText);
  589. else
  590. err = Led5kSDK.SCREEN_SendSoundDynamicArea(handle, temp, 0, Encoding.Default.GetBytes(""), 2, 0, (byte)sound, 5, soundText.Length, soundText);
  591. break;
  592. }
  593. }
  594. if (err == 0)
  595. return true;
  596. else
  597. return false;
  598. }
  599. else
  600. return false;
  601. }
  602. }
  603. ///// <summary>
  604. ///// 播放方法
  605. ///// </summary>
  606. ///// <param name="winID">显示屏窗口ID</param>
  607. ///// <param name="mode">播放模式</param>
  608. ///// <param name="str">待显示或播语音字符串,输入“date”或“time”分别显示日期与时间</param>
  609. ///// <param name="time">保持时间</param>
  610. ///// <param name="fieldID">存储块ID</param>
  611. ///// <param name="startIndex">开始下标</param>
  612. ///// <param name="endIndex">结束下标</param>
  613. //public void Play(int winID, PlayMode mode, string str, int time = 0, int fieldID = 0, int startIndex = 0, int endIndex = 0)
  614. //{
  615. // switch (mode)
  616. // {
  617. // case PlayMode.temporary:
  618. // DispString(winID, str, time);
  619. // break;
  620. // case PlayMode.download:
  621. // DownloadString(winID, str, fieldID);
  622. // break;
  623. // case PlayMode.readBuffer:
  624. // DispDownStr(winID, fieldID);
  625. // break;
  626. // case PlayMode.delete:
  627. // DelFile(winID, startIndex, endIndex);
  628. // break;
  629. // case PlayMode.audio:
  630. // AudioPlay(str);
  631. // break;
  632. // }
  633. //}
  634. }
  635. public class BoardParams
  636. {
  637. public int id;
  638. public byte[] ip;
  639. public uint port;
  640. public Led5kSDK.bx_5k_card_type card_type;
  641. public uint handle;
  642. public List<AreaInfo> areas;
  643. public BoardParams(int id, byte[] ip, uint port, Led5kSDK.bx_5k_card_type card_type, uint handle)
  644. {
  645. this.id = id;
  646. this.ip = ip;
  647. this.port = port;
  648. this.card_type = card_type;
  649. this.handle = handle;
  650. areas = new List<AreaInfo>();
  651. }
  652. }
  653. public class AreaInfo
  654. {
  655. public uint winHandle;
  656. public int index;
  657. public bool display;
  658. public byte[] text;
  659. public Led5kSDK.bx_5k_area_header header;
  660. public AreaInfo(uint handle, int index, byte[] text)
  661. {
  662. this.winHandle = handle;
  663. this.index = index;
  664. this.text = text.ToArray();
  665. header = new Led5kSDK.bx_5k_area_header();
  666. }
  667. public override string ToString()
  668. {
  669. return winHandle + ", " + index + ", " + display + ", " + text.ToList().ToString();
  670. }
  671. }
  672. }