|
@@ -6,10 +6,10 @@ import android.util.Log;
|
|
|
|
|
|
import com.listenvision.LedC2M;
|
|
import com.listenvision.LedC2M;
|
|
import com.listenvision.model.VoiceModel;
|
|
import com.listenvision.model.VoiceModel;
|
|
|
|
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig;
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication;
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication;
|
|
import com.wdkl.ncs.android.lib.core.locale.LocaleMangerUtils;
|
|
import com.wdkl.ncs.android.lib.core.locale.LocaleMangerUtils;
|
|
import com.wdkl.ncs.android.middleware.common.Constant;
|
|
import com.wdkl.ncs.android.middleware.common.Constant;
|
|
-import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
@@ -29,6 +29,8 @@ import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
+import static com.wdkl.ncs.android.lib.utils.ExtendMethodsKt.debugLog;
|
|
|
|
+
|
|
public class LedC2MManager extends LedManager {
|
|
public class LedC2MManager extends LedManager {
|
|
private static final String TAG = "ledC2M";
|
|
private static final String TAG = "ledC2M";
|
|
|
|
|
|
@@ -41,7 +43,7 @@ public class LedC2MManager extends LedManager {
|
|
private static String deleteVoiceText;
|
|
private static String deleteVoiceText;
|
|
private static boolean stopVoice = false;
|
|
private static boolean stopVoice = false;
|
|
|
|
|
|
- private static long LED_TIMEOUT = 30*60*1000L;
|
|
|
|
|
|
+ private static long LED_TIMEOUT = 60*60*1000L;
|
|
|
|
|
|
private final static Object lockObject = new Object();
|
|
private final static Object lockObject = new Object();
|
|
|
|
|
|
@@ -54,7 +56,7 @@ public class LedC2MManager extends LedManager {
|
|
this.application = application;
|
|
this.application = application;
|
|
File file = new File(Constant.C2M_LED_FONT_PATH);
|
|
File file = new File(Constant.C2M_LED_FONT_PATH);
|
|
if (file.exists()) {
|
|
if (file.exists()) {
|
|
- Constant.ledFontExist=true;
|
|
|
|
|
|
+ Constant.ledFontExist = true;
|
|
} else {
|
|
} else {
|
|
copyFont();
|
|
copyFont();
|
|
}
|
|
}
|
|
@@ -69,8 +71,7 @@ public class LedC2MManager extends LedManager {
|
|
ledC2M.copyFontFile(new LedC2M.LedFontCheck() {
|
|
ledC2M.copyFontFile(new LedC2M.LedFontCheck() {
|
|
@Override
|
|
@Override
|
|
public void onChecked(boolean check) {
|
|
public void onChecked(boolean check) {
|
|
- Constant.ledFontExist=check;
|
|
|
|
- //ExtendMethodsKt.showMessage("字库文件copy完成...");
|
|
|
|
|
|
+ Constant.ledFontExist = check;
|
|
Log.d(TAG, "led font copy end...");
|
|
Log.d(TAG, "led font copy end...");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -133,15 +134,33 @@ public class LedC2MManager extends LedManager {
|
|
int server_port = 9999;
|
|
int server_port = 9999;
|
|
String text = "";
|
|
String text = "";
|
|
byte[] data;
|
|
byte[] data;
|
|
|
|
+ int led_type = SettingConfig.getLedType(BaseApplication.appContext);
|
|
|
|
|
|
if (stopVoice) {
|
|
if (stopVoice) {
|
|
- data = VoiceModel.getStopVoiceData();
|
|
|
|
|
|
+ if (led_type == 0) {
|
|
|
|
+ //T卡
|
|
|
|
+ data = VoiceModel.getStopVoiceDataT4();
|
|
|
|
+ } else {
|
|
|
|
+ //默认C卡
|
|
|
|
+ data = VoiceModel.getStopVoiceDataC2M();
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
text = voiceText;
|
|
text = voiceText;
|
|
for (int j = 0; j < 2; j++) {
|
|
for (int j = 0; j < 2; j++) {
|
|
text = text + "," + voiceText;
|
|
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;
|
|
DatagramSocket s = null;
|
|
@@ -161,8 +180,7 @@ public class LedC2MManager extends LedManager {
|
|
if (Constant.OPEN_DEBUG) {
|
|
if (Constant.OPEN_DEBUG) {
|
|
Log.d(TAG, "udp send voice text: " + voiceText + ", voice data hex string: " + VoiceModel.bytesToHexString(data));
|
|
Log.d(TAG, "udp send voice text: " + voiceText + ", voice data hex string: " + VoiceModel.bytesToHexString(data));
|
|
}
|
|
}
|
|
- DatagramPacket p = new DatagramPacket(data, data.length, local,
|
|
|
|
- server_port);
|
|
|
|
|
|
+ DatagramPacket p = new DatagramPacket(data, data.length, local, server_port);
|
|
try {
|
|
try {
|
|
s.send(p);
|
|
s.send(p);
|
|
s.close();
|
|
s.close();
|
|
@@ -177,18 +195,35 @@ public class LedC2MManager extends LedManager {
|
|
try {
|
|
try {
|
|
byte[] data;
|
|
byte[] data;
|
|
String text = "";
|
|
String text = "";
|
|
|
|
+ int led_type = SettingConfig.getLedType(BaseApplication.appContext);
|
|
|
|
|
|
if (stopVoice) {
|
|
if (stopVoice) {
|
|
- data = VoiceModel.getStopVoiceData();
|
|
|
|
|
|
+ if (led_type == 0) {
|
|
|
|
+ //T卡
|
|
|
|
+ data = VoiceModel.getStopVoiceDataT4();
|
|
|
|
+ } else {
|
|
|
|
+ //默认C卡
|
|
|
|
+ data = VoiceModel.getStopVoiceDataC2M();
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
text = voiceText;
|
|
text = voiceText;
|
|
|
|
+ //voiceText.replaceAll("(\\d{1})", " $1");
|
|
int loop = SettingConfig.getLedVoiceTimes(BaseApplication.appContext) - 1;
|
|
int loop = SettingConfig.getLedVoiceTimes(BaseApplication.appContext) - 1;
|
|
for (int j = 0; j < loop; j++) {
|
|
for (int j = 0; j < loop; j++) {
|
|
text = text + "," + voiceText;
|
|
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);
|
|
Socket socket = new Socket(ip, 10000);
|
|
@@ -216,7 +251,7 @@ public class LedC2MManager extends LedManager {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
//开始组建节目: 如果字体文件不存在则直接返回
|
|
//开始组建节目: 如果字体文件不存在则直接返回
|
|
- if (!Constant.LED_EXIST) {
|
|
|
|
|
|
+ if (!Constant.ledFontExist) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -232,7 +267,7 @@ public class LedC2MManager extends LedManager {
|
|
//停止语音
|
|
//停止语音
|
|
stopVoice = true;
|
|
stopVoice = true;
|
|
long h = createDefaultProgram(ledItem.getResolution(), ledItem.getFontSize(), infoType, 3);
|
|
long h = createDefaultProgram(ledItem.getResolution(), ledItem.getFontSize(), infoType, 3);
|
|
- if (h != 0) {
|
|
|
|
|
|
+ if (h != 0 && !TextUtils.isEmpty(ledItem.getIp())) {
|
|
int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
|
|
int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
|
|
//语音节目
|
|
//语音节目
|
|
if (ledItem.getVoiceOn()) {
|
|
if (ledItem.getVoiceOn()) {
|
|
@@ -265,7 +300,7 @@ public class LedC2MManager extends LedManager {
|
|
for (LedItem ledItem : ledList) {
|
|
for (LedItem ledItem : ledList) {
|
|
if (ledItem != null) {
|
|
if (ledItem != null) {
|
|
long h = createCallingProgram(ledItem.getResolution(), ledItem.getFontSize());
|
|
long h = createCallingProgram(ledItem.getResolution(), ledItem.getFontSize());
|
|
- if (h != 0) {
|
|
|
|
|
|
+ if (h != 0 && !TextUtils.isEmpty(ledItem.getIp())) {
|
|
int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
|
|
int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
|
|
//语音节目
|
|
//语音节目
|
|
if (ledItem.getVoiceOn()) {
|
|
if (ledItem.getVoiceOn()) {
|
|
@@ -284,14 +319,49 @@ public class LedC2MManager extends LedManager {
|
|
}
|
|
}
|
|
|
|
|
|
private long createDefaultProgram(String ledResolution, int fontSize, int type, int savaType) {
|
|
private long createDefaultProgram(String ledResolution, int fontSize, int type, int savaType) {
|
|
|
|
+ /*if (!Strings.isNullOrEmpty(ledResolution)){
|
|
|
|
+ ledWidth = Integer.parseInt(ledResolution.split("x")[0]);
|
|
|
|
+ ledHeight = Integer.parseInt(ledResolution.split("x")[1]);
|
|
|
|
+ }*/
|
|
|
|
+
|
|
long hProgram = 0;
|
|
long hProgram = 0;
|
|
String language = LocaleMangerUtils.getApplicationLocale().getLanguage();
|
|
String language = LocaleMangerUtils.getApplicationLocale().getLanguage();
|
|
|
|
+ int ledType = SettingConfig.getLedType(application);
|
|
|
|
+ int isSeconds = SettingConfig.getLedTimeShowSeconds(application);
|
|
|
|
+ int grayLevel = 1;
|
|
|
|
+ int nLayout = 0;
|
|
|
|
+ ledC2M.InitLedType(ledType);
|
|
|
|
+ if (ledType == 0) {
|
|
|
|
+ grayLevel = 0;
|
|
|
|
+ nLayout = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (type == 0) {
|
|
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, "静", Constant.C2M_LED_FONT_PATH, 28, 0xff, 1, 0, 0, 0, 1, 1);
|
|
|
|
+ //时间
|
|
|
|
+ ledC2M.AddDigitalClockArea(hProgram, 0, 2, 48, 0, 144, 32, Constant.C2M_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, Constant.C2M_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
|
|
//64x16
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1,1,savaType);
|
|
|
|
|
|
+ hProgram = ledC2M.CreateProgram(64, 16, 1,grayLevel,savaType);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
|
|
+
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
16, 0xff, 0, 0, 0,
|
|
@@ -305,7 +375,7 @@ public class LedC2MManager extends LedManager {
|
|
}
|
|
}
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)) {
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)) {
|
|
//128x16
|
|
//128x16
|
|
- hProgram = ledC2M.CreateProgram(128, 16, 1,1,savaType);
|
|
|
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 16, 1,grayLevel,savaType);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
16, 0xff, 0, 0, 0,
|
|
@@ -313,26 +383,47 @@ public class LedC2MManager extends LedManager {
|
|
4, 0xff, 0, 0xff, 2, 0xff, 0);
|
|
4, 0xff, 0, 0xff, 2, 0xff, 0);
|
|
} else {
|
|
} else {
|
|
//默认为128x32
|
|
//默认为128x32
|
|
- hProgram = ledC2M.CreateProgram(128, 32, 1,1, savaType);
|
|
|
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 32, 1,grayLevel, savaType);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
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);
|
|
0, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
} else {
|
|
} else {
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
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);
|
|
4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (type == 1) {
|
|
} else if (type == 1) {
|
|
//显示时间和自定义内容
|
|
//显示时间和自定义内容
|
|
String text = SettingConfig.getLedCustomInfo(application);
|
|
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, Constant.C2M_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, Constant.C2M_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, Constant.C2M_LED_FONT_PATH, fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
|
|
+ }
|
|
|
|
+ } else if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
//64x16
|
|
//64x16
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1,1,savaType);
|
|
|
|
|
|
+ hProgram = ledC2M.CreateProgram(64, 16, 1,grayLevel,savaType);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constant.C2M_LED_FONT_PATH,
|
|
@@ -345,14 +436,15 @@ public class LedC2MManager extends LedManager {
|
|
0, 0, 0, 0, 1, 1, 0,
|
|
0, 0, 0, 0, 1, 1, 0,
|
|
4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
}
|
|
}
|
|
|
|
+
|
|
if (!TextUtils.isEmpty(text)) {
|
|
if (!TextUtils.isEmpty(text)) {
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 64, 16, 0);
|
|
|
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 64, 16, nLayout);
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constant.C2M_LED_FONT_PATH, 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constant.C2M_LED_FONT_PATH, 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
}
|
|
}
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)){
|
|
} else if (LedItem.TYPE_128_16.equals(ledResolution)){
|
|
//128x16
|
|
//128x16
|
|
- hProgram = ledC2M.CreateProgram(128, 16, 1,1,savaType);
|
|
|
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 16, 1,grayLevel,savaType);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
16, 0xff, 0, 0, 0,
|
|
@@ -360,28 +452,28 @@ public class LedC2MManager extends LedManager {
|
|
4, 0xff, 0, 0xff, 2, 0xff, 0);
|
|
4, 0xff, 0, 0xff, 2, 0xff, 0);
|
|
if (!TextUtils.isEmpty(text)) {
|
|
if (!TextUtils.isEmpty(text)) {
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 16, 0);
|
|
|
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 16, nLayout);
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constant.C2M_LED_FONT_PATH, fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constant.C2M_LED_FONT_PATH, fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//128x32
|
|
//128x32
|
|
- hProgram = ledC2M.CreateProgram(128, 32, 1,1,savaType);
|
|
|
|
|
|
+ hProgram = ledC2M.CreateProgram(128, 32, 1,grayLevel,savaType);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 0, 10, 1);
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
if (Locale.CHINESE.getLanguage().equals(language)) {
|
|
- ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32,Constant.C2M_LED_FONT_PATH,
|
|
|
|
|
|
+ ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
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);
|
|
0, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
} else {
|
|
} else {
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constant.C2M_LED_FONT_PATH,
|
|
16, 0xff, 0, 0, 0,
|
|
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);
|
|
4, 0xff, 0, 0xff, 2, 0xff, 1);
|
|
}
|
|
}
|
|
|
|
|
|
if (!TextUtils.isEmpty(text)) {
|
|
if (!TextUtils.isEmpty(text)) {
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
ledC2M.AddProgram(hProgram, 1, 10, 1);
|
|
- ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 32, 0);
|
|
|
|
|
|
+ ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 32, nLayout);
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constant.C2M_LED_FONT_PATH, fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constant.C2M_LED_FONT_PATH, fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -392,31 +484,88 @@ public class LedC2MManager extends LedManager {
|
|
|
|
|
|
private long createCallingProgram(String ledResolution, int fontSize) {
|
|
private long createCallingProgram(String ledResolution, int fontSize) {
|
|
long hProgram = 0;
|
|
long hProgram = 0;
|
|
- if (LedItem.TYPE_64_16.equals(ledResolution)) {
|
|
|
|
- //64x16
|
|
|
|
- hProgram = ledC2M.CreateProgram(64, 16, 1, 1, 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, 0);
|
|
|
|
- ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, text, Constant.C2M_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, 1, 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, 0);
|
|
|
|
- ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constant.C2M_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, 1, 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, 0);
|
|
|
|
- ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constant.C2M_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, "静", Constant.C2M_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(), Constant.C2M_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, "静", Constant.C2M_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(), Constant.C2M_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(), Constant.C2M_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, Constant.C2M_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(), Constant.C2M_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(), Constant.C2M_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;
|
|
return hProgram;
|
|
@@ -427,6 +576,7 @@ public class LedC2MManager extends LedManager {
|
|
@Override
|
|
@Override
|
|
public synchronized void updateProgram(String text, int action) {
|
|
public synchronized void updateProgram(String text, int action) {
|
|
synchronized (lockObject) {
|
|
synchronized (lockObject) {
|
|
|
|
+ Log.d(TAG, "update program text: " + text + ", action: " + action);
|
|
if (text == null) {
|
|
if (text == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -483,7 +633,7 @@ public class LedC2MManager extends LedManager {
|
|
public void run() {
|
|
public void run() {
|
|
synchronized (lockObject) {
|
|
synchronized (lockObject) {
|
|
//如果字体文件不存在则直接返回
|
|
//如果字体文件不存在则直接返回
|
|
- if (!Constant.LED_EXIST) {
|
|
|
|
|
|
+ if (!Constant.ledFontExist) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -495,7 +645,7 @@ public class LedC2MManager extends LedManager {
|
|
for (LedItem ledItem : ledList) {
|
|
for (LedItem ledItem : ledList) {
|
|
if (ledItem != null) {
|
|
if (ledItem != null) {
|
|
long h = createDefaultProgram(ledItem.getResolution(), ledItem.getFontSize(), infoType, 0);
|
|
long h = createDefaultProgram(ledItem.getResolution(), ledItem.getFontSize(), infoType, 0);
|
|
- if (h != 0) {
|
|
|
|
|
|
+ if (h != 0 && !TextUtils.isEmpty(ledItem.getIp())) {
|
|
int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
|
|
int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
|
|
//语音节目
|
|
//语音节目
|
|
//if (Constants.Companion.getLedVoiceOn() == 1) {
|
|
//if (Constants.Companion.getLedVoiceOn() == 1) {
|
|
@@ -505,11 +655,15 @@ public class LedC2MManager extends LedManager {
|
|
if (Constant.OPEN_DEBUG) {
|
|
if (Constant.OPEN_DEBUG) {
|
|
Log.d(TAG, "send default program to " + ledItem.getIp() + ", result: " + result);
|
|
Log.d(TAG, "send default program to " + ledItem.getIp() + ", result: " + result);
|
|
}
|
|
}
|
|
|
|
+ if (result != 0) {
|
|
|
|
+ //节目发送失败
|
|
|
|
+ debugLog(TAG,"send default program to: " + ledItem.getIp() + ", result: " + result);
|
|
|
|
+ }
|
|
ledC2M.DeleteProgram(h);
|
|
ledC2M.DeleteProgram(h);
|
|
- }
|
|
|
|
|
|
|
|
- if (needReboot) {
|
|
|
|
- ledC2M.PowerOnOff(ledItem.getIp(), 2);
|
|
|
|
|
|
+ if (needReboot) {
|
|
|
|
+ ledC2M.PowerOnOff(ledItem.getIp(), 2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -529,7 +683,11 @@ public class LedC2MManager extends LedManager {
|
|
@Override
|
|
@Override
|
|
public void removeAllProgram() {
|
|
public void removeAllProgram() {
|
|
programTextList.clear();
|
|
programTextList.clear();
|
|
- sendDefaultProgram(true);
|
|
|
|
|
|
+ if (SettingConfig.getLedType(application) == 0) {
|
|
|
|
+ sendDefaultProgram(false);
|
|
|
|
+ } else {
|
|
|
|
+ sendDefaultProgram(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -538,6 +696,7 @@ public class LedC2MManager extends LedManager {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
synchronized (lockObject) {
|
|
synchronized (lockObject) {
|
|
|
|
+ Log.d(TAG, "sync led time...");
|
|
for (int i = 0; i < ledList.size(); i++) {
|
|
for (int i = 0; i < ledList.size(); i++) {
|
|
ledC2M.AdjustTime(ledList.get(i).getIp());
|
|
ledC2M.AdjustTime(ledList.get(i).getIp());
|
|
}
|
|
}
|
|
@@ -569,6 +728,22 @@ public class LedC2MManager extends LedManager {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public void powerOnOff(final String ip, final boolean on) {
|
|
|
|
+ new Thread(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ int res;
|
|
|
|
+ if (on) {
|
|
|
|
+ res = ledC2M.PowerOnOff(ip, 0);
|
|
|
|
+ } else {
|
|
|
|
+ res = ledC2M.PowerOnOff(ip, 1);
|
|
|
|
+ }
|
|
|
|
+ Log.d(TAG, "powerOnOff --> " + ip + ", res=" + res);
|
|
|
|
+ }
|
|
|
|
+ }).start();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public void release() {
|
|
public void release() {
|
|
programTextList.clear();
|
|
programTextList.clear();
|
|
}
|
|
}
|