zhang
2025-05-20 1313906bb1eb983d3beece810035e7fc28d6a92f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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;
 
 
}