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)
}
}
+ 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 处于连接状态的,如果未登陆,要登陆后回复服 务端,
* @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来判断
+ }
}
/**