|
@@ -177,6 +177,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
*/
|
|
*/
|
|
public static final String REGISTERCOM = "register_com";
|
|
public static final String REGISTERCOM = "register_com";
|
|
|
|
|
|
|
|
+ private static boolean netOff = false;
|
|
/**
|
|
/**
|
|
* 注册检测wifi强度广播
|
|
* 注册检测wifi强度广播
|
|
*/
|
|
*/
|
|
@@ -425,6 +426,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
private final int MAIN_DATA_ERROR = 2004;
|
|
private final int MAIN_DATA_ERROR = 2004;
|
|
private final int UPDATE_BROADCAST = 2005;
|
|
private final int UPDATE_BROADCAST = 2005;
|
|
private final int NEW_INCOMING_CALL = 2006;
|
|
private final int NEW_INCOMING_CALL = 2006;
|
|
|
|
+ private final int RESET_ETHE = 2009;
|
|
private MyHandler handler = new MyHandler(this);
|
|
private MyHandler handler = new MyHandler(this);
|
|
|
|
|
|
class MyHandler extends Handler {
|
|
class MyHandler extends Handler {
|
|
@@ -488,6 +490,12 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
case NEW_INCOMING_CALL:
|
|
case NEW_INCOMING_CALL:
|
|
//newCalling();
|
|
//newCalling();
|
|
break;
|
|
break;
|
|
|
|
+ case RESET_ETHE:
|
|
|
|
+ if (netOff) {
|
|
|
|
+ ToastUtil.showToast("网络异常,设备即将重启!!!");
|
|
|
|
+ CallingBedSendCommand.setNetStatus(serialPortUtil, "1");
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 没有实例不进行操作
|
|
// 没有实例不进行操作
|
|
@@ -658,7 +666,11 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
getSystemSettingData();
|
|
getSystemSettingData();
|
|
getNoticeData();
|
|
getNoticeData();
|
|
setTrustIcon();
|
|
setTrustIcon();
|
|
- getBroadcastAudioFiles();
|
|
|
|
|
|
+ if (isDownloadMp3) {
|
|
|
|
+ ToastUtil.showToast("广播文件正在下载中,请稍等...");
|
|
|
|
+ } else {
|
|
|
|
+ getBroadcastAudioFiles();
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 由于机器性能方面的差异有些机子的串口反应速度比较慢;急速初始化将失效!
|
|
* 由于机器性能方面的差异有些机子的串口反应速度比较慢;急速初始化将失效!
|
|
* */
|
|
* */
|
|
@@ -731,14 +743,18 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
public void run() {
|
|
public void run() {
|
|
switch (state) {
|
|
switch (state) {
|
|
case REGISTERING:
|
|
case REGISTERING:
|
|
|
|
+ netOff = false;
|
|
tvSipStatePoint.setBackgroundResource(R.color.yellow_color);
|
|
tvSipStatePoint.setBackgroundResource(R.color.yellow_color);
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "1");
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "1");
|
|
break;
|
|
break;
|
|
case REGISTERFAIL:
|
|
case REGISTERFAIL:
|
|
|
|
+ netOff = true;
|
|
tvSipStatePoint.setBackgroundResource(R.color.red_color);
|
|
tvSipStatePoint.setBackgroundResource(R.color.red_color);
|
|
|
|
+ handler.sendEmptyMessageDelayed(RESET_ETHE, 120000);
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "0");
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "0");
|
|
break;
|
|
break;
|
|
case REGISTERCOM:
|
|
case REGISTERCOM:
|
|
|
|
+ netOff = false;
|
|
tvSipStatePoint.setBackgroundResource(R.color.green);
|
|
tvSipStatePoint.setBackgroundResource(R.color.green);
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "2");
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "2");
|
|
//if (!state_bk.equals(REGISTERCOM)) {
|
|
//if (!state_bk.equals(REGISTERCOM)) {
|
|
@@ -1728,7 +1744,11 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
long curTime = System.currentTimeMillis();
|
|
long curTime = System.currentTimeMillis();
|
|
if (curTime - updateAudioTime > 10000) {
|
|
if (curTime - updateAudioTime > 10000) {
|
|
updateAudioTime = curTime;
|
|
updateAudioTime = curTime;
|
|
- getBroadcastAudioFiles();
|
|
|
|
|
|
+ if (isDownloadMp3) {
|
|
|
|
+ ToastUtil.showToast("广播文件正在下载中,请稍等...");
|
|
|
|
+ } else {
|
|
|
|
+ getBroadcastAudioFiles();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case "broadcast_1":
|
|
case "broadcast_1":
|
|
@@ -2565,6 +2585,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
|
|
|
//广播的实体
|
|
//广播的实体
|
|
private ArrayList<AllBroadcastEntity> allBroadcastList = new ArrayList<>();
|
|
private ArrayList<AllBroadcastEntity> allBroadcastList = new ArrayList<>();
|
|
|
|
+ private boolean isDownloadMp3 = false;
|
|
|
|
|
|
//下载广播音频文件
|
|
//下载广播音频文件
|
|
private void getBroadcastAudioFiles() {
|
|
private void getBroadcastAudioFiles() {
|
|
@@ -2649,6 +2670,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
private void checkAndDownloadMP3(final int index) {
|
|
private void checkAndDownloadMP3(final int index) {
|
|
LogUtil.d("broadcast", "checkAndDownloadMP3 start..." + index);
|
|
LogUtil.d("broadcast", "checkAndDownloadMP3 start..." + index);
|
|
if (allBroadcastList != null && allBroadcastList.size() > 0 && index < allBroadcastList.size()) {
|
|
if (allBroadcastList != null && allBroadcastList.size() > 0 && index < allBroadcastList.size()) {
|
|
|
|
+ isDownloadMp3 = true;
|
|
AllBroadcastEntity entity = allBroadcastList.get(index);
|
|
AllBroadcastEntity entity = allBroadcastList.get(index);
|
|
String filePath = entity.getFileName();
|
|
String filePath = entity.getFileName();
|
|
DownloadUtil2.getInstance().download(Constants.URL + Constants.URL_END + "/" + filePath,
|
|
DownloadUtil2.getInstance().download(Constants.URL + Constants.URL_END + "/" + filePath,
|
|
@@ -2670,6 +2692,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
checkAndDownloadMP3(index+1);
|
|
checkAndDownloadMP3(index+1);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ } else {
|
|
|
|
+ //下载完成
|
|
|
|
+ isDownloadMp3 = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|