| | |
| | | import io.netty.buffer.ByteBufAllocator; |
| | | import io.netty.buffer.ByteBufUtil; |
| | | import lombok.Data; |
| | | import org.springframework.cache.annotation.SpringCacheAnnotationParser; |
| | | |
| | | /** |
| | | * 心跳 pac |
| | |
| | | @Data |
| | | public class Fire_3030 implements IMessageBody { |
| | | |
| | | /** |
| | | * 机器号 |
| | | */ |
| | | private Integer no; |
| | | |
| | | /** |
| | | * 回路 |
| | | */ |
| | | private Integer loop; |
| | | |
| | | /** |
| | | * 部位号 |
| | | */ |
| | | private Integer partNo; |
| | | |
| | | private Integer year; |
| | | |
| | |
| | | // byteBuf.release(); |
| | | // System.out.println(byteBuf.refCnt()); |
| | | this.no = analyze(new byte[]{bytes[3], bytes[4]}); |
| | | this.loop = analyze(new byte[]{bytes[5], bytes[6]}); |
| | | this.partNo = analyze(new byte[]{bytes[7], bytes[8]}); |
| | | this.year = analyze(new byte[]{bytes[11], bytes[12]}); |
| | | this.month = analyze(new byte[]{bytes[13], bytes[14]}); |
| | | this.day = analyze(new byte[]{bytes[15], bytes[16]}); |
| | |
| | | } |
| | | channel.writeAndFlush(chPackage); |
| | | } |
| | | |
| | | /******************************************************************************************/ |
| | | /**************************************** 测试专用 *****************************************/ |
| | | /*****************************************************************************************/ |
| | | public static void main(String[] args){ |
| | | byte[] bytes = new byte[]{(byte)0x82, 0x38, 0x30, 0x32, 0x34, 0x30, 0x38, 0x38, 0x3B, 0x30, 0x31, 0x31, 0x31, |
| | | 0x30, 0x33, 0x30, 0x38, 0x31, 0x30, 0x30, 0x34, 0x30, 0x38, 0x38, 0x30, (byte)0x83}; |
| | | Fire_3030 fire3030 = new Fire_3030().readFromBytes(bytes); |
| | | String now = "20" + fire3030.getYear() + "-" + fire3030.getMonth() + "-" + fire3030.getDay() |
| | | + " " + fire3030.getHour() + ":" + fire3030.getMinute() + ":" + fire3030.getSeconds(); |
| | | //消防IO点编号 |
| | | String fireNo = fire3030.getNo().toString() + fire3030.getLoop().toString() + fire3030.getPartNo().toString(); |
| | | System.out.println(fireNo); |
| | | String aa=""; |
| | | } |
| | | } |