Message0206.java
5.37 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
package com.bsth.socket.protocol;
import com.bsth.util.ConvertUtil;
/**
* @author Hill
* 极值数据
*/
public class Message0206 implements IMessageBody02 {
/**
* 信息类型
* 默认应该为0x06
*/
private byte infoType;
/**
* 最高电压电池子系统代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte maxVoltageSubSysCode;
/**
* 最高电压电池单体代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte maxVoltageSubCode;
/**
* 电池单体电压最高值 0-15000
* 分辨率0.001v
* 0xff 0xfe 异常
* 0xff 0xff 无效
*/
private short maxVoltage;
/**
* 最低电压电池子系统代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte minVoltageSubSysCode;
/**
* 最低电压电池单体代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte minVoltageSubCode;
/**
* 电池单体电压最低值 0-15000
* 分辨率0.001v
* 0xff 0xfe 异常
* 0xff 0xff 无效
*/
private short minVoltage;
/**
* 最高温度子系统代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte maxTempSubSysCode;
/**
* 最高温度探针代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte maxTempSensorCode;
/**
* 最高温度值 0-250
* 分辨率1℃ 偏移量-40
* 0xfe 异常
* 0xff 无效
*/
private byte maxTemp;
/**
* 最低温度子系统代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte minTempSubSysCode;
/**
* 最低温度探针代码 1-250
* 0xfe 异常
* 0xff 无效
*/
private byte minTempSensorCode;
/**
* 最低温度值 0-250
* 分辨率1℃ 偏移量-40
* 0xfe 异常
* 0xff 无效
*/
private byte minTemp;
@Override
public void read(byte[] bytes, int idx) {
// TODO Auto-generated method stub
infoType = bytes[idx]; idx++;
maxVoltageSubSysCode = bytes[idx]; idx++;
maxVoltageSubCode = bytes[idx]; idx++;
maxVoltage = (short) ConvertUtil.bytes2int(bytes, idx, 2); idx += 2;
minVoltageSubSysCode = bytes[idx]; idx++;
minVoltageSubCode = bytes[idx]; idx++;
minVoltage = (short) ConvertUtil.bytes2int(bytes, idx, 2); idx += 2;
maxTempSubSysCode = bytes[idx]; idx++;
maxTempSensorCode = bytes[idx]; idx++;
maxTemp = bytes[idx]; idx++;
minTempSubSysCode = bytes[idx]; idx++;
minTempSensorCode = bytes[idx]; idx++;
minTemp = bytes[idx]; idx++;
}
@Override
public int getByteLen() {
return 15;
}
public byte getInfoType() {
return infoType;
}
public void setInfoType(byte infoType) {
this.infoType = infoType;
}
public byte getMaxVoltageSubSysCode() {
return maxVoltageSubSysCode;
}
public void setMaxVoltageSubSysCode(byte maxVoltageSubSysCode) {
this.maxVoltageSubSysCode = maxVoltageSubSysCode;
}
public byte getMaxVoltageSubCode() {
return maxVoltageSubCode;
}
public void setMaxVoltageSubCode(byte maxVoltageSubCode) {
this.maxVoltageSubCode = maxVoltageSubCode;
}
public short getMaxVoltage() {
return maxVoltage;
}
public void setMaxVoltage(short maxVoltage) {
this.maxVoltage = maxVoltage;
}
public byte getMinVoltageSubSysCode() {
return minVoltageSubSysCode;
}
public void setMinVoltageSubSysCode(byte minVoltageSubSysCode) {
this.minVoltageSubSysCode = minVoltageSubSysCode;
}
public byte getMinVoltageSubCode() {
return minVoltageSubCode;
}
public void setMinVoltageSubCode(byte minVoltageSubCode) {
this.minVoltageSubCode = minVoltageSubCode;
}
public short getMinVoltage() {
return minVoltage;
}
public void setMinVoltage(short minVoltage) {
this.minVoltage = minVoltage;
}
public byte getMaxTempSubSysCode() {
return maxTempSubSysCode;
}
public void setMaxTempSubSysCode(byte maxTempSubSysCode) {
this.maxTempSubSysCode = maxTempSubSysCode;
}
public byte getMaxTempSensorCode() {
return maxTempSensorCode;
}
public void setMaxTempSensorCode(byte maxTempSensorCode) {
this.maxTempSensorCode = maxTempSensorCode;
}
public byte getMaxTemp() {
return maxTemp;
}
public void setMaxTemp(byte maxTemp) {
this.maxTemp = maxTemp;
}
public byte getMinTempSubSysCode() {
return minTempSubSysCode;
}
public void setMinTempSubSysCode(byte minTempSubSysCode) {
this.minTempSubSysCode = minTempSubSysCode;
}
public byte getMinTempSensorCode() {
return minTempSensorCode;
}
public void setMinTempSensorCode(byte minTempSensorCode) {
this.minTempSensorCode = minTempSensorCode;
}
public byte getMinTemp() {
return minTemp;
}
public void setMinTemp(byte minTemp) {
this.minTemp = minTemp;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(" 信息类型: ").append(String.format("%02x", infoType))
.append(" 最大电压子系统编码: ").append(maxVoltageSubSysCode)
.append(" 最大电压子单体代号: ").append(maxVoltageSubCode)
.append(" 电池单体电压最高值: ").append(maxVoltage)
.append(" 最低电压子系统编码: ").append(minVoltageSubSysCode)
.append(" 最低电压子单体代号: ").append(minVoltageSubCode)
.append(" 电池单体电压最低值: ").append(minVoltage)
.append(" 最高温度子系统代码: ").append(maxTempSubSysCode)
.append(" 最高温度探针代码: ").append(maxTempSensorCode)
.append(" 最高温度值: ").append(maxTemp)
.append(" 最低温度子系统代码: ").append(maxTempSubSysCode)
.append(" 最低温度探针代码: ").append(maxTempSensorCode)
.append(" 最低温度值: ").append(maxTemp);
return sb.toString();
}
}