bts
whyclxw
2024-12-18 783eb3cb284bce0ae7dfe57479550fce0591dcb2
src/main/java/com/whyc/mcp/FBSData.java
@@ -27,8 +27,8 @@
    public boolean setData(byte[] databuf) {
        boolean flag = true;
        //System.out.println(databuf.length + "===" + BYTE_LEN);
        //System.out.println(ComFn.bytesToHexString(databuf, databuf.length));
        ////System.out.println(databuf.length + "===" + BYTE_LEN);
        ////System.out.println(ComFn.bytesToHexString(databuf, databuf.length));
        ByteBuffer bf = ByteBuffer.allocate(databuf.length + dataType.length);
        bf.order(ByteOrder.LITTLE_ENDIAN);
        bf.position(0);
@@ -39,14 +39,14 @@
            bf.put(ComBase.changeIntToByte(this.dataType[i]));
        }
        bf.put(databuf);
        //System.out.println(ComFn.bytesToHexString(bf.array(), bf.array().length));
        ////System.out.println(ComFn.bytesToHexString(bf.array(), bf.array().length));
        bf.flip();
        CRC16 = ComBase.changeShortToInt(bf.getShort(4));
        bf.putShort(4, ComBase.changeIntToShort(0));
        int crc1 = RES_Crc16.CalCRC16(bf, bf.limit());
        if(CRC16 != crc1) {
            System.err.println(CRC16 +"!="+ crc1);
            //System.err.println(CRC16 +"!="+ crc1);
            return false;
        }
        bf.position(6);