|
@@ -359,7 +359,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}
|
|
|
//会到首页
|
|
|
- fun BackMain() {
|
|
|
+ fun backToMain() {
|
|
|
if (!mainFragment.equals(curFragment)) {
|
|
|
updateLeftBtState(mainFragment)
|
|
|
switchFragment(R.id.callingdoor_main_frame, MainFragment(), mainFragment)
|
|
@@ -680,7 +680,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
showMessage(R.string.net_error)
|
|
|
}
|
|
|
|
|
|
- Constant.callNums = 0
|
|
|
DoorLightHelper.resetDoorLight()
|
|
|
SpeechUtil.getInstance().stopSpeak()
|
|
|
bedCalls.clear()
|
|
@@ -689,37 +688,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
}
|
|
|
|
|
|
- //开启网络调试
|
|
|
- private fun openNetwrokDebug() {
|
|
|
- val commands = arrayListOf(
|
|
|
- "/system/bin/sh",
|
|
|
- "setprop service.adb.tcp.port 5555",
|
|
|
- "stop adbd",
|
|
|
- "start adbd"
|
|
|
- )
|
|
|
- try {
|
|
|
- RunAsRoot(commands)
|
|
|
- } catch (e: IOException) {
|
|
|
- e.printStackTrace()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private fun RunAsRoot(cmds: ArrayList<String>) {
|
|
|
- val p = Runtime.getRuntime().exec("su")
|
|
|
- val os = DataOutputStream(p.outputStream)
|
|
|
- for (tmpCmd in cmds) {
|
|
|
- os.writeBytes(
|
|
|
- """
|
|
|
- $tmpCmd
|
|
|
-
|
|
|
- """.trimIndent()
|
|
|
- )
|
|
|
- }
|
|
|
- os.writeBytes("exit\n")
|
|
|
- os.flush()
|
|
|
- }
|
|
|
-
|
|
|
//设置串口监听
|
|
|
fun setSerialListener() {
|
|
|
// 串口监听
|
|
@@ -1039,7 +1007,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
private fun regReceiver() {
|
|
|
receiver = TimeReceiver()
|
|
|
- var intentFilter = IntentFilter()
|
|
|
+ val intentFilter = IntentFilter()
|
|
|
intentFilter.addAction(Intent.ACTION_TIME_TICK)
|
|
|
intentFilter.addAction(Intent.ACTION_TIMEZONE_CHANGED)
|
|
|
intentFilter.addAction(Intent.ACTION_TIME_CHANGED)
|
|
@@ -1346,7 +1314,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
nursingInteId = interactionVO.id
|
|
|
SettingConfig.setNursingId(activity, nursingInteId)
|
|
|
- SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
|
|
|
+ HardWareFactroy.getHardTools().setDoorLight(1)
|
|
|
} else if (tcpModel.action == TcpAction.SideAction.SHOW || tcpModel.action == TcpAction.SideAction.CLEAR) {
|
|
|
//显示分机呼叫或紧急呼叫
|
|
|
updateCallInfo(tcpModel)
|
|
@@ -1415,26 +1383,21 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
private fun callControl(tcpModel: TcpModel) {
|
|
|
if (tcpModel.action == TcpAction.SideAction.CALL) {
|
|
|
- Constant.callNums++
|
|
|
- SerialPortHelper.setDoorLight(1, "200")
|
|
|
+ HardWareFactroy.getHardTools().setDoorLight(3)
|
|
|
} else if (tcpModel.action == TcpAction.SideAction.SOS_CALL) {
|
|
|
- SerialPortHelper.setDoorLight(1, "200")
|
|
|
+ HardWareFactroy.getHardTools().setDoorLight(3)
|
|
|
Constant.sosOn = true
|
|
|
} else if (tcpModel.action == TcpAction.SideAction.ACCEPT || tcpModel.action == TcpAction.SideAction.CANCEL) {
|
|
|
- Constant.callNums--
|
|
|
- if (Constant.callNums < 0) {
|
|
|
- Constant.callNums = 0
|
|
|
- }
|
|
|
//如果当前还有其他床位呼叫或者是紧急呼叫则不重置门灯
|
|
|
- if (Constant.callNums == 0 && !Constant.sosOn) {
|
|
|
+ if (bedCalls.size == 0 && !Constant.sosOn) {
|
|
|
DoorLightHelper.resetDoorLight()
|
|
|
}
|
|
|
} else if (tcpModel.action == TcpAction.SideAction.SOS_CANCEL) {
|
|
|
Constant.sosOn = false
|
|
|
- if (Constant.callNums == 0) {
|
|
|
+ if (bedCalls.size == 0) {
|
|
|
DoorLightHelper.resetDoorLight()
|
|
|
}
|
|
|
- }else if (tcpModel.action == TcpAction.SideAction.NURSING ||tcpModel.action == TcpAction.SideAction.NURSING_END) {
|
|
|
+ } else if (tcpModel.action == TcpAction.SideAction.NURSING ||tcpModel.action == TcpAction.SideAction.NURSING_END) {
|
|
|
DoorLightHelper.resetDoorLight()
|
|
|
}
|
|
|
}
|
|
@@ -1491,12 +1454,19 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //此时若没有分机呼叫和紧急呼叫则重置门灯
|
|
|
+ if (bedCalls.size == 0 && !Constant.sosOn) {
|
|
|
+ DoorLightHelper.resetDoorLight()
|
|
|
+ }
|
|
|
+
|
|
|
/*if (Locale.CHINESE.language.equals(language)) {
|
|
|
if (Constant.TTS_STATUS == 2) {
|
|
|
SpeechUtil.getInstance().removeSpeak(speechText)
|
|
|
}
|
|
|
}*/
|
|
|
}
|
|
|
+
|
|
|
//分机呼叫显示
|
|
|
showCalls()
|
|
|
} catch (ex: Exception) {
|
|
@@ -1523,9 +1493,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
runOnUiThread {
|
|
|
showCalls()
|
|
|
}
|
|
|
- } else {
|
|
|
- Constant.callNums = 0
|
|
|
- DoorLightHelper.resetDoorLight()
|
|
|
}
|
|
|
} catch (ex: Exception) {
|
|
|
ex.printStackTrace()
|