ZteitsReportProcess.java
8.49 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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
package com.zteits.nbiot.decoder;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
public class ZteitsReportProcess {
private String factoryCode;
private String model;
private int reportType;
private int nowTime1;
private int nowTime2;
private int state;
private int packCount;
private int voltage;
private int magId;
private int magRssi;
private int x;
private int y;
private int z;
private int version;
private int parkCnt;
private int sendCnt;
private int baseX;
private int baseY;
private int baseZ;
private int alarmInfo;
private int reserverd1;
private int reserverd2;
private int reserverd3;
private int reserverd4;
private int reserverd5;
private int reserverd6;
private int crc;
public String getFactoryCode()
{
return this.factoryCode;
}
public void setFactoryCode(String paramString)
{
this.factoryCode = paramString;
}
public String getModel()
{
return this.model;
}
public void setModel(String paramString)
{
this.model = paramString;
}
public int getReportType()
{
return this.reportType;
}
public void setReportType(int paramInt)
{
this.reportType = paramInt;
}
public int getNowTime1()
{
return this.nowTime1;
}
public void setNowTime1(int paramInt)
{
this.nowTime1 = paramInt;
}
public int getNowTime2()
{
return this.nowTime2;
}
public void setNowTime2(int paramInt)
{
this.nowTime2 = paramInt;
}
public int getState()
{
return this.state;
}
public void setState(int paramInt)
{
this.state = paramInt;
}
public int getPackCount()
{
return this.packCount;
}
public void setPackCount(int paramInt)
{
this.packCount = paramInt;
}
public int getVoltage()
{
return this.voltage;
}
public void setVoltage(int paramInt)
{
this.voltage = paramInt;
}
public int getMagId()
{
return this.magId;
}
public void setMagId(int paramInt)
{
this.magId = paramInt;
}
public int getMagRssi()
{
return this.magRssi;
}
public void setMagRssi(int paramInt)
{
this.magRssi = paramInt;
}
public int getX()
{
return this.x;
}
public void setX(int paramInt)
{
this.x = paramInt;
}
public int getY()
{
return this.y;
}
public void setY(int paramInt)
{
this.y = paramInt;
}
public int getZ()
{
return this.z;
}
public void setZ(int paramInt)
{
this.z = paramInt;
}
public int getVersion()
{
return this.version;
}
public void setVersion(int paramInt)
{
this.version = paramInt;
}
public int getParkCnt()
{
return this.parkCnt;
}
public void setParkCnt(int paramInt)
{
this.parkCnt = paramInt;
}
public int getSendCnt()
{
return this.sendCnt;
}
public void setSendCnt(int paramInt)
{
this.sendCnt = paramInt;
}
public int getBaseX()
{
return this.baseX;
}
public void setBaseX(int paramInt)
{
this.baseX = paramInt;
}
public int getBaseY()
{
return this.baseY;
}
public void setBaseY(int paramInt)
{
this.baseY = paramInt;
}
public int getBaseZ()
{
return this.baseZ;
}
public void setBaseZ(int paramInt)
{
this.baseZ = paramInt;
}
public int getAlarmInfo()
{
return this.alarmInfo;
}
public void setAlarmInfo(int paramInt)
{
this.alarmInfo = paramInt;
}
public int getReserverd1()
{
return this.reserverd1;
}
public void setReserverd1(int paramInt)
{
this.reserverd1 = paramInt;
}
public int getReserverd2()
{
return this.reserverd2;
}
public void setReserverd2(int paramInt)
{
this.reserverd2 = paramInt;
}
public int getReserverd3()
{
return this.reserverd3;
}
public void setReserverd3(int paramInt)
{
this.reserverd3 = paramInt;
}
public int getReserverd4()
{
return this.reserverd4;
}
public void setReserverd4(int paramInt)
{
this.reserverd4 = paramInt;
}
public int getReserverd5()
{
return this.reserverd5;
}
public void setReserverd5(int paramInt)
{
this.reserverd5 = paramInt;
}
public int getReserverd6()
{
return this.reserverd6;
}
public void setReserverd6(int paramInt)
{
this.reserverd6 = paramInt;
}
public int getCrc()
{
return this.crc;
}
public void setCrc(int paramInt)
{
this.crc = paramInt;
}
public ZteitsReportProcess(byte[] binaryData) throws UnsupportedEncodingException {
this.factoryCode = new String(Arrays.copyOfRange(binaryData,0,4),"UTF-8");
//this.factoryCode = Utilty.hexStringToString(binaryData, 0, 4);
this.model = Utilty.hexStringToString(binaryData,4,8);
this.reportType = Utilty.hexStringToInteger(binaryData,8,9);
this.nowTime1 = Utilty.hexStringToInteger(binaryData,9,13);
this.nowTime2 = Utilty.hexStringToInteger(binaryData,13,17);
this.state = Utilty.hexStringToInteger(binaryData,17,18);
this.packCount = Utilty.hexStringToInteger(binaryData,18,20);
this.voltage = Utilty.hexStringToInteger(binaryData,20,22);
this.magId = Utilty.hexStringToInteger(binaryData,22,26);
this.magRssi = Utilty.hexStringToInteger(binaryData,26,27);
this.x = Utilty.hexStringToInteger(binaryData,27,29);
this.y = Utilty.hexStringToInteger(binaryData,29,31);
this.z = Utilty.hexStringToInteger(binaryData,31,33);
this.version = Utilty.hexStringToInteger(binaryData,33,35);
this.parkCnt = Utilty.hexStringToInteger(binaryData,35,37);
this.sendCnt = Utilty.hexStringToInteger(binaryData,37,40);
this.baseX = Utilty.hexStringToInteger(binaryData,40,42);
this.baseY = Utilty.hexStringToInteger(binaryData,42,44);
this.baseZ = Utilty.hexStringToInteger(binaryData,44,46);
this.alarmInfo = Utilty.hexStringToInteger(binaryData,46,47);
this.reserverd1 = Utilty.hexStringToInteger(binaryData,47,48);
this.reserverd2 = Utilty.hexStringToInteger(binaryData,48,49);
this.reserverd3 = Utilty.hexStringToInteger(binaryData,49,50);
this.reserverd4 = Utilty.hexStringToInteger(binaryData,50,52);
this.reserverd5 = Utilty.hexStringToInteger(binaryData,52,54);
this.reserverd6 = Utilty.hexStringToInteger(binaryData,54,58);
this.crc = Utilty.hexStringToInteger(binaryData,58,60);
}
public ObjectNode toJsonNode()
{
ObjectMapper localObjectMapper = new ObjectMapper();
ObjectNode localObjectNode1 = localObjectMapper.createObjectNode();
localObjectNode1.put("msgType", "deviceReq");
ArrayNode localArrayNode = localObjectMapper.createArrayNode();
ObjectNode localObjectNode2 = localObjectMapper.createObjectNode();
localObjectNode2 = localObjectMapper.createObjectNode();
localObjectNode2.put("factoryCode", getFactoryCode());
localObjectNode2.put("model", getModel());
localObjectNode2.put("reportType", getReportType());
localObjectNode2.put("reportTime1", getNowTime1());
localObjectNode2.put("reportTime", getNowTime2());
localObjectNode2.put("state", getState());
localObjectNode2.put("packCount", getPackCount());
localObjectNode2.put("voltage", getVoltage());
localObjectNode2.put("magId", getMagId());
localObjectNode2.put("deviceId", getMagId());
localObjectNode2.put("rssi", getMagRssi());
localObjectNode2.put("x", getX());
localObjectNode2.put("y", getY());
localObjectNode2.put("z", getZ());
localObjectNode2.put("version", getVersion());
localObjectNode2.put("parkCnt", getParkCnt());
localObjectNode2.put("sendCnt", getSendCnt());
localObjectNode2.put("baseX", getBaseX());
localObjectNode2.put("baseY", getBaseY());
localObjectNode2.put("baseZ", getBaseZ());
localObjectNode2.put("alarmInfo", getAlarmInfo());
localObjectNode2.put("reserverd1", getReserverd1());
localObjectNode2.put("reserverd2", getReserverd2());
localObjectNode2.put("reserverd3", getReserverd3());
localObjectNode2.put("reserverd4", getReserverd4());
localObjectNode2.put("reserverd5", getReserverd5());
localObjectNode2.put("reserverd6", getReserverd6());
localObjectNode2.put("crc", getCrc());
ObjectNode localObjectNode3 = localObjectMapper.createObjectNode();
localObjectNode3.put("serviceId", "VehicleDetectorInfo");
localObjectNode3.set("serviceData", localObjectNode2);
localArrayNode.add(localObjectNode3);
localObjectNode1.set("data", localArrayNode);
return localObjectNode1;
}
}