| | |
| | | |
| | | import com.anyun.im_lib.util.ByteUtil; |
| | | |
| | | import safeluck.drive.evaluation.platformMessage.RegisterResp; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | |
| | |
| | | byte checkcolde=Utils.calCheckCode(ByteUtil.subArray(datas,0,datas.length-1)); |
| | | if (checkcolde == datas[datas.length-1]){ |
| | | Log.i(TAG, "receiveMsg: 消息正确"); |
| | | parseMessage(datas); |
| | | } |
| | | } |
| | | |
| | | private void parseMessage(byte[] datas) { |
| | | byte[] msgidBytes = ByteUtil.subArray(datas,1,2); |
| | | short msgid = ByteUtil.getShort(msgidBytes); |
| | | |
| | | switch (msgid){ |
| | | case (short) 0x8100: |
| | | RegisterResp registerResp = new RegisterResp(datas); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void sendMessage(final String msg) { |
| | | public void sendMessage(final byte[] msg) { |
| | | CThreadPoolExecutor.runInBackground(new Runnable() { |
| | | @Override |
| | | public void run() { |