| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查头 |
| | | * @param bs 上行字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public void checkHead(byte[] bs) throws Exception{ |
| | | if(bs.length < ProtocolConstantV206V202404.lenHead2Code |
| | | || bs[0] != ProtocolConstantV206V202404.P_Head_Byte){ |
| | | throw new Exception("上行数据帧头不正确!") ; |
| | | }else{ |
| | | if(bs.length >= ProtocolConstantV206V202404.lenHead2Code){ |
| | | if(bs[2] != ProtocolConstantV206V202404.P_Head_Byte |
| | | && (byte)(bs[2] & 0xF8) != ProtocolConstantV206V202404.P_Head_Byte){ |
| | | throw new Exception("上行数据帧头不正确!") ; |
| | | } |
| | | }else{ |
| | | throw new Exception("上行数据帧头不正确!") ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查尾 |