|
@@ -89,6 +89,9 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
var receiver :TimeReceiver? = null
|
|
|
|
|
|
lateinit var countDownTimer: CountDownTimer
|
|
|
+ //呼叫转接计时
|
|
|
+ lateinit var transferCountDownTimer: CountDownTimer
|
|
|
+ var transferVo: InteractionVO? = null
|
|
|
|
|
|
//呼叫对方设备id
|
|
|
var callTargetId: Int? = -1
|
|
@@ -148,6 +151,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
connectSocket()
|
|
|
|
|
|
initCountDownTimer()
|
|
|
+ initTransferCountDownTimer()
|
|
|
updateNetState()
|
|
|
updateTime()
|
|
|
|
|
@@ -253,6 +257,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
override fun destory() {
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
countDownTimer.cancel()
|
|
|
+ transferCountDownTimer.cancel()
|
|
|
unregisterReceiver(receiver)
|
|
|
SocketManager.getInstance().unConnect()
|
|
|
SpeechUtil.getInstance().release()
|
|
@@ -391,6 +396,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|
|
|
setSettingConfiguration()
|
|
|
initCountDownTimer()
|
|
|
+ initTransferCountDownTimer()
|
|
|
} catch (e: Exception) {
|
|
|
showMessage("获取设置配置信息异常"+e.message)
|
|
|
Log.i(TAG,"获取设置配置信息异常"+e.message)
|
|
@@ -584,14 +590,14 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
//呼出取消
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.cancelAudioCall(Integer.parseInt(Constants.ids), callTargetId)
|
|
|
+ VoiceUtil.cancelAudioCall(Constants.ids, callTargetId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
countDownTimer.cancel()
|
|
|
} else if (Constants.CALL_STATE == Constants.CALL_INCOMING) {
|
|
|
//来电拒接
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.rejectAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
} else if (Constants.CALL_STATE == Constants.CALL_CALLING) {
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
@@ -606,8 +612,9 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
//来电接听
|
|
|
Constants.CALL_STATE = Constants.CALL_CALLING
|
|
|
DeviceChannel.calling = true
|
|
|
- VoiceUtil.acceptAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
+ transferCountDownTimer.cancel()
|
|
|
} else if (Constants.CALL_STATE == Constants.CALL_VISITING) {
|
|
|
acceptVisit()
|
|
|
}
|
|
@@ -661,12 +668,36 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
//呼叫超时,退出呼叫界面
|
|
|
showMessage("无人接听...")
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.cancelAudioCall(Integer.parseInt(Constants.ids), callTargetId)
|
|
|
+ Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
+ VoiceUtil.cancelAudioCall(Constants.ids, callTargetId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ fun initTransferCountDownTimer() {
|
|
|
+ if (SettingConfiguration.getInstance().transferDuration <= 0) {
|
|
|
+ SettingConfiguration.getInstance().transferDuration = 30
|
|
|
+ }
|
|
|
+
|
|
|
+ transferCountDownTimer = object: CountDownTimer(SettingConfiguration.getInstance().transferDuration*1000L, 1000) {
|
|
|
+ override fun onTick(millisUntilFinished: Long) {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onFinish() {
|
|
|
+ //呼叫超时转接
|
|
|
+ showMessage("呼叫已转接...")
|
|
|
+ CallDialogHelper.dismissCallDialog()
|
|
|
+ DeviceChannel.calling = false
|
|
|
+ Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
+ if (transferVo != null) {
|
|
|
+ VoiceUtil.transferAudioCall(Constants.ids, Constants.fromId, transferVo)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private fun updateTime() {
|
|
|
//根据时间判断白昼进行相关的配置设置
|
|
|
var currentTime = TimeTransition.getDateTime("yyyy-MM-dd HH:mm:ss")
|
|
@@ -743,7 +774,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
fun acceptVisit() {
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
//发送tcp,同时发起视频通话
|
|
|
- VideoUtil.sendVideoInCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VideoUtil.sendVideoInCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
|
|
|
Constants.CALL_STATE = Constants.CALL_VISIT_CALLING
|
|
|
DeviceChannel.calling = true
|
|
@@ -763,7 +794,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
showMessage("通话服务还未建立连接,请稍后")
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.rejectAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -798,20 +829,28 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
},
|
|
|
{
|
|
|
//来电接听
|
|
|
- VoiceUtil.acceptAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
+ transferCountDownTimer.cancel()
|
|
|
},
|
|
|
{
|
|
|
//来电拒接
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.rejectAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
+ transferCountDownTimer.cancel()
|
|
|
})
|
|
|
+ //只有存在后备id的时候才做呼叫转接
|
|
|
+ if (Constants.back_id != -1) {
|
|
|
+ transferVo = interactionVO
|
|
|
+ transferCountDownTimer.start()
|
|
|
+ }
|
|
|
} else {
|
|
|
DeviceChannel.calling = false
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
showMessage("通话服务还未建立连接,请稍后")
|
|
|
- VoiceUtil.rejectAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
}
|
|
|
|
|
|
} else if (tcpModel.getAction() == TcpAction.VoiceAction.ACCEPT) {//对方接受语音
|
|
@@ -848,7 +887,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
showMessage("通话服务还未建立连接,请稍后")
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.rejectAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
}
|
|
|
|
|
|
} else if (tcpModel.getAction() == TcpAction.VoiceAction.REJECT) {//对方拒绝
|
|
@@ -861,6 +900,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
DeviceChannel.calling = false
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
countDownTimer.cancel()
|
|
|
+ transferCountDownTimer.cancel()
|
|
|
} else if (tcpModel.getAction() == TcpAction.VoiceAction.CALLING) {//对方通话中
|
|
|
showMessage("对方忙线中")
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
@@ -878,6 +918,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
DeviceChannel.calling = false
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
countDownTimer.cancel()
|
|
|
+ transferCountDownTimer.cancel()
|
|
|
} else if (tcpModel.getAction() == TcpAction.VoiceAction.SUCCESS) {//服务器返回的呼叫成功tcp
|
|
|
Constants.interactionId = interactionVO.id
|
|
|
callTargetId = interactionVO.toDeviceId
|
|
@@ -890,7 +931,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
//呼出取消
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
- VoiceUtil.cancelAudioCall(Integer.parseInt(Constants.ids), callTargetId)
|
|
|
+ VoiceUtil.cancelAudioCall(Constants.ids, callTargetId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
countDownTimer.cancel()
|
|
|
},
|
|
@@ -908,9 +949,9 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
if (tcpModel.action == TcpAction.SOSAction.CALL) {
|
|
|
//紧急呼叫优先级最高,如果当前有通话或正在呼叫的需要将其打断
|
|
|
if (Constants.CALL_STATE == Constants.CALL_INCOMING) {
|
|
|
- VoiceUtil.rejectAudioCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
} else if (Constants.CALL_STATE == Constants.CALL_OUTGOING) {
|
|
|
- VoiceUtil.cancelAudioCall(Integer.parseInt(Constants.ids), callTargetId)
|
|
|
+ VoiceUtil.cancelAudioCall(Constants.ids, callTargetId)
|
|
|
}
|
|
|
DeviceChannel.calling = true
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
@@ -920,7 +961,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
SOSDialog.build(this).configShow(sosCancel = {
|
|
|
Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
DeviceChannel.calling = false
|
|
|
- OtherUtil.cancelSosCall(Integer.parseInt(Constants.ids), interactionVO.fromDeviceId, interactionVO.id)
|
|
|
+ OtherUtil.cancelSosCall(Constants.ids, interactionVO.fromDeviceId, interactionVO.id)
|
|
|
EventBus.getDefault().post(MessageEvent(0, Constants.EVENT_REFRESH_CALL_LIST))
|
|
|
|
|
|
if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_OFF) {
|
|
@@ -960,7 +1001,8 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
}, {
|
|
|
//拒接探视
|
|
|
DeviceChannel.calling = false
|
|
|
- VideoUtil.rejectVideoCall(Integer.parseInt(Constants.ids), Constants.fromId, Constants.interactionId)
|
|
|
+ Constants.CALL_STATE = Constants.CALL_STANDBY
|
|
|
+ VideoUtil.rejectVideoCall(Constants.ids, Constants.fromId, Constants.interactionId)
|
|
|
CallDialogHelper.dismissCallDialog()
|
|
|
})
|
|
|
|