Program.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using ONNONLed5KSDKD;
  8. namespace BroadcastModule
  9. {
  10. public class Program
  11. {
  12. public void MainTest(string[] args)
  13. {
  14. BroadcastBoardManager bbm = new BroadcastBoardManager();
  15. uint handle = 0;
  16. //addScreen 1 模式
  17. if(bbm.AddScreen(0, Encoding.Default.GetBytes("192.168.0.17"),5005, Led5kSDK.bx_5k_card_type.BX_6K3_YY, 1, 2))
  18. {
  19. handle = bbm.boardList[bbm.boardList.Count - 1].boardParams.handle;
  20. }
  21. if (handle == 0)
  22. {
  23. Console.WriteLine("失败");
  24. return;
  25. }
  26. //bb.RemoveDynamicAreas(handle);
  27. ////第一行128*16显示文字,上下8像素留空
  28. //bb.header_model.AreaWidth = 2;// 2=16/8
  29. //bb.header_model.AreaHeight = 96;
  30. //bb.header_model.AreaX = 8/8;
  31. //bb.header_model.AreaY = 0;
  32. //bb.header_model.SingleLine = 0x02;
  33. //bb.header_model.NewLine = 0x02;
  34. //bb.header_model.DisplayMode = 0x02;
  35. //bb.header_model.StayTime = 2;
  36. //bb.header_model.RunMode = 1;
  37. //bb.header_model.Speed = 1;
  38. ////bb.header_model.AreaY = 16;
  39. //int areaNo = bb.AddDynamicArea(handle, bb.header_model);
  40. //if (areaNo != -1)
  41. //{
  42. // //bb.UpdateArea(handle, areaNo, Encoding.Default.GetBytes("\\C1温馨提示:请带好随\\C2身携带的物品," + "依次从\\C3后边门下车。\\n"));
  43. // bb.UpdateArea(handle, areaNo, Encoding.Default.GetBytes(""));
  44. //}
  45. ////第二、三行64*64显示一个指示标志
  46. //bb.header_model.AreaWidth = 12;// 12=96/8
  47. //bb.header_model.AreaHeight = 96;
  48. //bb.header_model.SingleLine = 0x01;
  49. //bb.header_model.NewLine = 0x01;
  50. //bb.header_model.DisplayMode = 0x02;
  51. //bb.header_model.StayTime = 5;
  52. //bb.header_model.RunMode = 2;
  53. //bb.header_model.AreaX = (32+16) / 8;
  54. //bb.header_model.AreaY = 16;
  55. //int area1 = bb.AddDynamicArea(handle, bb.header_model);
  56. //if (area1 != -1)
  57. //{
  58. // bb.UpdateArea(handle, area1, Encoding.Default.GetBytes("\\T001arrU64|"));
  59. // //updateList.Add(new AreaInfo(handle, area1, Encoding.Default.GetBytes(" ")));
  60. // //bb.UpdateArea(handle, areaNoArrU, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|"));
  61. //}
  62. //////left
  63. ////bb.header_model.AreaX = 0;
  64. ////bb.header_model.AreaY = 0;
  65. ////bb.header_model.AreaWidth = 8;// 8=64/8
  66. ////bb.header_model.AreaHeight = 64;
  67. ////int area2 = bb.AddDynamicArea(handle, bb.header_model);
  68. ////if (area2 != -1)
  69. ////{
  70. //// //updateList.Add(new AreaInfo(handle, area2, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|")));
  71. //// updateList.Add(new AreaInfo(handle, area2, Encoding.Default.GetBytes(" ")));
  72. ////}
  73. //string sentence = "温馨提示:请携带好随身物品,关闭车窗与车门,待所有人员离开车库后,再操作终端停车";
  74. //List<string> sentenceContent = new List<string>();
  75. //int i = 0;
  76. //while(i < sentence.Length)
  77. //{
  78. // if((i+6)%6==0)
  79. // {
  80. // if (i < sentence.Length - 5)
  81. // {
  82. // char[] temp = (sentence.Substring(i, 6)).ToCharArray();
  83. // temp = temp.Reverse().ToArray();
  84. // sentenceContent.Add(new String(temp));
  85. // i = i + 5;
  86. // }
  87. // else
  88. // {
  89. // sentenceContent.Add(new String(sentence.Substring(i).ToCharArray().Reverse().ToArray()));
  90. // break;
  91. // }
  92. // }
  93. // i++;
  94. //}
  95. //string[] dispContent = {"\\T001arrU64|", "\\T001arrD64|" , "\\T001arrL64|" , "\\T001arrR64|" };
  96. ////string[] dispContent2 = { "\\T000arrU|", "\\T000arrD|", "\\T000arrL|", "\\T000arrR|" };
  97. Task.Factory.StartNew(() =>
  98. {
  99. int count = 0;
  100. int lightIndex = 0;
  101. Random rnd = new Random(DateTime.Now.Millisecond);
  102. bbm.boardList[0].UpdateText("温馨提示:请携带好随身物品,关闭车窗与车门,待所有人员离开车库后,再操作终端停车", 1);
  103. lightIndex = rnd.Next(0, 4);
  104. bbm.boardList[0].UpdateArrow(lightIndex);
  105. while (count < 10000)
  106. {
  107. //bb.UpdateArea(handle, areaNo, Encoding.Default.GetBytes(sentenceContent[count%sentenceContent.Count]));
  108. //bb.UpdateArea(handle, 1, Encoding.Default.GetBytes(dispContent[lightIndex]));
  109. //Console.WriteLine(areaNo + ", " + area1);
  110. //Console.WriteLine(dispContent[lightIndex]);
  111. //}
  112. //bb.UpdateArea(handle, 1, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|"));
  113. //bb.UpdateArea(handle, 0, Encoding.Default.GetBytes("\\T000arrL|"));
  114. Thread.Sleep(1000);
  115. count++;
  116. }
  117. });
  118. //bb.UpdateArea(handle, 2, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|"));
  119. //bb.UpdateArea(handle, 1, Encoding.Default.GetBytes("\\T000arrL|\\n\\T000arrU|\\n\\T000arrR|\\n\\T000arrD|"));
  120. //bb.UpdateArea(handle, 0, Encoding.Default.GetBytes("\\T000arrL|"));
  121. Console.ReadLine();
  122. bbm.DestroyAll();
  123. }
  124. }
  125. }