|
@@ -64,8 +64,6 @@ public class MainActivity extends SerialPortActivity {
|
|
String callbackString = "";
|
|
String callbackString = "";
|
|
|
|
|
|
private SmdtManager smdtManager;
|
|
private SmdtManager smdtManager;
|
|
- private String defaultIP = "172.28.100.10";
|
|
|
|
- private String ledIp = "172.28.100.210";
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -150,6 +148,7 @@ public class MainActivity extends SerialPortActivity {
|
|
smdtManager = SmdtManager.create(this);
|
|
smdtManager = SmdtManager.create(this);
|
|
|
|
|
|
//获取当前IP地址,如果IP不对则设置一下默认IP
|
|
//获取当前IP地址,如果IP不对则设置一下默认IP
|
|
|
|
+ String defaultIP = SettingConfig.getHostIp(getApplicationContext());
|
|
if (!defaultIP.equals(localIP)) {
|
|
if (!defaultIP.equals(localIP)) {
|
|
Log.e(TAG, "set default ip: " + defaultIP);
|
|
Log.e(TAG, "set default ip: " + defaultIP);
|
|
try {
|
|
try {
|
|
@@ -161,10 +160,10 @@ public class MainActivity extends SerialPortActivity {
|
|
|
|
|
|
SpeechUtil.getInstance().init(this, null);
|
|
SpeechUtil.getInstance().init(this, null);
|
|
|
|
|
|
- setLedParams(SettingConfig.getLedResolution(this), SettingConfig.getLedFontSize(this));
|
|
|
|
|
|
+ setLedParams(SettingConfig.getLedIp(this), SettingConfig.getLedResolution(this), SettingConfig.getLedFontSize(this));
|
|
}
|
|
}
|
|
|
|
|
|
- private void setLedParams(String resolution, int fontSize) {
|
|
|
|
|
|
+ private void setLedParams(String ledIp, String resolution, int fontSize) {
|
|
LedItem ledItem = new LedItem(resolution, ledIp, false, fontSize);
|
|
LedItem ledItem = new LedItem(resolution, ledIp, false, fontSize);
|
|
ArrayList<LedItem> list = new ArrayList<>();
|
|
ArrayList<LedItem> list = new ArrayList<>();
|
|
list.add(ledItem);
|
|
list.add(ledItem);
|
|
@@ -279,12 +278,42 @@ public class MainActivity extends SerialPortActivity {
|
|
|
|
|
|
if (!TextUtils.isEmpty(text)) {
|
|
if (!TextUtils.isEmpty(text)) {
|
|
if ("reboot".equals(text)) {
|
|
if ("reboot".equals(text)) {
|
|
- //重启
|
|
|
|
|
|
+ //重启点阵屏
|
|
LedManagerUtils.getInstance().removeAllProgram(true);
|
|
LedManagerUtils.getInstance().removeAllProgram(true);
|
|
SpeechUtil.getInstance().stopSpeak();
|
|
SpeechUtil.getInstance().stopSpeak();
|
|
|
|
|
|
- if (smdtManager != null) {
|
|
|
|
- smdtManager.smdtReboot("reboot");
|
|
|
|
|
|
+ //延迟5s重启Android板
|
|
|
|
+ new Thread(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(5000);
|
|
|
|
+
|
|
|
|
+ if (smdtManager != null) {
|
|
|
|
+ smdtManager.smdtReboot("reboot");
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }).start();
|
|
|
|
+ } else if (text.startsWith("led")) {
|
|
|
|
+ //修改点阵屏IP
|
|
|
|
+ int sepIndex = text.indexOf("@");
|
|
|
|
+ String ledIP = text.substring(sepIndex+1);
|
|
|
|
+ Log.e(TAG, "set led ip: " + ledIP);
|
|
|
|
+ SettingConfig.setLedIp(getApplicationContext(), ledIP);
|
|
|
|
+ setLedParams(ledIP, SettingConfig.getLedResolution(getApplicationContext()), SettingConfig.getLedFontSize(getApplicationContext()));
|
|
|
|
+ } else if (text.startsWith("host")) {
|
|
|
|
+ //修改Android控制板IP
|
|
|
|
+ int sepIndex = text.indexOf("@");
|
|
|
|
+ String hostIP = text.substring(sepIndex+1);
|
|
|
|
+ Log.e(TAG, "set host ip: " + hostIP);
|
|
|
|
+ try {
|
|
|
|
+ smdtManager.smdtSetEthIPAddress(hostIP, "255.255.0.0", "172.28.100.1", "8.8.8.8");
|
|
|
|
+ SettingConfig.setHostIp(getApplicationContext(), hostIP);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//点阵屏显示
|
|
//点阵屏显示
|
|
@@ -300,7 +329,7 @@ public class MainActivity extends SerialPortActivity {
|
|
|
|
|
|
if (TextUtils.isEmpty(text)) {
|
|
if (TextUtils.isEmpty(text)) {
|
|
//清除所有信息
|
|
//清除所有信息
|
|
- LedManagerUtils.getInstance().removeAllProgram(true);
|
|
|
|
|
|
+ LedManagerUtils.getInstance().updateProgram("clearAll", 3);
|
|
SpeechUtil.getInstance().stopSpeak();
|
|
SpeechUtil.getInstance().stopSpeak();
|
|
} else {
|
|
} else {
|
|
//清除对应呼叫
|
|
//清除对应呼叫
|
|
@@ -320,7 +349,7 @@ public class MainActivity extends SerialPortActivity {
|
|
SettingConfig.setLedVoiceVolume(getApplicationContext(), volume);
|
|
SettingConfig.setLedVoiceVolume(getApplicationContext(), volume);
|
|
SettingConfig.setLedResolution(getApplicationContext(), ledType);
|
|
SettingConfig.setLedResolution(getApplicationContext(), ledType);
|
|
SettingConfig.setLedFontSize(getApplicationContext(), ledSize);
|
|
SettingConfig.setLedFontSize(getApplicationContext(), ledSize);
|
|
- setLedParams(ledType, ledSize);
|
|
|
|
|
|
+ setLedParams(SettingConfig.getLedIp(this), ledType, ledSize);
|
|
|
|
|
|
if (volume > 0 && volume <= 10) {
|
|
if (volume > 0 && volume <= 10) {
|
|
VoiceManagerUtil.setMusicVoice(getApplicationContext(), volume * 10);
|
|
VoiceManagerUtil.setMusicVoice(getApplicationContext(), volume * 10);
|
|
@@ -335,6 +364,24 @@ public class MainActivity extends SerialPortActivity {
|
|
setSysTime(time, timezone);
|
|
setSysTime(time, timezone);
|
|
} else if (TcpAction.S433Action.EXIST == tcpModel.getAction()) {
|
|
} else if (TcpAction.S433Action.EXIST == tcpModel.getAction()) {
|
|
//显示调试信息
|
|
//显示调试信息
|
|
|
|
+ final String debugInfo = "host IP: " + localIP
|
|
|
|
+ + "\nhost mac: " + macAddress
|
|
|
|
+ + "\nled IP: " + SettingConfig.getLedIp(getApplicationContext())
|
|
|
|
+ + "\napp version: " + BuildConfig.VERSION_NAME;
|
|
|
|
+ LedManagerUtils.getInstance().updateProgram(debugInfo, 1);
|
|
|
|
+ //1分钟后清除调试信息
|
|
|
|
+ new Thread(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(60000);
|
|
|
|
+
|
|
|
|
+ LedManagerUtils.getInstance().updateProgram(debugInfo, 2);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }).start();
|
|
}
|
|
}
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|