liurunyu
2024-12-02 cdce015a7143b5e9d0fb003b80b9aa307906c14b
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/parse/global/GlCreate.java
@@ -52,6 +52,18 @@
        bsNoTail[ProtocolConstantV206V1.dataLenIndex] = (byte)len ;
    }
    public static void createLen4PUg(byte[] bytes) throws Exception {
        int len = bytes.length - 4;
        byte[] bs = ByteUtil.int2BCD_LE(len) ;
        if(bs != null && bs.length == 1){
            bytes[1] = 0 ;
            bytes[2] = bs[0] ;
        }else if(bs != null && bs.length > 1){
            bytes[1] = bs[1] ;
            bytes[2] = bs[0] ;
        }
    }
    /**
     * 生成IC卡编码
@@ -81,9 +93,9 @@
    }
    public static byte[] createCrcTail4Ug(byte[] bsNoTail) throws Exception {
        int crc = new CRC16().CRC(bsNoTail, 0, bsNoTail.length -1) ;
        short crc = new CRC16().CRC(bsNoTail, 0, bsNoTail.length -1) ;
        byte[] bytes = new byte[ProtocolConstantV206V1.UG_lenTail] ;
        ByteUtilUnsigned.short2Bytes_BE(bytes, crc, 0);
        ByteUtil.short2Bytes_BE(bytes, crc, 0);
        bytes[2] = ProtocolConstantV206V1.P_Tail_Byte ;
        return bytes ;
    }