瀏覽代碼

呼叫优化

weizhengliang 3 年之前
父節點
當前提交
a935a3508a
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/channel/DeviceChannel.java

+ 10 - 10
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/channel/DeviceChannel.java

@@ -41,18 +41,18 @@ public class DeviceChannel {
                     InteractionVO interactionVO = new Gson().fromJson(tcpModel.getData().toString(), InteractionVO.class);
                     //有新的呼叫进来,添加到语音播报队列
                     EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.Companion.getEVENT_NEW_CALL()));
-                    //todo: 判断当前是否通话
-                    // 通话中
-                    if (calling){
-                        responseTcpModel = VoiceUtil.voiceCalling(Constants.Companion.getIds(), tcpModel.getFromId(),interactionVO.getId());
-                        //todo 给服务器发送正在通话中 tcp
-                        return responseTcpModel;
-                    } else {
-                        //todo: 通话中界面展现,data中服务器传过来呼入名称;从接口重新获取左侧数据
+
+                    if (Constants.Companion.getCALL_STATE() == Constants.Companion.getCALL_STANDBY()) {
+                        //待机状态
                         calling = true;
+                        Constants.Companion.setCALL_STATE(Constants.Companion.getCALL_INCOMING());
                         EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.Companion.getEVENT_TCP_MSG()));
-                        //responseTcpModel = VoiceUtil.voiceSuccess(Integer.parseInt(Constants.Companion.getIds()), tcpModel.getFromId(),interactionVO.getId());
-                        //return responseTcpModel;
+                    } else if (Constants.Companion.getCALL_STATE() == Constants.Companion.getCALL_CALLING()
+                            || Constants.Companion.getCALL_STATE() == Constants.Companion.getCALL_OUTGOING()
+                            || Constants.Companion.getCALL_STATE() == Constants.Companion.getCALL_VISIT_CALLING()) {
+                        //通话状态或去电状态
+                        responseTcpModel = VoiceUtil.voiceCalling(Constants.Companion.getIds(), tcpModel.getFromId(),interactionVO.getId());
+                        return responseTcpModel;
                     }
                 } else if (tcpModel.getAction()== TcpAction.VoiceAction.ACCEPT){ //我方呼出,对方接受
                     //todo: 通话中界面更新;建立数据通话