package com.zy.acs.common.domain.protocol; import com.zy.acs.framework.common.RadixTools; import com.zy.acs.common.utils.Utils; import lombok.Data; import java.io.Serializable; /** * 心跳包 * Created by vincent on 2023/3/16 */ @Data public class AGV_03_UP implements IMessageBody, Serializable { private static final long serialVersionUID = -8758441350794873082L; @Override public byte[] writeToBytes() { return new byte[0]; } @Override public void readFromBytes(byte[] bytes) { //电压 this.voltage = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 0, 2)); //剩余电量 this.soc = Utils.slice(bytes, 2, 1)[0]; //寿命 this.soh = Utils.slice(bytes, 3, 1)[0]; //电池故障标志 this.batterFailSign = Utils.slice(bytes, 4, 1)[0]; //电池温度 this.batteryTempe = Utils.slice(bytes, 5, 1)[0]; //环境温度 this.envirTempe = Utils.slice(bytes, 6, 1)[0]; //左轮电机温度 this.leftMotorTempe = Utils.slice(bytes, 7, 1)[0]; //右轮电机温度 this.rightMotorTempe = Utils.slice(bytes, 8, 1)[0]; //升降电机温度 this.raiseMotorTempe = Utils.slice(bytes, 9, 1)[0]; //伸缩电机温度 this.telescopicMotorTempe = Utils.slice(bytes, 10, 1)[0]; //旋转电机温度 this.rotatingMotorTempe = Utils.slice(bytes, 11, 1)[0]; //开机时间 this.bootTime = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 12, 4)); //左电机故障标志 this.leftMotorFailSign = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 16, 2)); //右电机故障标志 this.leftMotorFailSign = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 18, 2)); //升降电机故障标志 this.raiseMotorFailSign = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 20, 2)); //伸缩电机故障标志 this.telescopicMotorFailSign = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 22, 2)); //旋转电机故障标志 this.rotatingMotorFailSign = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 24, 2)); //故障标志位 this.failSign = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 26, 4)); //预留字段 this.reservedField = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 30, 4)); } private int voltage; // 电压 private int soc; // 剩余电量 private int soh; // 寿命 private int batterFailSign; // 电池故障标志 //电池温度 private int batteryTempe; // 环境温度 private int envirTempe; //左轮电机温度 private int leftMotorTempe; //右轮电机温度 private int rightMotorTempe; //升降电机温度 private int raiseMotorTempe; //伸缩电机温度 private int telescopicMotorTempe; //旋转电机温度 private int rotatingMotorTempe; //开机时间 private int bootTime; //左电机故障标志 private int leftMotorFailSign; //右电机故障标志 private int rightMotorFailSign; //升降电机故障标志 private int raiseMotorFailSign; //伸缩电机故障标志 private int telescopicMotorFailSign; //旋转电机故障标志 private int rotatingMotorFailSign; //故障标志位 private int failSign; //预留字段 private int reservedField; }