package com.dy.pipirrComCreator.p206V1; import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; import com.dy.common.util.ByteUtil; /** * @Author: liurunyu * @Date: 2025/5/7 10:38 * @Description */ public class Cd93 extends Cd { public static final String ComCode = "93" ; /** * 检查参数 * @param params 参数 * @return 字符串 */ public String checkParams(String ...params){ return null ; } /** * 构造心跳数据 * @return 字节数组 * @throws Exception 异常 */ public String hex(String rtuAddr) throws Exception { byte[] bytes = bs(rtuAddr) ; String hex = ByteUtil.bytes2Hex(bytes, false) ; return hex ; } /** * 构造心跳数据 * @return 字节数组 * @throws Exception 异常 */ public byte[] bs(String rtuAddr) throws Exception { byte[] bytes = createHead(rtuAddr, ComCode, Cd.CTRL); byte n = 0 ; byte[] bs = new byte[9] ; bs[n++] = (byte)0xF0 ; GlCreate.createPw(bs, n); n += 2 ; GlCreate.createTp(bs, n); bytes = ByteUtil.bytesMerge(bytes, bs) ; GlCreate.createLen(bytes);//长度放字节数组中 byte[] bsTail = GlCreate.createCrcTail4P206(bytes) ;//CRC和尾叠加字节数组中 bytes = ByteUtil.bytesMerge(bytes, bsTail) ; return bytes ; } }