|
@@ -25,6 +25,7 @@ import android.support.annotation.Nullable;
|
|
|
import android.support.design.widget.Snackbar;
|
|
|
import android.support.v4.content.ContextCompat;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.View;
|
|
@@ -179,6 +180,8 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
*/
|
|
|
public static final String REGISTERCOM = "register_com";
|
|
|
|
|
|
+ private static boolean netOff = false;
|
|
|
+
|
|
|
/**
|
|
|
* 注册检测wifi强度广播
|
|
|
*/
|
|
@@ -435,6 +438,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
private final int TURN_OFF_SCREEN = 2007;
|
|
|
private final int RESET_UPDATE_FLAG = 2008;
|
|
|
private final int RESET_BROADCAST_VIEW = 2009;
|
|
|
+ private final int RESET_ETHE = 2010;
|
|
|
private MyHandler handler = new MyHandler(this);
|
|
|
|
|
|
private String SCREEN_OFF_LIGHT = "1";
|
|
@@ -511,6 +515,11 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
tvBroadcasting.setText("");
|
|
|
tvBroadcasting.setVisibility(View.INVISIBLE);
|
|
|
break;
|
|
|
+ case RESET_ETHE:
|
|
|
+ if (netOff) {
|
|
|
+ ToastUtil.showToast("网络异常,设备即将重启!!!");
|
|
|
+ CallingBedSendCommand.setNetStatus(serialPortUtil, "1");
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
// 没有实例不进行操作
|
|
@@ -688,7 +697,12 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
getSystemSettingData();
|
|
|
getNoticeData();
|
|
|
setTrustIcon();
|
|
|
- getBroadcastAudioFiles();
|
|
|
+
|
|
|
+ if (isDownloadMp3) {
|
|
|
+ ToastUtil.showToast("广播文件正在下载中,请稍等...");
|
|
|
+ } else {
|
|
|
+ getBroadcastAudioFiles();
|
|
|
+ }
|
|
|
/**
|
|
|
* 由于机器性能方面的差异有些机子的串口反应速度比较慢;急速初始化将失效!
|
|
|
* */
|
|
@@ -761,15 +775,23 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
public void run() {
|
|
|
switch (state) {
|
|
|
case REGISTERING:
|
|
|
+ netOff = false;
|
|
|
tvSipStatePoint.setBackgroundResource(R.color.yellow_color);
|
|
|
+ //网络恢复正常,重置重启计数
|
|
|
+ SharedPreferencesUtil.putIntSp(context, Constants.REBOOT_COUNT, Constants.REBOOT_COUNT, 0);
|
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "1");
|
|
|
break;
|
|
|
case REGISTERFAIL:
|
|
|
+ netOff = true;
|
|
|
tvSipStatePoint.setBackgroundResource(R.color.red_color);
|
|
|
+ handler.sendEmptyMessageDelayed(RESET_ETHE, 120000);
|
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "0");
|
|
|
break;
|
|
|
case REGISTERCOM:
|
|
|
+ netOff = false;
|
|
|
tvSipStatePoint.setBackgroundResource(R.color.green);
|
|
|
+ //网络恢复正常,重置重启计数
|
|
|
+ SharedPreferencesUtil.putIntSp(context, Constants.REBOOT_COUNT, Constants.REBOOT_COUNT, 0);
|
|
|
//CallingBedSendCommand.setSipStatus(serialPortUtil, "2");
|
|
|
//if (!state_bk.equals(REGISTERCOM)) {
|
|
|
// upDateParameter();
|
|
@@ -1798,7 +1820,11 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
long curTime = System.currentTimeMillis();
|
|
|
if (curTime - updateAudioTime > 10000) {
|
|
|
updateAudioTime = curTime;
|
|
|
- getBroadcastAudioFiles();
|
|
|
+ if (isDownloadMp3) {
|
|
|
+ ToastUtil.showToast("广播文件正在下载中,请稍等...");
|
|
|
+ } else {
|
|
|
+ getBroadcastAudioFiles();
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case "broadcast_1":
|
|
@@ -2711,7 +2737,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
|
|
|
|
//广播的实体
|
|
|
private ArrayList<AllBroadcastEntity> allBroadcastList = new ArrayList<>();
|
|
|
- private boolean isDownloadMp3;
|
|
|
+ private boolean isDownloadMp3 = false;
|
|
|
private boolean needReDownload = false;
|
|
|
|
|
|
//下载广播音频文件
|