| | |
| | | |
| | | private MessageProcessor(){ |
| | | messageEscaper = new MessageEscaper(); |
| | | messageManager = new MessageManager(); |
| | | } |
| | | |
| | | private static class MessageProcessorInstance{ |
| | | private static final IMessageProcessor INSTANCE = new MessageProcessor(); |
| | | } |
| | | MessageEscaper messageEscaper; |
| | | MessageManager messageManager; |
| | | public static IMessageProcessor getInstance(){ |
| | | return MessageProcessorInstance.INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public void receiveMsg(byte[] message) { |
| | | // byte[] datas = Utils.parseMsg(message); |
| | | // Log.i(TAG, "receiveMsg: "+ ByteUtil.byte2HexStr(datas)); |
| | | // byte checkcolde=Utils.calCheckCode(ByteUtil.subArray(datas,0,datas.length-1)); |
| | | // if (checkcolde == datas[datas.length-1]){ |
| | | // Log.i(TAG, "receiveMsg: 消息正确"); |
| | | // parseMessage(datas); |
| | | // } |
| | | |
| | | |
| | | |
| | | //反转义 |