|
@@ -19,6 +19,7 @@ import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.os.Message;
|
|
import android.os.Message;
|
|
|
|
+import android.os.SystemProperties;
|
|
import android.speech.tts.TextToSpeech;
|
|
import android.speech.tts.TextToSpeech;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.design.widget.Snackbar;
|
|
import android.support.design.widget.Snackbar;
|
|
@@ -376,6 +377,8 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
MarqueeText tvBedNum_big;
|
|
MarqueeText tvBedNum_big;
|
|
@Bind(R.id.view_main_layout_tv_name_big)
|
|
@Bind(R.id.view_main_layout_tv_name_big)
|
|
MarqueeText tvName_big;
|
|
MarqueeText tvName_big;
|
|
|
|
+ @Bind(R.id.rl_black_view)
|
|
|
|
+ View blackView;
|
|
|
|
|
|
private RelativeLayout rlBottomMessage;
|
|
private RelativeLayout rlBottomMessage;
|
|
private ImageView ivWelcome;
|
|
private ImageView ivWelcome;
|
|
@@ -409,6 +412,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
*/
|
|
*/
|
|
private long callTimeOut = (StringUtils.parseInt(Constants.CALLINGTIMEOUT) == 0 ? 30000 : StringUtils.parseInt(Constants.CALLINGTIMEOUT) * 1000);//默认30秒
|
|
private long callTimeOut = (StringUtils.parseInt(Constants.CALLINGTIMEOUT) == 0 ? 30000 : StringUtils.parseInt(Constants.CALLINGTIMEOUT) * 1000);//默认30秒
|
|
|
|
|
|
|
|
+ private long screenTimeOut = 15;
|
|
|
|
+
|
|
|
|
+ private String SCREEN_OFF_LIGHT = "1";
|
|
|
|
|
|
/**
|
|
/**
|
|
* 时间线程
|
|
* 时间线程
|
|
@@ -423,6 +429,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
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_BROADCAST_VIEW = 2007;
|
|
private final int RESET_BROADCAST_VIEW = 2007;
|
|
|
|
+ private final int TURN_OFF_SCREEN = 2008;
|
|
private MyHandler handler = new MyHandler(this);
|
|
private MyHandler handler = new MyHandler(this);
|
|
|
|
|
|
class MyHandler extends Handler {
|
|
class MyHandler extends Handler {
|
|
@@ -490,6 +497,10 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
tvBroadcasting.setText("");
|
|
tvBroadcasting.setText("");
|
|
tvBroadcasting.setVisibility(View.INVISIBLE);
|
|
tvBroadcasting.setVisibility(View.INVISIBLE);
|
|
break;
|
|
break;
|
|
|
|
+ case TURN_OFF_SCREEN:
|
|
|
|
+ //息屏
|
|
|
|
+ showBlackView();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// 没有实例不进行操作
|
|
// 没有实例不进行操作
|
|
@@ -575,6 +586,13 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
ScreenManagerUtil.setScreenBrightness(context, 210);
|
|
ScreenManagerUtil.setScreenBrightness(context, 210);
|
|
|
|
|
|
SoundPoolManager.getInstance().init();
|
|
SoundPoolManager.getInstance().init();
|
|
|
|
+
|
|
|
|
+ String model = SystemProperties.get("ro.product.model");
|
|
|
|
+ if ("WDFJ-I".equals(model)) {
|
|
|
|
+ SCREEN_OFF_LIGHT = "30";
|
|
|
|
+ } else if ("rk3128".equals(model)){
|
|
|
|
+ SCREEN_OFF_LIGHT = "1";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -592,6 +610,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
ivWelcome = vWelcome.findViewById(R.id.view_welcome_iv_main);
|
|
ivWelcome = vWelcome.findViewById(R.id.view_welcome_iv_main);
|
|
tvNoticeContent = vMain.findViewById(R.id.view_main_layout_tv_msg);
|
|
tvNoticeContent = vMain.findViewById(R.id.view_main_layout_tv_msg);
|
|
/*******************************************************/
|
|
/*******************************************************/
|
|
|
|
+ blackView.setVisibility(View.GONE);
|
|
|
|
|
|
timeThread = new TimeThread();
|
|
timeThread = new TimeThread();
|
|
timeThread.start();
|
|
timeThread.start();
|
|
@@ -871,6 +890,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
Constants.SCREENEXTINGUISHTIME = object.getString("screenExtinguishTime");
|
|
Constants.SCREENEXTINGUISHTIME = object.getString("screenExtinguishTime");
|
|
//Constants.DOORCALLVOICE = object.getString("DoorSipVol");
|
|
//Constants.DOORCALLVOICE = object.getString("DoorSipVol");
|
|
Constants.BEDCALLVOICE = object.getString("BedSipVol");
|
|
Constants.BEDCALLVOICE = object.getString("BedSipVol");
|
|
|
|
+ screenTimeOut = Integer.parseInt(Constants.SCREENEXTINGUISHTIME);
|
|
handler.sendEmptyMessage(SYSTEM_DATA_RESPONSE);
|
|
handler.sendEmptyMessage(SYSTEM_DATA_RESPONSE);
|
|
setSYSParameter();
|
|
setSYSParameter();
|
|
}
|
|
}
|
|
@@ -1379,6 +1399,17 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != vWelcome) {
|
|
if (null != vWelcome) {
|
|
//只有在欢迎界面没有显示的时候串口才能用
|
|
//只有在欢迎界面没有显示的时候串口才能用
|
|
if (vWelcome.getVisibility() == View.GONE) {
|
|
if (vWelcome.getVisibility() == View.GONE) {
|
|
|
|
+ //按键唤醒
|
|
|
|
+ if (blackView.getVisibility() == View.VISIBLE) {
|
|
|
|
+ CallingBedActivity.this.runOnUiThread(new Runnable() {
|
|
|
|
+ public void run() {
|
|
|
|
+ blackView.setVisibility(View.GONE);
|
|
|
|
+ showThisView(vMain);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ resetOffScreen();
|
|
|
|
+
|
|
//医嘱键短按松开
|
|
//医嘱键短按松开
|
|
if (buffer[0] == 1) {
|
|
if (buffer[0] == 1) {
|
|
CallingBedActivity.this.runOnUiThread(new Runnable() {
|
|
CallingBedActivity.this.runOnUiThread(new Runnable() {
|
|
@@ -1563,6 +1594,13 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void resetOffScreen() {
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
|
|
+ if (StringUtils.notEmpty(Constants.MORNING_NIGTH) && Constants.MORNING_NIGTH.equals("1") && Constants.SCREENLIGHT.equals(SCREEN_OFF_LIGHT)) {//晚上
|
|
|
|
+ handler.sendEmptyMessageDelayed(TURN_OFF_SCREEN, screenTimeOut*1000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void serialPortBedOnclickString(String str) {
|
|
public void serialPortBedOnclickString(String str) {
|
|
//LogUtil.d("serialPortBedOnclickString", "CallingBedActivity: " + str);
|
|
//LogUtil.d("serialPortBedOnclickString", "CallingBedActivity: " + str);
|
|
@@ -1652,6 +1690,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
CALL_STATUS = STANDBY;
|
|
CALL_STATUS = STANDBY;
|
|
showThisView(vMain);
|
|
showThisView(vMain);
|
|
resumeBroadcastVolume();
|
|
resumeBroadcastVolume();
|
|
|
|
+ resetOffScreen();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
flickerStatus = setWSHLightFlicker(serialPortUtil, false);
|
|
flickerStatus = setWSHLightFlicker(serialPortUtil, false);
|
|
@@ -1693,6 +1732,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (!CALL_STATUS.equals(STANDBY)) {
|
|
if (!CALL_STATUS.equals(STANDBY)) {
|
|
CALL_STATUS = STANDBY;
|
|
CALL_STATUS = STANDBY;
|
|
showThisView(vMain);
|
|
showThisView(vMain);
|
|
|
|
+ resetOffScreen();
|
|
SipHelperUtil.getInstance(this).getmSipCallBackI().endCall();
|
|
SipHelperUtil.getInstance(this).getmSipCallBackI().endCall();
|
|
}
|
|
}
|
|
flickerStatus = setWSHLightFlicker(serialPortUtil, false);
|
|
flickerStatus = setWSHLightFlicker(serialPortUtil, false);
|
|
@@ -1979,8 +2019,24 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
}
|
|
}
|
|
if (StringUtils.notEmpty(Constants.MORNING_NIGTH) && Constants.MORNING_NIGTH.equals("1")) {//晚上
|
|
if (StringUtils.notEmpty(Constants.MORNING_NIGTH) && Constants.MORNING_NIGTH.equals("1")) {//晚上
|
|
lightStatus = setWSHLight(serialPortUtil, true);
|
|
lightStatus = setWSHLight(serialPortUtil, true);
|
|
|
|
+ if (Constants.SCREENLIGHT.equals(SCREEN_OFF_LIGHT)) {
|
|
|
|
+ if (!isVisible(vNurse) && !isVisible(vSupport) && !isVisible(vCall)) {//排除呼叫状态
|
|
|
|
+ showBlackView();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
|
|
+ if (isVisible(blackView)) {
|
|
|
|
+ blackView.setVisibility(View.GONE);
|
|
|
|
+ showThisView(vMain);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
lightStatus = setWSHLight(serialPortUtil, false);
|
|
lightStatus = setWSHLight(serialPortUtil, false);
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
|
|
+ if (isVisible(blackView)) {
|
|
|
|
+ blackView.setVisibility(View.GONE);
|
|
|
|
+ showThisView(vMain);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (StringUtils.isInt(Constants.SCREENLIGHT)) {
|
|
if (StringUtils.isInt(Constants.SCREENLIGHT)) {
|
|
setSYSBrightness(CallingBedActivity.this, StringUtils.parseInt(Constants.SCREENLIGHT));
|
|
setSYSBrightness(CallingBedActivity.this, StringUtils.parseInt(Constants.SCREENLIGHT));
|
|
@@ -2100,6 +2156,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
timeOfBackMainPage = 0;
|
|
timeOfBackMainPage = 0;
|
|
timeOut = callTimeOutBack;
|
|
timeOut = callTimeOutBack;
|
|
if (isVisible(vSupport)) {
|
|
if (isVisible(vSupport)) {
|
|
|
|
+ resetOffScreen();
|
|
CALL_STATUS = STANDBY;
|
|
CALL_STATUS = STANDBY;
|
|
showThisView(vMain);
|
|
showThisView(vMain);
|
|
resumeBroadcastVolume();
|
|
resumeBroadcastVolume();
|
|
@@ -2118,6 +2175,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != initDataEntity) {
|
|
if (null != initDataEntity) {
|
|
jbVSupport = setJumpingBeans(tvSupportText, initDataEntity.getDeviceBedNum() + "床正在请求增援...");
|
|
jbVSupport = setJumpingBeans(tvSupportText, initDataEntity.getDeviceBedNum() + "床正在请求增援...");
|
|
}
|
|
}
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
} else {
|
|
} else {
|
|
showLlRightView();
|
|
showLlRightView();
|
|
}
|
|
}
|
|
@@ -2132,6 +2190,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != initDataEntity) {
|
|
if (null != initDataEntity) {
|
|
jbVSupport = setJumpingBeans(tvSupportText, initDataEntity.getDeviceBedNum() + "床正在请求增援...");
|
|
jbVSupport = setJumpingBeans(tvSupportText, initDataEntity.getDeviceBedNum() + "床正在请求增援...");
|
|
}
|
|
}
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
} else {
|
|
} else {
|
|
showToast("请先取消呼叫!");
|
|
showToast("请先取消呼叫!");
|
|
}
|
|
}
|
|
@@ -2144,6 +2203,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
timeOfBackMainPage = 0;
|
|
timeOfBackMainPage = 0;
|
|
timeOut = callTimeOutBack;
|
|
timeOut = callTimeOutBack;
|
|
if (isVisible(vCall)) {
|
|
if (isVisible(vCall)) {
|
|
|
|
+ resetOffScreen();
|
|
CALL_STATUS = STANDBY;
|
|
CALL_STATUS = STANDBY;
|
|
showThisView(vMain);
|
|
showThisView(vMain);
|
|
resumeBroadcastVolume();
|
|
resumeBroadcastVolume();
|
|
@@ -2161,6 +2221,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != initDataEntity) {
|
|
if (null != initDataEntity) {
|
|
jbVCall = setJumpingBeans(tvCallText, initDataEntity.getDeviceBedNum() + "床正在呼叫护工...");
|
|
jbVCall = setJumpingBeans(tvCallText, initDataEntity.getDeviceBedNum() + "床正在呼叫护工...");
|
|
}
|
|
}
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
} else {
|
|
} else {
|
|
showLlRightView();
|
|
showLlRightView();
|
|
}
|
|
}
|
|
@@ -2174,6 +2235,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != initDataEntity) {
|
|
if (null != initDataEntity) {
|
|
jbVCall = setJumpingBeans(tvCallText, initDataEntity.getDeviceBedNum() + "床正在呼叫护工...");
|
|
jbVCall = setJumpingBeans(tvCallText, initDataEntity.getDeviceBedNum() + "床正在呼叫护工...");
|
|
}
|
|
}
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
} else {
|
|
} else {
|
|
showToast("请先取消呼叫!");
|
|
showToast("请先取消呼叫!");
|
|
}
|
|
}
|
|
@@ -2188,14 +2250,16 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
vMain_big.setVisibility(View.GONE);//显示增长页面20191017
|
|
vMain_big.setVisibility(View.GONE);//显示增长页面20191017
|
|
timeOfBackMainPage = 0;
|
|
timeOfBackMainPage = 0;
|
|
timeOut = callTimeOutBack;
|
|
timeOut = callTimeOutBack;
|
|
|
|
+ goneLlRightView(false);
|
|
if (isVisible(vNurse)) {
|
|
if (isVisible(vNurse)) {
|
|
|
|
+ resetOffScreen();
|
|
callNurse = false;
|
|
callNurse = false;
|
|
UdpSendUtil.sendHangUp(initDataEntity, mainDataEntity);//取消呼叫 add by waderson 20191118
|
|
UdpSendUtil.sendHangUp(initDataEntity, mainDataEntity);//取消呼叫 add by waderson 20191118
|
|
SipHelperUtil.getInstance(CallingBedActivity.this).getmSipCallBackI().endCall();
|
|
SipHelperUtil.getInstance(CallingBedActivity.this).getmSipCallBackI().endCall();
|
|
CALL_STATUS = STANDBY;
|
|
CALL_STATUS = STANDBY;
|
|
showThisView(vMain);
|
|
showThisView(vMain);
|
|
resumeBroadcastVolume();
|
|
resumeBroadcastVolume();
|
|
- goneLlRightView(true);
|
|
|
|
|
|
+ //goneLlRightView(true);
|
|
} else {
|
|
} else {
|
|
if (isVisible(vMain)) {
|
|
if (isVisible(vMain)) {
|
|
callNurse = true;
|
|
callNurse = true;
|
|
@@ -2208,7 +2272,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != initDataEntity) {
|
|
if (null != initDataEntity) {
|
|
jbVNurse = setJumpingBeans(tvNurseText, initDataEntity.getDeviceBedNum() + "床已呼叫,等待护士接听中...");
|
|
jbVNurse = setJumpingBeans(tvNurseText, initDataEntity.getDeviceBedNum() + "床已呼叫,等待护士接听中...");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
} else {
|
|
} else {
|
|
if (!isVisible(vSupport) && !isVisible(vCall)) {//排除呼叫状态
|
|
if (!isVisible(vSupport) && !isVisible(vCall)) {//排除呼叫状态
|
|
callNurse = true;
|
|
callNurse = true;
|
|
@@ -2221,6 +2285,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
if (null != initDataEntity) {
|
|
if (null != initDataEntity) {
|
|
jbVNurse = setJumpingBeans(tvNurseText, initDataEntity.getDeviceBedNum() + "床已呼叫,等待护士接听中...");
|
|
jbVNurse = setJumpingBeans(tvNurseText, initDataEntity.getDeviceBedNum() + "床已呼叫,等待护士接听中...");
|
|
}
|
|
}
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
} else {
|
|
} else {
|
|
showToast("请先取消呼叫!");
|
|
showToast("请先取消呼叫!");
|
|
}
|
|
}
|
|
@@ -2228,6 +2293,18 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void showBlackView() {
|
|
|
|
+ if (blackView.getVisibility() == View.VISIBLE) return;
|
|
|
|
+ if (allViews == null) return;
|
|
|
|
+ for (View v : allViews) {
|
|
|
|
+ if (v.getVisibility() == View.VISIBLE) {
|
|
|
|
+ v.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ llRight.setVisibility(View.GONE);
|
|
|
|
+ blackView.setVisibility(View.VISIBLE);
|
|
|
|
+ }
|
|
|
|
+
|
|
private void muteBroadcastVolume() {
|
|
private void muteBroadcastVolume() {
|
|
if (MediaPlayerManger.getInstance().isPlay()) {
|
|
if (MediaPlayerManger.getInstance().isPlay()) {
|
|
MediaPlayerManger.getInstance().setVolume(0);
|
|
MediaPlayerManger.getInstance().setVolume(0);
|
|
@@ -2419,6 +2496,12 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}*/
|
|
}*/
|
|
|
|
+ //通话唤醒
|
|
|
|
+ if (isVisible(blackView)) {
|
|
|
|
+ blackView.setVisibility(View.GONE);
|
|
|
|
+ showThisView(vMain);
|
|
|
|
+ handler.removeMessages(TURN_OFF_SCREEN);
|
|
|
|
+ }
|
|
|
|
|
|
//通话中广播静音
|
|
//通话中广播静音
|
|
muteBroadcastVolume();
|
|
muteBroadcastVolume();
|
|
@@ -2489,6 +2572,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
|
|
//发送udp让门口机text变白色
|
|
//发送udp让门口机text变白色
|
|
UdpSendUtil.sendCallNoticeDoor(initDataEntity, mainDataEntity, "0");
|
|
UdpSendUtil.sendCallNoticeDoor(initDataEntity, mainDataEntity, "0");
|
|
}
|
|
}
|
|
|
|
+ resetOffScreen();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|