From: TrillGates Date: Sat, 20 Feb 2021 07:37:28 +0000 (+0800) Subject: completed on calling income handler. X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=6210c5defb42a6d69db9bee351e29e2af194fe36;p=protocol_srv.git completed on calling income handler. --- diff --git a/app/src/main/aidl/com/enqualcomm/support/IFZDService.aidl b/app/src/main/aidl/com/enqualcomm/support/IFZDService.aidl index 1409d0f0..6524529d 100644 --- a/app/src/main/aidl/com/enqualcomm/support/IFZDService.aidl +++ b/app/src/main/aidl/com/enqualcomm/support/IFZDService.aidl @@ -13,4 +13,5 @@ interface IFZDService { void rejectCallInCome(); void requireCall(in int type,in String remoteUserId); void test(); + void setUpEnvState(in int state); } \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index ae557ac2..0f2176b1 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -1702,6 +1702,14 @@ public class CoreService extends Service { //获取佰锐ID Deliver.sendLocationMSG(MEMBERS); } + + @Override + public void setUpEnvState(int state) { + if (protocolAPIHelper.getProtocolfzd_handler() != null) { + ICLogger.d("update bairui env state..." + state); + protocolAPIHelper.getProtocolfzd_handler().updateEnvState(state); + } + } }; } diff --git a/app/src/main/java/com/ic/protocols/protocolAPIHelper.java b/app/src/main/java/com/ic/protocols/protocolAPIHelper.java index ab7c25fc..590018d8 100644 --- a/app/src/main/java/com/ic/protocols/protocolAPIHelper.java +++ b/app/src/main/java/com/ic/protocols/protocolAPIHelper.java @@ -18,6 +18,10 @@ public class protocolAPIHelper { private static protocol_fzd protocolfzd_handler = null; private static protocol_mqtt protocolmqtt_handler = null; + public static protocol_fzd getProtocolfzd_handler() { + return protocolfzd_handler; + } + public protocolAPIHelper(Connection connect, Runtime runtime) { ICLogger.i("init Protocol " + Config.getProtocolNumber()); if (protocolbeehome_handler == null) diff --git a/app/src/main/java/com/ic/protocols/protocol_fzd.java b/app/src/main/java/com/ic/protocols/protocol_fzd.java index d8018df2..2779a9b7 100644 --- a/app/src/main/java/com/ic/protocols/protocol_fzd.java +++ b/app/src/main/java/com/ic/protocols/protocol_fzd.java @@ -916,6 +916,21 @@ public class protocol_fzd { } } + private static final String STATE_ENV = "env_state"; + + private boolean needResponseCalling = false; + + + public void updateEnvState(int state) { + if (needResponseCalling) { + //通知后台现在的装填 + ICLogger.d("send cmd calling and state is == > " + state); + mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.CALLING), String.valueOf(state))); + needResponseCalling = false; + } + sharedPreferences.edit().putInt(STATE_ENV, state).apply(); + } + /** * 有通话请求 * 注:终端一旦收到该请求,则需要确保音视频 sdk 处于连接状态的,如果未登陆,要登陆后回复服 务端, @@ -929,9 +944,33 @@ public class protocol_fzd { * @param data */ private void handleCallRequest(Connection mConnection, Runtime mRuntime, String data) { - //TODO: - //需要回复平台结果 - + String[] split = data.split(","); + if (split.length == 3) { + needResponseCalling = true; + //1、准备数据:对方的id,来电类型 + String remoteId = split[0]; + String type = split[2]; + ICLogger.d("remote id is == > " + remoteId); + ICLogger.d("type is == > " + type); + //2、拉起来电界面 + Intent intent = new Intent(); + intent.setAction("com.ic.action.VIDEO_CALL"); + intent.addCategory(Intent.CATEGORY_DEFAULT); + intent.putExtra("remoteId", remoteId); + intent.putExtra("type", type); + //3、来电界面去查询这个用户是谁 + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mRuntime.getContextProxy().context.startActivity(intent); + //4、环境是否有准备好 + int envState = sharedPreferences.getInt(STATE_ENV, -1); + //5、需要回复平台结果 + if (envState == 0) { + mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.CALLING), "0")); + needResponseCalling = false; + } + //否则由设置的地方去通知后台 + //needResponseCalling来判断 + } } /**