| | |
| | | String des = ((JKMessage8100) jk2019MessageBase).des; |
| | | SPUtils.put(app.getAppContext(),SPUtils.DES_HEX_PWD,des); |
| | | JKMessage0101 jkMessage0101 = new JKMessage0101(); |
| | | // jkMessage0101.des =((JKMessage8100) jk2019MessageBase).des; |
| | | long time =System.currentTimeMillis()/1000; |
| | | int unsignedInt = Utils.parseUnsignedInt(String.valueOf(time),10); |
| | | MyLog.i(String.format("总秒数(long)=%d,装换成unsigned int= %d",time,unsignedInt)); |
| | |
| | | |
| | | |
| | | if ( ExamPlatformData.getInstance().getExamplatformStatus() == ExamPlatformData.DEV_LOGIN){ |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | }else{ |
| | | Log.e(TAG, "run: 发送消息失败,未初始化连接NettyTcp"); |
| | | byte[] msgidbytes= ArrayUtils.subArray(msg.toBytes(),2,2); |
| | | String msgid = BytesUtils.bytesToHexString(msgidbytes); |
| | | if (canSend(msgid)){ |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | }else{ |
| | | Log.e(TAG, "run: 发送消息失败,未初始化连接NettyTcp"); |
| | | } |
| | | } |
| | | |
| | | }else{ |
| | | // JK2019MessageBase jk2019MessageBase = MessageManager.get(msg.toString()); |
| | | byte[] msgidbytes= ArrayUtils.subArray(msg.toBytes(),2,2); |
| | | String msgid = BytesUtils.bytesToHexString(msgidbytes); |
| | | Log.i(TAG, "run: msgid="+msgid); |
| | | if ((msgid.equalsIgnoreCase("0100")) || (msgid.equalsIgnoreCase("0101"))){ |
| | | MyLog.i(PlatFormConstant.TAG,"注册/鉴权消息直接发送,不发送是否登录成功"); |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | if (canSend(msgid)){ |
| | | if ((msgid.equalsIgnoreCase("0100")) || (msgid.equalsIgnoreCase("0101"))){ |
| | | MyLog.i(PlatFormConstant.TAG,"注册/鉴权消息直接发送"); |
| | | if (IMSClientBootstrap.getInstance().isActive()){ |
| | | IMSClientBootstrap.getInstance().sendMessage(messageEscaper.escape(msg.toBytes())); |
| | | }else{ |
| | | MyLog.i(PlatFormConstant.TAG, "发送消息失败,未初始化连接NettyTcp"); |
| | | } |
| | | }else{ |
| | | MyLog.i(PlatFormConstant.TAG, "发送消息失败,未初始化连接NettyTcp"); |
| | | MyLog.i(PlatFormConstant.TAG,"登录未成功,不能发送消息="+msgid); |
| | | } |
| | | }else{ |
| | | MyLog.i(PlatFormConstant.TAG,"登录未成功,不能发送消息="+msgid); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | IMSClientBootstrap.getInstance().addHeartbeat(seconds); |
| | | } |
| | | } |
| | | |
| | | private boolean canSend(String msgId){ |
| | | if (ExamPlatformData.getInstance().getTrainingMode()==ExamPlatformData.TRAINING_MODE){ |
| | | //训练模式下 只有几条可以发送 |
| | | switch (msgId){ |
| | | case "0206": |
| | | case "0100": |
| | | case "0101": |
| | | return true; |
| | | } |
| | | |
| | | }else{ |
| | | //考试模式下全部都可以发送 |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |