From fed0a447df51e633ab6453261dc6e3d8a906d4a2 Mon Sep 17 00:00:00 2001 From: DELL <1525436766@qq.com> Date: 星期一, 23 十二月 2024 14:08:25 +0800 Subject: [PATCH] 添加注释 --- src/main/java/com/whyc/mcp/FBSData.java | 74 +++++++++++++++++++++++++++++++----- 1 files changed, 63 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/whyc/mcp/FBSData.java b/src/main/java/com/whyc/mcp/FBSData.java index 1894f92..5446294 100644 --- a/src/main/java/com/whyc/mcp/FBSData.java +++ b/src/main/java/com/whyc/mcp/FBSData.java @@ -2,13 +2,9 @@ import com.whyc.res.RES_Crc16; import com.whyc.util.ComBase; -import lombok.Data; -import lombok.ToString; import java.nio.ByteBuffer; import java.nio.ByteOrder; -@ToString -@Data public class FBSData { public static final int BYTE_LEN = 5 + TestTime.BYTE_LEN+VolCurrData.BYTE_LEN + MVolData.BYTE_LEN; @@ -19,7 +15,7 @@ public int battGroup; //缁勬暟 public int battSum; //鍗曚綋涓暟 public VolCurrData vcData; - public MVolData mVol; + public MVolData mvol; public FBSData(int dataType) { testTime = new TestTime(); @@ -31,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); @@ -43,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); @@ -59,13 +55,69 @@ battGroup = ComBase.changeByteToInt(bf.get()); //缁勬暟 battSum = ComBase.changeShortToInt(bf.getShort()); //鍗曚綋涓暟 - mVol = new MVolData(battGroup*battSum); + mvol = new MVolData(battGroup*battSum); bf.compact(); flag &= vcData.puByteBuffer(bf); - flag &= mVol.puByteBuffer(bf); + flag &= mvol.puByteBuffer(bf); return flag; } + + public int[] getDataType() { + return dataType; + } + + public void setDataType(int[] dataType) { + this.dataType = dataType; + } + + public int getCRC16() { + return CRC16; + } + + public void setCRC16(int CRC16) { + this.CRC16 = CRC16; + } + + public TestTime getTestTime() { + return testTime; + } + + public void setTestTime(TestTime testTime) { + this.testTime = testTime; + } + + public int getBattGroup() { + return battGroup; + } + + public void setBattGroup(int battGroup) { + this.battGroup = battGroup; + } + + public int getBattSum() { + return battSum; + } + + public void setBattSum(int battSum) { + this.battSum = battSum; + } + + public VolCurrData getVcData() { + return vcData; + } + + public void setVcData(VolCurrData vcData) { + this.vcData = vcData; + } + + public MVolData getMvol() { + return mvol; + } + + public void setMvol(MVolData mvol) { + this.mvol = mvol; + } } -- Gitblit v1.9.1