|
@@ -70,6 +70,7 @@ import kotlinx.android.synthetic.main.callingdoor_main_lay.view_flipper
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.black_view
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.black_view
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_home
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_home
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_more
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_more
|
|
|
|
+import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_blue_code
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay_rk3288.*
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay_rk3288.*
|
|
import kotlinx.android.synthetic.main.view_bed_name.*
|
|
import kotlinx.android.synthetic.main.view_bed_name.*
|
|
import kotlinx.android.synthetic.main.view_title_layout.*
|
|
import kotlinx.android.synthetic.main.view_title_layout.*
|
|
@@ -560,6 +561,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
}
|
|
}
|
|
|
|
|
|
private fun enterNursing() {
|
|
private fun enterNursing() {
|
|
|
|
+ room_action_blue_code.isEnabled = true
|
|
|
|
+
|
|
//if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
//if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
|
|
SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
|
|
//}
|
|
//}
|
|
@@ -574,6 +577,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
}
|
|
}
|
|
|
|
|
|
private fun exitNursing() {
|
|
private fun exitNursing() {
|
|
|
|
+ room_action_blue_code.isEnabled = false
|
|
|
|
+
|
|
//if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
//if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL)) {
|
|
//SerialPortHelper.setDoorLight(1, "111") //白色
|
|
//SerialPortHelper.setDoorLight(1, "111") //白色
|
|
DoorLightHelper.resetDoorLight()
|
|
DoorLightHelper.resetDoorLight()
|
|
@@ -792,6 +797,22 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
switchFragment(R.id.callingdoor_main_frame, QrCodeFragment(), qrFragment)
|
|
switchFragment(R.id.callingdoor_main_frame, QrCodeFragment(), qrFragment)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ room_action_blue_code.setOnClickListener {
|
|
|
|
+ //重置黑屏时间
|
|
|
|
+ resetSleepTime()
|
|
|
|
+
|
|
|
|
+ if (Constant.TCP_CONNECTED) {
|
|
|
|
+ if (Constant.DEVICE_ID != -1) {
|
|
|
|
+ //todo blue code action:
|
|
|
|
+ //OtherUtil.sendReinforce(Constant.DEVICE_ID)
|
|
|
|
+ } else {
|
|
|
|
+ showMessage("null device id!")
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ showMessage(R.string.net_error)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//设置串口监听
|
|
//设置串口监听
|
|
@@ -1179,6 +1200,9 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
} else {
|
|
} else {
|
|
showMessage(R.string.no_custom)
|
|
showMessage(R.string.no_custom)
|
|
}
|
|
}
|
|
|
|
+ } else if (Constant.CALL_STATE == Constant.CALL_INCOMING) {
|
|
|
|
+ //来电接听
|
|
|
|
+ EventBus.getDefault().post(MessageEvent("accept", Constant.EVENT_SERIAL_EVENT))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (buffer[8].toInt() == 1 || buffer[8].toInt() == 2
|
|
} else if (buffer[8].toInt() == 1 || buffer[8].toInt() == 2
|
|
@@ -1191,13 +1215,16 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
} else if (Constant.CALL_STATE == Constant.CALL_OUTGOING) {
|
|
} else if (Constant.CALL_STATE == Constant.CALL_OUTGOING) {
|
|
//呼叫取消
|
|
//呼叫取消
|
|
EventBus.getDefault().post(MessageEvent("cancel", Constant.EVENT_SERIAL_EVENT))
|
|
EventBus.getDefault().post(MessageEvent("cancel", Constant.EVENT_SERIAL_EVENT))
|
|
|
|
+ } else if (Constant.CALL_STATE == Constant.CALL_INCOMING) {
|
|
|
|
+ //来电拒接
|
|
|
|
+ EventBus.getDefault().post(MessageEvent("reject", Constant.EVENT_SERIAL_EVENT))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (buffer[9].toInt() == 1 || buffer[9].toInt() == 2) {
|
|
} else if (buffer[9].toInt() == 1 || buffer[9].toInt() == 2) {
|
|
//H1 call
|
|
//H1 call
|
|
Log.w(TAG, "H1 call...")
|
|
Log.w(TAG, "H1 call...")
|
|
runOnUiThread {
|
|
runOnUiThread {
|
|
- if (System.currentTimeMillis() - h1CallTime > 15000) {
|
|
|
|
|
|
+ if (System.currentTimeMillis() - h1CallTime > 5000) {
|
|
startHCall(1)
|
|
startHCall(1)
|
|
h1CallTime = System.currentTimeMillis()
|
|
h1CallTime = System.currentTimeMillis()
|
|
}
|
|
}
|
|
@@ -1206,7 +1233,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
//H2 call
|
|
//H2 call
|
|
runOnUiThread {
|
|
runOnUiThread {
|
|
Log.w(TAG, "H2 call...")
|
|
Log.w(TAG, "H2 call...")
|
|
- if (System.currentTimeMillis() - h2CallTime > 15000) {
|
|
|
|
|
|
+ if (System.currentTimeMillis() - h2CallTime > 5000) {
|
|
startHCall(2)
|
|
startHCall(2)
|
|
h2CallTime = System.currentTimeMillis()
|
|
h2CallTime = System.currentTimeMillis()
|
|
}
|
|
}
|
|
@@ -1351,22 +1378,34 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
Log.d(TAG, "handle call id: $handleId, H1 mac: ${Constant.DEVICE_H1_REGISTER_ID}, H2 mac: ${Constant.DEVICE_H2_REGISTER_ID}")
|
|
Log.d(TAG, "handle call id: $handleId, H1 mac: ${Constant.DEVICE_H1_REGISTER_ID}, H2 mac: ${Constant.DEVICE_H2_REGISTER_ID}")
|
|
if (handleId == 1 && beds >= 1) {
|
|
if (handleId == 1 && beds >= 1) {
|
|
//分机手柄1呼叫
|
|
//分机手柄1呼叫
|
|
|
|
+ var findH1 = false
|
|
for (bedVO in Utils.getInBedVOS()) {
|
|
for (bedVO in Utils.getInBedVOS()) {
|
|
if (Constant.DEVICE_H1_REGISTER_ID == bedVO.bedDeviceMac) {
|
|
if (Constant.DEVICE_H1_REGISTER_ID == bedVO.bedDeviceMac) {
|
|
|
|
+ findH1 = true
|
|
val callTcp = VoiceUtil.voiceHCall(bedVO.bedDeviceId, RoleTypeEnum.NURSE.name)
|
|
val callTcp = VoiceUtil.voiceHCall(bedVO.bedDeviceId, RoleTypeEnum.NURSE.name)
|
|
TcpClient.getInstance().sendTcp(callTcp, false, null)
|
|
TcpClient.getInstance().sendTcp(callTcp, false, null)
|
|
- RingPlayHelper.playRingTone(activity, R.raw.outgoing_call, false)
|
|
|
|
|
|
+ RingPlayHelper.playRingTone(activity, R.raw.ring_back2, true, 30000)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (!findH1) {
|
|
|
|
+ showMessage("Not registered")
|
|
|
|
+ }
|
|
} else if (handleId == 2 && beds >= 2) {
|
|
} else if (handleId == 2 && beds >= 2) {
|
|
//分机手柄2呼叫
|
|
//分机手柄2呼叫
|
|
|
|
+ var findH2 = false
|
|
for (bedVO in Utils.getInBedVOS()) {
|
|
for (bedVO in Utils.getInBedVOS()) {
|
|
if (Constant.DEVICE_H2_REGISTER_ID == bedVO.bedDeviceMac) {
|
|
if (Constant.DEVICE_H2_REGISTER_ID == bedVO.bedDeviceMac) {
|
|
|
|
+ findH2 = true
|
|
val callTcp = VoiceUtil.voiceHCall(bedVO.bedDeviceId, RoleTypeEnum.NURSE.name)
|
|
val callTcp = VoiceUtil.voiceHCall(bedVO.bedDeviceId, RoleTypeEnum.NURSE.name)
|
|
TcpClient.getInstance().sendTcp(callTcp, false, null)
|
|
TcpClient.getInstance().sendTcp(callTcp, false, null)
|
|
- RingPlayHelper.playRingTone(activity, R.raw.outgoing_call, false)
|
|
|
|
|
|
+ RingPlayHelper.playRingTone(activity, R.raw.ring_back2, true, 30000)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (!findH2) {
|
|
|
|
+ showMessage("Not registered")
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
showMessage(R.string.call_fail)
|
|
showMessage(R.string.call_fail)
|
|
SoundPoolManager.getInstance().playSound(7, 1.0f, 1.0f, 0)
|
|
SoundPoolManager.getInstance().playSound(7, 1.0f, 1.0f, 0)
|
|
@@ -1606,12 +1645,17 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
//手柄分机呼叫成功
|
|
//手柄分机呼叫成功
|
|
//RingPlayHelper.playRingTone(activity, R.raw.outgoing_call, false)
|
|
//RingPlayHelper.playRingTone(activity, R.raw.outgoing_call, false)
|
|
|
|
|
|
- SerialPortHelper.setDoorLight(1, "200")
|
|
|
|
|
|
+ //手柄呼叫时门灯红色固定
|
|
|
|
+ if (!Constant.sosOn) {
|
|
|
|
+ SerialPortHelper.setDoorLight(1, "100")
|
|
|
|
+ }
|
|
|
|
+
|
|
//显示分机呼叫信息
|
|
//显示分机呼叫信息
|
|
//val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
//val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
//updateBedCall(interactionVO, true)
|
|
//updateBedCall(interactionVO, true)
|
|
} else if (tcpModel.action == TcpAction.SideAction.SOS_CALL) {
|
|
} else if (tcpModel.action == TcpAction.SideAction.SOS_CALL) {
|
|
- SerialPortHelper.setDoorLight(1, "200")
|
|
|
|
|
|
+ //SerialPortHelper.setDoorLight(1, "200")
|
|
|
|
+ SerialPortHelper.flashDoorLight("100", 1000) //红色间隔1s闪烁
|
|
Constant.sosOn = true
|
|
Constant.sosOn = true
|
|
} else if (tcpModel.action == TcpAction.SideAction.ACCEPT || tcpModel.action == TcpAction.SideAction.CANCEL) {
|
|
} else if (tcpModel.action == TcpAction.SideAction.ACCEPT || tcpModel.action == TcpAction.SideAction.CANCEL) {
|
|
if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
@@ -1838,9 +1882,9 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_daylight)
|
|
view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_daylight)
|
|
|
|
|
|
//灭掉紧急按钮灯
|
|
//灭掉紧急按钮灯
|
|
- AppTool.Time.delay(2000) {
|
|
|
|
|
|
+ /*AppTool.Time.delay(2000) {
|
|
SerialPortHelper.setSosLight("0")
|
|
SerialPortHelper.setSosLight("0")
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
Constant.day_state = 0
|
|
Constant.day_state = 0
|
|
} else {
|
|
} else {
|
|
@@ -1855,9 +1899,9 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_night)
|
|
view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_night)
|
|
|
|
|
|
//打开紧急按钮灯
|
|
//打开紧急按钮灯
|
|
- AppTool.Time.delay(2000) {
|
|
|
|
|
|
+ /*AppTool.Time.delay(2000) {
|
|
SerialPortHelper.setSosLight("1")
|
|
SerialPortHelper.setSosLight("1")
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
Constant.day_state = 1
|
|
Constant.day_state = 1
|
|
}
|
|
}
|
|
@@ -1891,7 +1935,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
val iterator = bedCalls.iterator()
|
|
val iterator = bedCalls.iterator()
|
|
while (iterator.hasNext()) {
|
|
while (iterator.hasNext()) {
|
|
val it = iterator.next()
|
|
val it = iterator.next()
|
|
- if (System.currentTimeMillis() - it.time >= 15 * 60 * 1000) {
|
|
|
|
|
|
+ if (System.currentTimeMillis() - it.time >= 30 * 60 * 1000) {
|
|
iterator.remove()
|
|
iterator.remove()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1913,9 +1957,9 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
updateSettings(false)
|
|
updateSettings(false)
|
|
updateTcpState()
|
|
updateTcpState()
|
|
|
|
|
|
- if (SettingConfig.getDoorLightAlwaysOn(activity) == 0) {
|
|
|
|
|
|
+ /*if (SettingConfig.getDoorLightAlwaysOn(activity) == 0) {
|
|
checkHandleCall()
|
|
checkHandleCall()
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
if (Constant.LATER_RESTART && Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
if (Constant.LATER_RESTART && Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
AppUpdateHelper.restartApp()
|
|
AppUpdateHelper.restartApp()
|