|
@@ -134,15 +134,33 @@ public class LedC2MManager extends LedManager {
|
|
|
int server_port = 9999;
|
|
|
String text = "";
|
|
|
byte[] data;
|
|
|
+ int led_type = SettingConfig.getLedType(BaseApplication.appContext);
|
|
|
|
|
|
if (stopVoice) {
|
|
|
- data = VoiceModel.getStopVoiceData();
|
|
|
+ if (led_type == 0) {
|
|
|
+ //T卡
|
|
|
+ data = VoiceModel.getStopVoiceDataT4();
|
|
|
+ } else {
|
|
|
+ //默认C卡
|
|
|
+ data = VoiceModel.getStopVoiceDataC2M();
|
|
|
+ }
|
|
|
} else {
|
|
|
text = voiceText;
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
text = text + "," + voiceText;
|
|
|
}
|
|
|
- data = VoiceModel.getVoiceData(text);
|
|
|
+
|
|
|
+ int volume = SettingConfig.getLedVoiceVolume(BaseApplication.appContext);
|
|
|
+ int speed = SettingConfig.getLedVoiceSpeed(BaseApplication.appContext);
|
|
|
+ text = "[v" + volume +"]" + "[s" + speed + "]" + text;
|
|
|
+
|
|
|
+ if (led_type == 0) {
|
|
|
+ //T卡
|
|
|
+ data = VoiceModel.getVoiceDataT4(text);
|
|
|
+ } else {
|
|
|
+ //默认C卡
|
|
|
+ data = VoiceModel.getVoiceDataC2M(text);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
DatagramSocket s = null;
|
|
@@ -178,9 +196,16 @@ public class LedC2MManager extends LedManager {
|
|
|
try {
|
|
|
byte[] data;
|
|
|
String text = "";
|
|
|
+ int led_type = SettingConfig.getLedType(BaseApplication.appContext);
|
|
|
|
|
|
if (stopVoice) {
|
|
|
- data = VoiceModel.getStopVoiceData();
|
|
|
+ if (led_type == 0) {
|
|
|
+ //T卡
|
|
|
+ data = VoiceModel.getStopVoiceDataT4();
|
|
|
+ } else {
|
|
|
+ //默认C卡
|
|
|
+ data = VoiceModel.getStopVoiceDataC2M();
|
|
|
+ }
|
|
|
} else {
|
|
|
text = voiceText;
|
|
|
//voiceText.replaceAll("(\\d{1})", " $1");
|
|
@@ -188,9 +213,18 @@ public class LedC2MManager extends LedManager {
|
|
|
for (int j = 0; j < loop; j++) {
|
|
|
text = text + "," + voiceText;
|
|
|
}
|
|
|
- String volume = Integer.toString(SettingConfig.getLedVoiceVolume(BaseApplication.appContext));
|
|
|
- text = "[v" + volume +"]" + text;
|
|
|
- data = VoiceModel.getVoiceData(text);
|
|
|
+
|
|
|
+ int volume = SettingConfig.getLedVoiceVolume(BaseApplication.appContext);
|
|
|
+ int speed = SettingConfig.getLedVoiceSpeed(BaseApplication.appContext);
|
|
|
+ text = "[v" + volume +"]" + "[s" + speed + "]" + text;
|
|
|
+
|
|
|
+ if (led_type == 0) {
|
|
|
+ //T卡
|
|
|
+ data = VoiceModel.getVoiceDataT4(text);
|
|
|
+ } else {
|
|
|
+ //默认C卡
|
|
|
+ data = VoiceModel.getVoiceDataC2M(text);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Socket socket = new Socket(ip, 10000);
|
|
@@ -294,6 +328,7 @@ public class LedC2MManager extends LedManager {
|
|
|
long hProgram = 0;
|
|
|
String language = LocaleMangerUtils.getApplicationLocale().getLanguage();
|
|
|
int ledType = SettingConfig.getLedType(application);
|
|
|
+ int isSeconds = SettingConfig.getLedTimeShowSeconds(application);
|
|
|
int grayLevel = 1;
|
|
|
int nLayout = 0;
|
|
|
ledC2M.InitLedType(ledType);
|
|
@@ -304,7 +339,26 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
if (type == 0) {
|
|
|
//仅显示时间
|
|
|
- if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
+ if (LedItem.TYPE_192_32.equals(ledResolution)) {
|
|
|
+ //192x32
|
|
|
+ hProgram = ledC2M.CreateProgram(192, 32, 1,1, savaType);
|
|
|
+ ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
+ if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
+ //左边添加一个静字
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 0, 1, 0, 0, 48, 32, 0);
|
|
|
+ ledC2M.AddStaticTextToImageTextArea(hProgram, 0, 1, 0, "静", Constants.Companion.getC2M_LED_FONT_PATH(), 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
+ //时间
|
|
|
+ ledC2M.AddDigitalClockArea(hProgram, 0, 2, 48, 0, 144, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
+ 16, 0xff, 0, 0, 0,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
+ 0, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
+ } else {
|
|
|
+ ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 192, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
+ 16, 0xff, 0, 0, 0,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
+ 4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
+ }
|
|
|
+ } else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
//64x16
|
|
|
hProgram = ledC2M.CreateProgram(64, 16, 1,grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
@@ -335,19 +389,40 @@ public class LedC2MManager extends LedManager {
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
16, 0xff, 0, 0, 0,
|
|
|
- 1, 0, 1, 1, 1, 1, 1,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
0, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
} else {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
16, 0xff, 0, 0, 0,
|
|
|
- 1, 0, 1, 1, 1, 1, 1,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
}
|
|
|
}
|
|
|
} else if (type == 1) {
|
|
|
//显示时间和自定义内容
|
|
|
String text = SettingConfig.getLedCustomInfo(application);
|
|
|
- if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
+ if (LedItem.TYPE_192_32.equals(ledResolution)) {
|
|
|
+ //192x32
|
|
|
+ hProgram = ledC2M.CreateProgram(192, 32, 1,1,savaType);
|
|
|
+ ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
+ if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
+ ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 192, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
+ 16, 0xff, 0, 0, 0,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
+ 0, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
+ } else {
|
|
|
+ ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 192, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
+ 16, 0xff, 0, 0, 0,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
+ 4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!TextUtils.isEmpty(text)) {
|
|
|
+ ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 192, 32, 0);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
+ }
|
|
|
+ } else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
//64x16
|
|
|
hProgram = ledC2M.CreateProgram(64, 16, 1,grayLevel,savaType);
|
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
@@ -388,12 +463,12 @@ public class LedC2MManager extends LedManager {
|
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
16, 0xff, 0, 0, 0,
|
|
|
- 1, 0, 1, 1, 1, 1, 1,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
0, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
} else {
|
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
|
|
|
16, 0xff, 0, 0, 0,
|
|
|
- 1, 0, 1, 1, 1, 1, 1,
|
|
|
+ 1, 0, 1, 1, 1, 1, isSeconds,
|
|
|
4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
|
}
|
|
|
|
|
@@ -410,40 +485,88 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
private long createCallingProgram(String ledResolution, int fontSize) {
|
|
|
long hProgram = 0;
|
|
|
- int ledType = SettingConfig.getLedType(application);
|
|
|
- int grayLevel = 1;
|
|
|
- int nLayout = 0;
|
|
|
- ledC2M.InitLedType(ledType);
|
|
|
- if (ledType == 0) {
|
|
|
- grayLevel = 0;
|
|
|
- nLayout = 1;
|
|
|
- }
|
|
|
-
|
|
|
- if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
- //64x16
|
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1, grayLevel, 3);
|
|
|
- for (int i = 0; i < programTextList.size(); i++) {
|
|
|
- String text = programTextList.get(i).getText();
|
|
|
- ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 64, 16, nLayout);
|
|
|
- ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
- }
|
|
|
- } else if (LedItem.TYPE_128_16.equals(ledResolution)){
|
|
|
- //128x16
|
|
|
- hProgram = ledC2M.CreateProgram(128, 16, 1, grayLevel, 3);
|
|
|
- for (int i = 0; i < programTextList.size(); i++) {
|
|
|
- ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 16, nLayout);
|
|
|
- ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
+ try {
|
|
|
+ int ledType = SettingConfig.getLedType(application);
|
|
|
+ int grayLevel = 1;
|
|
|
+ int nLayout = 0;
|
|
|
+ ledC2M.InitLedType(ledType);
|
|
|
+ if (ledType == 0) {
|
|
|
+ grayLevel = 0;
|
|
|
+ nLayout = 1;
|
|
|
}
|
|
|
- } else {
|
|
|
- //128x32
|
|
|
- hProgram = ledC2M.CreateProgram(128, 32, 1, grayLevel, 3);
|
|
|
- for (int i = 0; i < programTextList.size(); i++) {
|
|
|
- ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
- ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 32, nLayout);
|
|
|
- ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
+
|
|
|
+ if (LedItem.TYPE_192_32.equals(ledResolution)) {
|
|
|
+ //192x32,双行显示
|
|
|
+ hProgram = ledC2M.CreateProgram(192, 32, 1, 1, 3);
|
|
|
+ int programTextCount = programTextList.size(); //呼叫信息数量
|
|
|
+ if (programTextCount == 1) {
|
|
|
+ ledC2M.AddProgram(hProgram, 0, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
+ //左边添加一个静字
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 0, 1, 0, 0, 48, 32, 0);
|
|
|
+ ledC2M.AddStaticTextToImageTextArea(hProgram, 0, 1, 0, "静", Constants.Companion.getC2M_LED_FONT_PATH(), 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
+
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 0, 2, 48, 0, 144, 16, 0);
|
|
|
+ //ledC2M.AddSinglelineTextToImageTextArea(hProgram, 0, 1, 0, programTextList.get(0).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, 0, 2, 0, programTextList.get(0).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 2, 8, 1, 1);
|
|
|
+ } else {
|
|
|
+ //一个节目分上下两块区域显示,一个区域显示一个呼叫信息,所以一共需要显示(pSize/2)个节目
|
|
|
+ int pSize;
|
|
|
+ if (programTextCount % 2 == 0) {
|
|
|
+ pSize = programTextCount / 2;
|
|
|
+ } else {
|
|
|
+ pSize = programTextCount / 2 + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ Log.e(TAG, "programTextCount= " + programTextCount + ", pSize= " + pSize);
|
|
|
+ for (int i = 0; i < pSize; i++) {
|
|
|
+ int textIndex = i * 2;
|
|
|
+ ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
+ //左边添加一个静字
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 48, 32, 0);
|
|
|
+ ledC2M.AddStaticTextToImageTextArea(hProgram, i, 1, 0, "静", Constants.Companion.getC2M_LED_FONT_PATH(), 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
+
|
|
|
+ //上面一行
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 2, 48, 0, 144, 16, 0);
|
|
|
+ //ledC2M.AddSinglelineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(textIndex).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 2, 0, programTextList.get(textIndex).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 2, 8, 1, 1);
|
|
|
+
|
|
|
+ if (textIndex + 1 < programTextCount) {
|
|
|
+ //下面一行
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 3, 48, 16, 144, 16, 0);
|
|
|
+ //ledC2M.AddSinglelineTextToImageTextArea(hProgram, i, 2, 0, programTextList.get(textIndex + 1).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 3, 0, programTextList.get(textIndex + 1).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 2, 8, 1, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
+ //64x16
|
|
|
+ hProgram = ledC2M.CreateProgram(64, 16, 1, grayLevel, 3);
|
|
|
+ for (int i = 0; i < programTextList.size(); i++) {
|
|
|
+ String text = programTextList.get(i).getText();
|
|
|
+ ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 64, 16, nLayout);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
+ }
|
|
|
+ } else if (LedItem.TYPE_128_16.equals(ledResolution)) {
|
|
|
+ //128x16
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 16, 1, grayLevel, 3);
|
|
|
+ for (int i = 0; i < programTextList.size(); i++) {
|
|
|
+ ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 16, nLayout);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //128x32
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 32, 1, grayLevel, 3);
|
|
|
+ for (int i = 0; i < programTextList.size(); i++) {
|
|
|
+ ledC2M.AddProgram(hProgram, i, SettingConfig.getLedProgramTime(BaseApplication.appContext), 1);
|
|
|
+ ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 32, nLayout);
|
|
|
+ ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log.e(TAG, "createCallingProgram call exception...");
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
return hProgram;
|
|
@@ -573,6 +696,7 @@ public class LedC2MManager extends LedManager {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
synchronized (lockObject) {
|
|
|
+ Log.d(TAG, "sync led time...");
|
|
|
for (int i = 0; i < ledList.size(); i++) {
|
|
|
ledC2M.AdjustTime(ledList.get(i).getIp());
|
|
|
}
|