充放电一体机FGCD通信程序【二期初版】
BattMonitor_FGCD-A059NT/src/com/dev/fgcd/data/FGCD_Cmd.java
@@ -2,6 +2,7 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
public class FGCD_Cmd {
@@ -20,6 +21,13 @@
    public int Db4;                                    //预留4
    private int CRC;
    public FGCD_Cmd() {
      // TODO Auto-generated constructor stub
   }
    public FGCD_Cmd(int CMD) {
       this.CMD = CMD;
    }
    public void makeCmd(int cmd, int byteLen)
    {
@@ -60,6 +68,24 @@
        tmpbuf.flip();
        return true;
    }
    /**
     *    读取当前下载成功数据块号
     * @return
     */
    public int getNowDownLoadIndex() {
       return this.Db3*256 + Db4;
    }
    /**
     *    读取当前总的数据块数目
     * @return
     */
    public int getTotalDownLoadBlock() {
       int total = this.Db1*256 + this.Db2;
       System.err.println(total);
       return total;
    }
    public int createCrc16(ByteBuffer bf) {
@@ -115,4 +141,107 @@
      int check_dev_id = 8059*100000 + (this.Db1<<8) +(this.Db2);
      return check_dev_id;
   }
   public int getBYTE_LEN() {
      return BYTE_LEN;
   }
   public int[] getSYNCode() {
      return SYNCode;
   }
   public int getByteLen() {
      return ByteLen;
   }
   public int getCMD() {
      return CMD;
   }
   public int getRecState() {
      return RecState;
   }
   public int getType() {
      return Type;
   }
   public int getWorkState() {
      return WorkState;
   }
   public int getAlarm() {
      return Alarm;
   }
   public int getDb1() {
      return Db1;
   }
   public int getDb2() {
      return Db2;
   }
   public int getDb3() {
      return Db3;
   }
   public int getDb4() {
      return Db4;
   }
   public int getCRC() {
      return CRC;
   }
   public void setSYNCode(int[] sYNCode) {
      SYNCode = sYNCode;
   }
   public void setCMD(int cMD) {
      CMD = cMD;
   }
   public void setRecState(int recState) {
      RecState = recState;
   }
   public void setType(int type) {
      Type = type;
   }
   public void setWorkState(int workState) {
      WorkState = workState;
   }
   public void setAlarm(int alarm) {
      Alarm = alarm;
   }
   public void setDb1(int db1) {
      Db1 = db1;
   }
   public void setDb2(int db2) {
      Db2 = db2;
   }
   public void setDb3(int db3) {
      Db3 = db3;
   }
   public void setDb4(int db4) {
      Db4 = db4;
   }
   public void setCRC(int cRC) {
      CRC = cRC;
   }
   @Override
   public String toString() {
      return "FGCD_Cmd [BYTE_LEN=" + BYTE_LEN + ", SYNCode=" + Arrays.toString(SYNCode) + ", ByteLen=" + ByteLen
            + ", CMD=" + CMD + ", RecState=" + RecState + ", Type=" + Type + ", WorkState=" + WorkState + ", Alarm="
            + Alarm + ", Db1=" + Db1 + ", Db2=" + Db2 + ", Db3=" + Db3 + ", Db4=" + Db4 + ", CRC=" + CRC + "]";
   }
}