|
@@ -31,60 +31,63 @@ public class DeviceChannel {
|
|
|
case CALLBACK:
|
|
|
if(tcpModel.getAction()== TcpAction.CallbackAction.SUCCESS){
|
|
|
//todo: 刷新呼叫记录列表
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
}else if(tcpModel.getAction()== TcpAction.CallbackAction.FAILED){
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
}
|
|
|
break;
|
|
|
case VOICE:
|
|
|
if (tcpModel.getAction()== TcpAction.VoiceAction.CALL){ //语音呼入
|
|
|
InteractionVO interactionVO = new Gson().fromJson(tcpModel.getData().toString(), InteractionVO.class);
|
|
|
//有新的呼叫进来,添加到语音播报队列
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.Companion.getEVENT_NEW_CALL()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_NEW_CALL));
|
|
|
|
|
|
- if (Constants.Companion.getCALL_STATE() == Constants.Companion.getCALL_STANDBY()) {
|
|
|
+ if (Constants.Companion.getCALL_STATE() == Constants.CALL_STANDBY) {
|
|
|
//待机状态
|
|
|
calling = true;
|
|
|
- Constants.Companion.setCALL_STATE(Constants.Companion.getCALL_INCOMING());
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
- } 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()) {
|
|
|
+ Constants.Companion.setCALL_STATE(Constants.CALL_INCOMING);
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
+ } else if (Constants.Companion.getCALL_STATE() == Constants.CALL_CALLING
|
|
|
+ || Constants.Companion.getCALL_STATE() == Constants.CALL_OUTGOING
|
|
|
+ || Constants.Companion.getCALL_STATE() == Constants.CALL_VISIT_CALLING) {
|
|
|
//通话状态或去电状态
|
|
|
responseTcpModel = VoiceUtil.voiceCalling(Constants.Companion.getIds(), tcpModel.getFromId(),interactionVO.getId());
|
|
|
return responseTcpModel;
|
|
|
}
|
|
|
+
|
|
|
+ /*calling = true;
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));*/
|
|
|
} else if (tcpModel.getAction()== TcpAction.VoiceAction.ACCEPT){ //我方呼出,对方接受
|
|
|
//todo: 通话中界面更新;建立数据通话
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
calling = true;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VoiceAction.REJECT){ //我方呼出,对方拒绝
|
|
|
//todo: 清掉呼出的TcpModel,通话中界面更新 --- 显示对方拒绝并停留3秒,结束至正常界面;更新左侧
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VoiceAction.CALLING){ //我方呼出,对方通话中
|
|
|
//todo: 清掉呼出的TcpModel,通话中界面更新 --- 显示对方占线并停留3秒,结束至正常界面;更新左侧
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VoiceAction.FAILED){ //我方呼出,对方不在线,设备离线或其它错误
|
|
|
//todo: 清掉呼出的TcpModel,通话中界面更新 --- 显示对方离线并停留3秒,结束至正常界面;更新左侧
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VoiceAction.HANDOFF){ //对方挂断,不论我方呼出或呼入
|
|
|
//todo: 清掉呼出的TcpModel,通话中界面更新 --- 显示对方已挂断并停留3秒,结束至正常界面;更新左侧
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
}else if(tcpModel.getAction()== TcpAction.VoiceAction.CANCEL){
|
|
|
//todo: 清掉呼出的TcpModel,通话中界面更新 --- 显示对方已挂断并停留3秒,结束至正常界面;更新左侧
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
}else if(tcpModel.getAction()== TcpAction.VoiceAction.SUCCESS){
|
|
|
//todo 这个是自己点击了分机的呼叫 服务器返回给我数据 以供我 挂断时传输呼叫记录的id 因为分机
|
|
|
//在点击呼叫之前 是没有呼叫记录的
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
calling = true;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VoiceAction.VOICE_OFF) {
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
}
|
|
|
break;
|
|
|
case VIDEO:
|
|
@@ -95,50 +98,50 @@ public class DeviceChannel {
|
|
|
return responseTcpModel;
|
|
|
} else {
|
|
|
calling = true;
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
}
|
|
|
} else if (tcpModel.getAction()== TcpAction.VideoAction.ACCEPT){ //我方呼出,对方接受
|
|
|
calling = true;
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
} else if (tcpModel.getAction()== TcpAction.VideoAction.REJECT){ //我方呼出,对方拒绝
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VideoAction.CALLING){ //我方呼出,对方通话中
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VideoAction.FAILED){ //我方呼出,对方不在线,设备离线或其它错误
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
} else if (tcpModel.getAction()== TcpAction.VideoAction.HANDOFF){ //对方挂断,不论我方呼出或呼入
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
}else if(tcpModel.getAction()== TcpAction.VideoAction.CANCEL){
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
//calling = false;
|
|
|
}else if(tcpModel.getAction()== TcpAction.VideoAction.SUCCESS){
|
|
|
calling = true;
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
}
|
|
|
break;
|
|
|
case IM:
|
|
|
if (tcpModel.getAction()== TcpAction.IMAction.MSG){
|
|
|
//todo: 从接口重新获取左侧数据;使用通话中界面,显示有语音留言,停留3秒,结束至正常界面
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
} else if (tcpModel.getAction()== TcpAction.IMAction.MSG_READ){ //语音已读取
|
|
|
//todo: 从data得到语音id;更新左侧,注意这里不使用通话中界面提示已读
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
}
|
|
|
break;
|
|
|
case EVENT:
|
|
|
if (tcpModel.getAction()== TcpAction.EventAction.KEY_CLICK){ //有新事件过来
|
|
|
//todo: 服务端通过data给出具体的事件名称放置data。从接口重新获取左侧数据;使用通话中界面,显示事件名称,停留3秒,结束至正常界面
|
|
|
Log.e(TAG,"收到事件tcp");
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
|
|
|
} else if (tcpModel.getAction()== TcpAction.EventAction.RESPONSE){ //事件已处理,仅分机用
|
|
|
//todo: 从data得到事件id,使用通话中界面,显示事件名称及已响应字样,停留3秒,结束至正常界面;更新左侧
|
|
|
Log.e(TAG,"");
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
Log.e(TAG,"收到事件已处理tcp");
|
|
|
}
|
|
|
break;
|
|
@@ -148,7 +151,7 @@ public class DeviceChannel {
|
|
|
case REINFORCE:
|
|
|
case ENTRACEGUARD:
|
|
|
//紧急呼叫优先级最高,如果当前正在通话需要将其打断
|
|
|
- EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.Companion.getEVENT_TCP_MSG()));
|
|
|
+ EventBus.getDefault().post(new MessageEvent(tcpModel, Constants.EVENT_TCP_MSG));
|
|
|
/*if (Constants.Companion.getCALL_STATE() == Constants.Companion.getCALL_CALLING()) {
|
|
|
EventBus.getDefault().post(new MessageEvent(tcpModel,Constants.Companion.getEVENT_SOS_CALL()));
|
|
|
} else {
|