Browse Source

#FIXED
-修复手柄接听时点阵屏信息未更新问题

weizhengliang 3 years ago
parent
commit
ba44c2d859

+ 22 - 3
nursehome/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt

@@ -99,6 +99,8 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
     //呼叫对方设备id
     var callTargetId: Int? = -1
 
+    private var callInteractionVO: InteractionVO? = null
+
     //当前选中的button id
     var select_id: Int = 0
 
@@ -679,6 +681,10 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
                     DeviceChannel.calling = false
                     VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
                     CallDialogHelper.dismissCallDialog()
+
+                    if (callInteractionVO != null) {
+                        LedHelper.updateLedInfo(callInteractionVO!!, false, false)
+                    }
                 } else if (Constants.CALL_STATE == Constants.CALL_CALLING) {
                     Constants.CALL_STATE = Constants.CALL_STANDBY
                     DeviceChannel.calling = false
@@ -690,11 +696,23 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
                 VoiceManagerUtil.switchAudioMode(activity, false)
                 if (Constants.CALL_STATE == Constants.CALL_INCOMING) {
                     //来电接听
-                    Constants.CALL_STATE = Constants.CALL_CALLING
-                    DeviceChannel.calling = true
-                    VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
+                    //通话之前先判断webrtc socket是否连接上,否则不能建立通话
+                    if (SocketManager.getInstance().socketOpen()) {
+                        Constants.CALL_STATE = Constants.CALL_CALLING
+                        DeviceChannel.calling = true
+                        VoiceUtil.acceptAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
+                    } else {
+                        DeviceChannel.calling = false
+                        Constants.CALL_STATE = Constants.CALL_STANDBY
+                        showMessage("通话服务还未建立连接,暂时无法通话")
+                        VoiceUtil.rejectAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
+                    }
                     CallDialogHelper.dismissCallDialog()
                     transferCountDownTimer.cancel()
+
+                    if (callInteractionVO != null) {
+                        LedHelper.updateLedInfo(callInteractionVO!!, false, false)
+                    }
                 } else if (Constants.CALL_STATE == Constants.CALL_VISITING) {
                     acceptVisit()
                 }
@@ -910,6 +928,7 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
                     if (tcpModel.getAction() == TcpAction.VoiceAction.CALL) {//收到新的呼叫
                         Constants.fromId = tcpModel.fromId
                         Constants.interactionId = interactionVO.id
+                        callInteractionVO = interactionVO
 
                         Constants.CALL_STATE = Constants.CALL_INCOMING
                         DeviceChannel.calling = true