|
@@ -53,11 +53,11 @@ namespace BroadcastModule
|
|
|
{
|
|
|
while (!Monitor.Monitor.isClosing)
|
|
|
{
|
|
|
+ Thread.Sleep(5000);
|
|
|
foreach (BroadcastBoard bb in boardList)
|
|
|
{
|
|
|
bb.CheckConnection();
|
|
|
}
|
|
|
- Thread.Sleep(5000);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -96,7 +96,7 @@ namespace BroadcastModule
|
|
|
{
|
|
|
foreach (BroadcastBoard bb in boardList)
|
|
|
{
|
|
|
- bb.RemoveDynamicAreas(bb.boardParams.handle);
|
|
|
+ //bb.RemoveDynamicAreas(bb.boardParams.handle);
|
|
|
Led5kSDK.Destroy(bb.boardParams.handle);
|
|
|
}
|
|
|
}
|
|
@@ -144,7 +144,7 @@ namespace BroadcastModule
|
|
|
public Led5kSDK.bx_5k_area_header header_model;
|
|
|
private object area1Lock;
|
|
|
private object area2Lock;
|
|
|
- private string[] arrows = { "\\T001arrU64|", "\\T001arrD64|", "\\T001arrL64|", "\\T001arrR64|" };
|
|
|
+ private string[] arrows = { "\\T001arrU64|\\n", "\\T001arrD64|\\n", "\\T001arrL64|\\n", "\\T001arrR64|\\n" };
|
|
|
//************************************************ 方法块 **************************************************
|
|
|
// *************** 公有方法 ***************
|
|
|
public BroadcastBoard(int id, byte[] ip, uint port, Led5kSDK.bx_5k_card_type card_type, uint handle)
|
|
@@ -200,17 +200,17 @@ namespace BroadcastModule
|
|
|
|
|
|
//第一行128*16显示文字,上下8像素留空
|
|
|
AreaInfo area1 = new AreaInfo(handle, 0, Encoding.Default.GetBytes(""));
|
|
|
- area1.header.AreaWidth = 2;// 2=16/8
|
|
|
- area1.header.AreaHeight = 96;
|
|
|
- area1.header.AreaX = 8 / 8;
|
|
|
- area1.header.AreaY = 0;
|
|
|
- area1.header.SingleLine = 0x02;
|
|
|
+ area1.header.AreaWidth = 16;// 2=16/8
|
|
|
+ area1.header.AreaHeight = 16;//96
|
|
|
+ area1.header.AreaX = 0 / 8; // 8/8
|
|
|
+ area1.header.AreaY = 8; // 0
|
|
|
+ area1.header.SingleLine = 0x01;
|
|
|
area1.header.NewLine = 0x02;
|
|
|
- area1.header.DisplayMode = 0x02;
|
|
|
- area1.header.StayTime = 4;
|
|
|
+ area1.header.DisplayMode = 0x03;
|
|
|
+ area1.header.StayTime = 1;
|
|
|
area1.header.RunMode = 2;
|
|
|
area1.header.Speed = 2;
|
|
|
- area1.header.Timeout = 5;
|
|
|
+ area1.header.Timeout = 20;
|
|
|
//bb.header_model.AreaY = 16;
|
|
|
area1.index = AddDynamicArea(handle, area1.header);
|
|
|
if (area1.index != -1)
|
|
@@ -227,13 +227,15 @@ namespace BroadcastModule
|
|
|
AreaInfo area2 = new AreaInfo(handle, 1, Encoding.Default.GetBytes(""));
|
|
|
area2.header.AreaWidth = 8;// 8=64/8
|
|
|
area2.header.AreaHeight = 64;
|
|
|
+ area2.header.AreaX = 32 / 8; // 8/8
|
|
|
+ area2.header.AreaY = 32; // 8/8
|
|
|
area2.header.SingleLine = 0x01;
|
|
|
area2.header.NewLine = 0x01;
|
|
|
area2.header.DisplayMode = 0x02;
|
|
|
- area2.header.StayTime = 5;
|
|
|
+ area2.header.StayTime = 20;
|
|
|
area2.header.RunMode = 2;
|
|
|
- area2.header.AreaX = (32 + 16) / 8;
|
|
|
- area2.header.AreaY = 16;
|
|
|
+ //area2.header.AreaX = (32 + 16) / 8;
|
|
|
+ //area2.header.AreaY = 16;
|
|
|
area2.index = AddDynamicArea(handle, area2.header);
|
|
|
if (area2.index != -1)
|
|
|
{
|
|
@@ -246,7 +248,7 @@ namespace BroadcastModule
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- //顶角右偏32像素的16*16块专用于播放声音
|
|
|
+ //顶角右偏32像素的8*8块专用于播放声音
|
|
|
AreaInfo areaSound = new AreaInfo(handle, 2, Encoding.Default.GetBytes(""));
|
|
|
areaSound.header.AreaWidth = 2;// 2=16/8
|
|
|
areaSound.header.AreaHeight = 16;
|
|
@@ -255,8 +257,8 @@ namespace BroadcastModule
|
|
|
areaSound.header.DisplayMode = 0x02;
|
|
|
areaSound.header.StayTime = 1;
|
|
|
areaSound.header.RunMode = 2;
|
|
|
- areaSound.header.AreaX = 32 / 8;
|
|
|
- areaSound.header.AreaY = 0;
|
|
|
+ areaSound.header.AreaX = 0;// 32 / 8;
|
|
|
+ areaSound.header.AreaY = 64; //0
|
|
|
areaSound.header.Speed = 4;
|
|
|
areaSound.index = AddDynamicArea(handle, areaSound.header);
|
|
|
if (areaSound.index != -1)
|
|
@@ -277,44 +279,62 @@ namespace BroadcastModule
|
|
|
/// </summary>
|
|
|
/// <param name="sentence"></param>
|
|
|
/// <param name="slice"></param>
|
|
|
- public bool UpdateText(string sentence, int waitSec, int slice = 6)
|
|
|
+ public bool UpdateText(string sentence, int waitSec, int runMode=-1, bool horizontal = true, int slice = 6)
|
|
|
{
|
|
|
List<string> sentenceContent = new List<string>();
|
|
|
int i = 0;
|
|
|
if (boardParams.handle == 0 || boardParams.areas.Count < 2)
|
|
|
return false;
|
|
|
- while (i < sentence.Length)
|
|
|
+ // 竖屏
|
|
|
+ if (!horizontal)
|
|
|
{
|
|
|
- if ((i + slice) % slice == 0)
|
|
|
+ while (i < sentence.Length)
|
|
|
{
|
|
|
- if (i < sentence.Length - slice + 1)
|
|
|
+ if ((i + slice) % slice == 0)
|
|
|
{
|
|
|
- char[] temp = (sentence.Substring(i, slice)).ToCharArray();
|
|
|
- temp = temp.Reverse().ToArray();
|
|
|
- sentenceContent.Add(new String(temp));
|
|
|
- i = i + slice - 1;
|
|
|
+ if (i < sentence.Length - slice + 1)
|
|
|
+ {
|
|
|
+ char[] temp = (sentence.Substring(i, slice)).ToCharArray();
|
|
|
+ temp = temp.Reverse().ToArray();
|
|
|
+ sentenceContent.Add(new String(temp));
|
|
|
+ i = i + slice - 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sentenceContent.Add(new String(sentence.Substring(i).ToCharArray().Reverse().ToArray()));
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ lock (area1Lock)
|
|
|
+ {
|
|
|
+ Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
- sentenceContent.Add(new String(sentence.Substring(i).ToCharArray().Reverse().ToArray()));
|
|
|
- break;
|
|
|
- }
|
|
|
+ int count = 0;
|
|
|
+ UpdateArea(boardParams.handle, boardParams.areas[2].index, Encoding.Default.GetBytes(""), true, Encoding.Default.GetBytes(sentence), 10);
|
|
|
+ while (count < sentenceContent.Count)
|
|
|
+ {
|
|
|
+ UpdateArea(boardParams.handle, boardParams.areas[0].index, Encoding.Default.GetBytes(sentenceContent[count]));
|
|
|
+ Thread.Sleep(waitSec * 1000);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- i++;
|
|
|
}
|
|
|
- lock (area1Lock)
|
|
|
+ // 横屏
|
|
|
+ else
|
|
|
{
|
|
|
- Task.Factory.StartNew(() =>
|
|
|
+ lock (area1Lock)
|
|
|
{
|
|
|
- int count = 0;
|
|
|
- UpdateArea(boardParams.handle, boardParams.areas[2].index, Encoding.Default.GetBytes(""), true, Encoding.Default.GetBytes(sentence));
|
|
|
- while (count < sentenceContent.Count)
|
|
|
+ Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
- UpdateArea(boardParams.handle, boardParams.areas[0].index, Encoding.Default.GetBytes(sentenceContent[count]));
|
|
|
- Thread.Sleep(waitSec * 1000);
|
|
|
- count++;
|
|
|
- }
|
|
|
- });
|
|
|
+ UpdateArea(boardParams.handle, boardParams.areas[2].index, Encoding.Default.GetBytes(""), true, Encoding.Default.GetBytes(sentence), 10, runMode, waitSec);
|
|
|
+ UpdateArea(boardParams.handle, boardParams.areas[0].index, Encoding.Default.GetBytes(sentence), runMode, waitSec);
|
|
|
+ Console.WriteLine("index: " + boardParams.areas[0].index);
|
|
|
+ Console.WriteLine("sentence: " + sentence);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
@@ -323,7 +343,7 @@ namespace BroadcastModule
|
|
|
/// </summary>
|
|
|
/// <param name="index"></param>
|
|
|
/// <returns></returns>
|
|
|
- public bool UpdateArrow(int index)
|
|
|
+ public bool UpdateArrow(int index, int waitSec=5, int runMode = -1)
|
|
|
{
|
|
|
if (index > 3)
|
|
|
return false;
|
|
@@ -333,11 +353,11 @@ namespace BroadcastModule
|
|
|
{
|
|
|
if (index < 0)
|
|
|
{
|
|
|
- UpdateArea(boardParams.handle, boardParams.areas[1].index, Encoding.Default.GetBytes(""));
|
|
|
+ UpdateArea(boardParams.handle, boardParams.areas[1].index, Encoding.Default.GetBytes(" "), runMode, waitSec);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- UpdateArea(boardParams.handle, boardParams.areas[1].index, Encoding.Default.GetBytes(arrows[index]));
|
|
|
+ UpdateArea(boardParams.handle, boardParams.areas[1].index, Encoding.Default.GetBytes(arrows[index]), runMode, waitSec);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -434,7 +454,7 @@ namespace BroadcastModule
|
|
|
/// 动态区域更新函数
|
|
|
/// </summary>
|
|
|
/// <param name="i"></param>
|
|
|
- private bool UpdateArea(uint handle, int index, byte[] areaText)
|
|
|
+ private bool UpdateArea(uint handle, int index, byte[] areaText, int runMode=-1, int waitSec=-1)
|
|
|
{
|
|
|
int err = -1;
|
|
|
List<Led5kSDK.bx_5k_area_header> list;
|
|
@@ -452,7 +472,16 @@ namespace BroadcastModule
|
|
|
if (index == list[i].DynamicAreaLoc)
|
|
|
{
|
|
|
Led5kSDK.bx_5k_area_header temp = list[i];
|
|
|
+ if(runMode>=0 && runMode < 3)
|
|
|
+ {
|
|
|
+ temp.RunMode = (byte)runMode;
|
|
|
+ }
|
|
|
+ if (waitSec >= 0)
|
|
|
+ {
|
|
|
+ temp.Timeout = (short)waitSec;
|
|
|
+ }
|
|
|
temp.DataLen = areaText.Length;
|
|
|
+ handleDynamicAreasMap[handle][i] = temp;
|
|
|
err = Led5kSDK.SCREEN_SendDynamicArea(handle, temp, (ushort)temp.DataLen, areaText);
|
|
|
break;
|
|
|
}
|
|
@@ -470,9 +499,11 @@ namespace BroadcastModule
|
|
|
/// 动态区域更新函数
|
|
|
/// </summary>
|
|
|
/// <param name="i"></param>
|
|
|
- private bool UpdateArea(uint handle, int index, byte[] areaText, bool soundOnly, byte[] soundText)
|
|
|
+ private bool UpdateArea(uint handle, int index, byte[] areaText, bool soundOnly, byte[] soundText, int sound, int runMode = -1, int waitSec = -1)
|
|
|
{
|
|
|
int err = -1;
|
|
|
+ sound = sound > 10 ? 10 : sound;
|
|
|
+ sound = sound < 1 ? 1 : sound;
|
|
|
List<Led5kSDK.bx_5k_area_header> list;
|
|
|
if (!handleDynamicAreasMap.ContainsKey(handle))
|
|
|
{
|
|
@@ -488,11 +519,20 @@ namespace BroadcastModule
|
|
|
if (index == list[i].DynamicAreaLoc)
|
|
|
{
|
|
|
Led5kSDK.bx_5k_area_header temp = list[i];
|
|
|
+ if (runMode >= 0 && runMode < 3)
|
|
|
+ {
|
|
|
+ temp.RunMode = (byte)runMode;
|
|
|
+ }
|
|
|
+ if (waitSec >= 0)
|
|
|
+ {
|
|
|
+ temp.Timeout = (short)waitSec;
|
|
|
+ }
|
|
|
temp.DataLen = areaText.Length;
|
|
|
+ handleDynamicAreasMap[handle][i] = temp;
|
|
|
if (!soundOnly)
|
|
|
- err = Led5kSDK.SCREEN_SendSoundDynamicArea(handle, temp, (ushort)temp.DataLen, areaText, 2, 0, 1, 5, soundText.Length, soundText);
|
|
|
+ err = Led5kSDK.SCREEN_SendSoundDynamicArea(handle, temp, (ushort)temp.DataLen, areaText, 2, 0, (byte)sound, 5, soundText.Length, soundText);
|
|
|
else
|
|
|
- err = Led5kSDK.SCREEN_SendSoundDynamicArea(handle, temp, 0, Encoding.Default.GetBytes(""), 2, 0, 1, 5, soundText.Length, soundText);
|
|
|
+ err = Led5kSDK.SCREEN_SendSoundDynamicArea(handle, temp, 0, Encoding.Default.GetBytes(""), 2, 0, (byte)sound, 5, soundText.Length, soundText);
|
|
|
break;
|
|
|
}
|
|
|
}
|