queclink-parser 1.9.12 → 1.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/example.js +88 -81
- package/package.json +1 -1
- package/src/gv310lau.js +79 -30
- package/src/gv58lau.js +818 -1049
- package/src/index.js +3 -1
- package/src/messages/es.json +1 -0
- package/src/utils.js +25 -18
package/src/gv58lau.js
CHANGED
|
@@ -33,8 +33,9 @@ const parse = raw => {
|
|
|
33
33
|
try {
|
|
34
34
|
let number = parsedData[6] !== '' ? parseInt(parsedData[6], 10) : 1
|
|
35
35
|
let satelliteInfo = utils.includeSatellites(parsedData[18])
|
|
36
|
-
let
|
|
37
|
-
let
|
|
36
|
+
let gnnsTriggerType = utils.includeGnssTrigger(parsedData[18])
|
|
37
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[18]) ? 3 : 0
|
|
38
|
+
let index = 6 + (12 + satelliteInfo + gnnsTriggerType + accuracyInfo) * number
|
|
38
39
|
|
|
39
40
|
data = Object.assign(data, {
|
|
40
41
|
alarm: utils.getAlarm(command[1], null),
|
|
@@ -49,68 +50,80 @@ const parse = raw => {
|
|
|
49
50
|
),
|
|
50
51
|
hdop: parsedData[7] !== '' ? parseFloat(parsedData[7]) : null,
|
|
51
52
|
status: {
|
|
52
|
-
raw: parsedData[index +
|
|
53
|
+
raw: parsedData[index + 7],
|
|
53
54
|
sos: false,
|
|
54
55
|
input: {
|
|
55
56
|
'2':
|
|
56
57
|
utils.nHexDigit(
|
|
57
|
-
utils.hex2bin(parsedData[index +
|
|
58
|
+
utils.hex2bin(parsedData[index + 7].substring(2, 4)),
|
|
58
59
|
8
|
|
59
60
|
)[6] === '1',
|
|
60
61
|
'1':
|
|
61
62
|
utils.nHexDigit(
|
|
62
|
-
utils.hex2bin(parsedData[index +
|
|
63
|
+
utils.hex2bin(parsedData[index + 7].substring(2, 4)),
|
|
63
64
|
8
|
|
64
65
|
)[7] === '1'
|
|
65
66
|
},
|
|
66
67
|
output: {
|
|
67
68
|
'3':
|
|
68
69
|
utils.nHexDigit(
|
|
69
|
-
utils.hex2bin(parsedData[index +
|
|
70
|
+
utils.hex2bin(parsedData[index + 7].substring(4, 6)),
|
|
70
71
|
8
|
|
71
72
|
)[5] === '1',
|
|
72
73
|
'2':
|
|
73
74
|
utils.nHexDigit(
|
|
74
|
-
utils.hex2bin(parsedData[index +
|
|
75
|
+
utils.hex2bin(parsedData[index + 7].substring(4, 6)),
|
|
75
76
|
8
|
|
76
77
|
)[6] === '1',
|
|
77
78
|
'1':
|
|
78
79
|
utils.nHexDigit(
|
|
79
|
-
utils.hex2bin(parsedData[index +
|
|
80
|
+
utils.hex2bin(parsedData[index + 7].substring(4, 6)),
|
|
80
81
|
8
|
|
81
82
|
)[7] === '1'
|
|
82
83
|
},
|
|
83
84
|
charge: parseFloat(parsedData[4]) > 5,
|
|
84
|
-
state: utils.states[parsedData[index +
|
|
85
|
+
state: utils.states[parsedData[index + 7].substring(0, 2)]
|
|
85
86
|
},
|
|
86
87
|
azimuth: parsedData[9] !== '' ? parseFloat(parsedData[9]) : null,
|
|
87
88
|
altitude: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null,
|
|
88
89
|
datetime:
|
|
89
90
|
parsedData[13] !== '' ? utils.parseDate(parsedData[13]) : null,
|
|
90
91
|
voltage: {
|
|
91
|
-
battery: parsedData[index +
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
battery: parsedData[index + 6] !== ''
|
|
93
|
+
? parseFloat(parsedData[index + 6])
|
|
94
|
+
: null,
|
|
94
95
|
inputCharge:
|
|
95
96
|
parsedData[4] !== '' ? parseFloat(parsedData[4]) / 1000 : null
|
|
96
97
|
},
|
|
97
|
-
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] : null,
|
|
98
|
+
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] || utils.latamMcc.default : null,
|
|
98
99
|
mnc: parsedData[15] !== '' ? utils.getMNC(parsedData[14], parsedData[15]) : null,
|
|
99
100
|
lac: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
100
101
|
cid: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
101
102
|
satellites:
|
|
102
|
-
satelliteInfo && parsedData[index - (satelliteInfo +
|
|
103
|
-
? parseInt(parsedData[index - (satelliteInfo +
|
|
103
|
+
satelliteInfo && parsedData[index - (satelliteInfo + gnnsTriggerType + accuracyInfo) + 1] !== ''
|
|
104
|
+
? parseInt(parsedData[index - (satelliteInfo + gnnsTriggerType + accuracyInfo) + 1], 10)
|
|
104
105
|
: null,
|
|
105
106
|
gnssTrigger:
|
|
106
|
-
|
|
107
|
-
? utils.gnssTriggerTypes[parsedData[index -
|
|
107
|
+
gnnsTriggerType && parsedData[index - (gnnsTriggerType + accuracyInfo) + 1] !== ''
|
|
108
|
+
? utils.gnssTriggerTypes[parsedData[index - (gnnsTriggerType + accuracyInfo) + 1]]
|
|
109
|
+
: null,
|
|
110
|
+
Hdop:
|
|
111
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
112
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1], 10)
|
|
113
|
+
: null,
|
|
114
|
+
Vdop:
|
|
115
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
116
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2], 10)
|
|
117
|
+
: null,
|
|
118
|
+
Ddop:
|
|
119
|
+
accuracyInfo && parsedData[index] !== ''
|
|
120
|
+
? parseFloat(parsedData[index], 10)
|
|
108
121
|
: null,
|
|
109
122
|
odometer:
|
|
110
|
-
parsedData[index] !== '' ? parseFloat(parsedData[index]) : null,
|
|
123
|
+
parsedData[index + 1] !== '' ? parseFloat(parsedData[index + 1]) : null,
|
|
111
124
|
hourmeter:
|
|
112
|
-
parsedData[index +
|
|
113
|
-
? utils.getHoursForHourmeter(parsedData[index +
|
|
125
|
+
parsedData[index + 2] !== ''
|
|
126
|
+
? utils.getHoursForHourmeter(parsedData[index + 2])
|
|
114
127
|
: null
|
|
115
128
|
})
|
|
116
129
|
|
|
@@ -118,7 +131,7 @@ const parse = raw => {
|
|
|
118
131
|
if (number > 1) {
|
|
119
132
|
let moreData = []
|
|
120
133
|
for (let i = 1; i < number; i++) {
|
|
121
|
-
let gnssIx = 7 + (12 +
|
|
134
|
+
let gnssIx = 7 + (12 + gnnsTriggerType + satelliteInfo + accuracyInfo) * i
|
|
122
135
|
|
|
123
136
|
moreData.push({
|
|
124
137
|
index: i,
|
|
@@ -168,15 +181,27 @@ const parse = raw => {
|
|
|
168
181
|
? parseInt(parsedData[gnssIx + 10], 16)
|
|
169
182
|
: null,
|
|
170
183
|
satellites:
|
|
171
|
-
satelliteInfo && parsedData[gnssIx
|
|
172
|
-
? parseInt(parsedData[gnssIx
|
|
184
|
+
satelliteInfo && parsedData[gnssIx - (satelliteInfo + gnnsTriggerType + accuracyInfo)] !== ''
|
|
185
|
+
? parseInt(parsedData[gnssIx - (satelliteInfo + gnnsTriggerType + accuracyInfo)], 10)
|
|
173
186
|
: null,
|
|
174
187
|
gnssTrigger:
|
|
175
|
-
|
|
176
|
-
|
|
188
|
+
gnnsTriggerType &&
|
|
189
|
+
parsedData[gnssIx - (gnnsTriggerType + accuracyInfo)] !== ''
|
|
177
190
|
? utils.gnssTriggerTypes[
|
|
178
|
-
|
|
191
|
+
parsedData[gnssIx - (gnnsTriggerType + accuracyInfo)]
|
|
179
192
|
]
|
|
193
|
+
: null,
|
|
194
|
+
Hdop:
|
|
195
|
+
accuracyInfo && parsedData[gnssIx - (accuracyInfo)] !== ''
|
|
196
|
+
? parseFloat(parsedData[gnssIx - (accuracyInfo)], 10)
|
|
197
|
+
: null,
|
|
198
|
+
Vdop:
|
|
199
|
+
accuracyInfo && parsedData[gnssIx - (accuracyInfo) + 1] !== ''
|
|
200
|
+
? parseFloat(parsedData[gnssIx - (accuracyInfo) + 1], 10)
|
|
201
|
+
: null,
|
|
202
|
+
Ddop:
|
|
203
|
+
accuracyInfo && parsedData[gnssIx - 1] !== ''
|
|
204
|
+
? parseFloat(parsedData[gnssIx - 1], 10)
|
|
180
205
|
: null
|
|
181
206
|
})
|
|
182
207
|
}
|
|
@@ -190,8 +215,9 @@ const parse = raw => {
|
|
|
190
215
|
// GPS with AC100 and/or Bluetoth Devices Connected
|
|
191
216
|
let number = parsedData[7] !== '' ? parseInt(parsedData[7], 10) : 1
|
|
192
217
|
let satelliteInfo = utils.includeSatellites(parsedData[19])
|
|
193
|
-
let
|
|
194
|
-
let
|
|
218
|
+
let gnnsTriggerType = utils.includeGnssTrigger(parsedData[19])
|
|
219
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[19]) ? 3 : 0
|
|
220
|
+
let index = 7 + (12 + satelliteInfo + gnnsTriggerType + accuracyInfo) * number
|
|
195
221
|
|
|
196
222
|
data = Object.assign(data, {
|
|
197
223
|
alarm: utils.getAlarm(command[1], null),
|
|
@@ -206,47 +232,47 @@ const parse = raw => {
|
|
|
206
232
|
),
|
|
207
233
|
hdop: parsedData[8] !== '' ? parseFloat(parsedData[8]) : null,
|
|
208
234
|
status: {
|
|
209
|
-
raw: parsedData[index +
|
|
235
|
+
raw: parsedData[index + 7],
|
|
210
236
|
sos: false,
|
|
211
237
|
input: {
|
|
212
238
|
'2':
|
|
213
239
|
utils.nHexDigit(
|
|
214
|
-
utils.hex2bin(parsedData[index +
|
|
240
|
+
utils.hex2bin(parsedData[index + 7].substring(2, 4)),
|
|
215
241
|
8
|
|
216
|
-
)[
|
|
242
|
+
)[6] === '1',
|
|
217
243
|
'1':
|
|
218
244
|
utils.nHexDigit(
|
|
219
|
-
utils.hex2bin(parsedData[index +
|
|
245
|
+
utils.hex2bin(parsedData[index + 7].substring(2, 4)),
|
|
220
246
|
8
|
|
221
|
-
)[
|
|
247
|
+
)[7] === '1'
|
|
222
248
|
},
|
|
223
249
|
output: {
|
|
224
250
|
'3':
|
|
225
251
|
utils.nHexDigit(
|
|
226
|
-
utils.hex2bin(parsedData[index +
|
|
252
|
+
utils.hex2bin(parsedData[index + 7].substring(4, 6)),
|
|
227
253
|
8
|
|
228
254
|
)[5] === '1',
|
|
229
255
|
'2':
|
|
230
256
|
utils.nHexDigit(
|
|
231
|
-
utils.hex2bin(parsedData[index +
|
|
257
|
+
utils.hex2bin(parsedData[index + 7].substring(4, 6)),
|
|
232
258
|
8
|
|
233
259
|
)[6] === '1',
|
|
234
260
|
'1':
|
|
235
261
|
utils.nHexDigit(
|
|
236
|
-
utils.hex2bin(parsedData[index +
|
|
262
|
+
utils.hex2bin(parsedData[index + 7].substring(4, 6)),
|
|
237
263
|
8
|
|
238
264
|
)[7] === '1'
|
|
239
265
|
},
|
|
240
266
|
charge: parseFloat(parsedData[5]) > 5,
|
|
241
|
-
state: utils.states[parsedData[index +
|
|
267
|
+
state: utils.states[parsedData[index + 7].substring(0, 2)]
|
|
242
268
|
},
|
|
243
269
|
azimuth: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null,
|
|
244
270
|
altitude: parsedData[11] !== '' ? parseFloat(parsedData[11]) : null,
|
|
245
271
|
datetime: parsedData[14] !== '' ? utils.parseDate(parsedData[14]) : null,
|
|
246
272
|
voltage: {
|
|
247
273
|
battery:
|
|
248
|
-
parsedData[index +
|
|
249
|
-
? parseFloat(parsedData[index +
|
|
274
|
+
parsedData[index + 6] !== ''
|
|
275
|
+
? parseFloat(parsedData[index + 6])
|
|
250
276
|
: null, // percentage
|
|
251
277
|
inputCharge:
|
|
252
278
|
parsedData[5] !== '' ? parseFloat(parsedData[5]) / 1000 : null
|
|
@@ -256,17 +282,29 @@ const parse = raw => {
|
|
|
256
282
|
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
257
283
|
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
258
284
|
satellites:
|
|
259
|
-
satelliteInfo && parsedData[index - (satelliteInfo +
|
|
260
|
-
? parseInt(parsedData[index - (satelliteInfo +
|
|
285
|
+
satelliteInfo && parsedData[index - (satelliteInfo + gnnsTriggerType + accuracyInfo) + 1] !== ''
|
|
286
|
+
? parseInt(parsedData[index - (satelliteInfo + gnnsTriggerType + accuracyInfo) + 1], 10)
|
|
261
287
|
: null,
|
|
262
288
|
gnssTrigger:
|
|
263
|
-
|
|
264
|
-
? utils.gnssTriggerTypes[parsedData[index -
|
|
289
|
+
gnnsTriggerType && parsedData[index - (gnnsTriggerType + accuracyInfo) + 1] !== ''
|
|
290
|
+
? utils.gnssTriggerTypes[parsedData[index - (gnnsTriggerType + accuracyInfo) + 1]]
|
|
291
|
+
: null,
|
|
292
|
+
Hdop:
|
|
293
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
294
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1], 10)
|
|
265
295
|
: null,
|
|
266
|
-
|
|
296
|
+
Vdop:
|
|
297
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
298
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2], 10)
|
|
299
|
+
: null,
|
|
300
|
+
Ddop:
|
|
301
|
+
accuracyInfo && parsedData[index] !== ''
|
|
302
|
+
? parseFloat(parsedData[index], 10)
|
|
303
|
+
: null,
|
|
304
|
+
odometer: parsedData[index + 1] !== '' ? parseFloat(parsedData[index + 1]) : null,
|
|
267
305
|
hourmeter:
|
|
268
|
-
parsedData[index +
|
|
269
|
-
? utils.getHoursForHourmeter(parsedData[index +
|
|
306
|
+
parsedData[index + 2] !== ''
|
|
307
|
+
? utils.getHoursForHourmeter(parsedData[index + 2])
|
|
270
308
|
: null
|
|
271
309
|
})
|
|
272
310
|
// External Data
|
|
@@ -288,9 +326,9 @@ const parse = raw => {
|
|
|
288
326
|
let btIndex
|
|
289
327
|
|
|
290
328
|
if (canData) {
|
|
291
|
-
btIndex = index +
|
|
329
|
+
btIndex = index + 58
|
|
292
330
|
} else {
|
|
293
|
-
btIndex = index +
|
|
331
|
+
btIndex = index + 9
|
|
294
332
|
}
|
|
295
333
|
|
|
296
334
|
let cnt = btIndex + 1
|
|
@@ -330,44 +368,44 @@ const parse = raw => {
|
|
|
330
368
|
? {
|
|
331
369
|
raw: parsedData[cnt + 3],
|
|
332
370
|
fuelLevel:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
371
|
+
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '10'
|
|
372
|
+
? parsedData[cnt + 3]
|
|
373
|
+
: null,
|
|
336
374
|
temperature:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
? utils.getBtTempHumData(
|
|
346
|
-
parsedData[cnt + 3].substring(0, 4)
|
|
347
|
-
)
|
|
348
|
-
: ['64', '65'].includes(
|
|
349
|
-
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}`
|
|
350
|
-
)
|
|
351
|
-
? parseInt(
|
|
352
|
-
parsedData[cnt + 3].substring(4, 8),
|
|
353
|
-
16
|
|
354
|
-
) / 100
|
|
355
|
-
: null,
|
|
356
|
-
humidity:
|
|
357
|
-
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '20'
|
|
358
|
-
? utils.getBtTempHumData(
|
|
359
|
-
parsedData[cnt + 3].substring(4, 8)
|
|
360
|
-
)
|
|
361
|
-
: `${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '62'
|
|
375
|
+
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '20'
|
|
376
|
+
? utils.getBtTempHumData(
|
|
377
|
+
parsedData[cnt + 3].substring(4, 8)
|
|
378
|
+
)
|
|
379
|
+
: `${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '21'
|
|
380
|
+
? parsedData[cnt + 3] // Conversion not specified in documentation
|
|
381
|
+
: `${parsedData[cnt + 1]}${parsedData[cnt + 2]}` ===
|
|
382
|
+
'62'
|
|
362
383
|
? utils.getBtTempHumData(
|
|
363
|
-
parsedData[cnt + 3].substring(
|
|
384
|
+
parsedData[cnt + 3].substring(0, 4)
|
|
364
385
|
)
|
|
365
386
|
: ['64', '65'].includes(
|
|
366
387
|
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}`
|
|
367
388
|
)
|
|
368
|
-
? parseInt(
|
|
369
|
-
|
|
370
|
-
|
|
389
|
+
? parseInt(
|
|
390
|
+
parsedData[cnt + 3].substring(4, 8),
|
|
391
|
+
16
|
|
392
|
+
) / 100
|
|
393
|
+
: null,
|
|
394
|
+
humidity:
|
|
395
|
+
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '20'
|
|
396
|
+
? utils.getBtTempHumData(
|
|
397
|
+
parsedData[cnt + 3].substring(4, 8)
|
|
398
|
+
)
|
|
399
|
+
: `${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '62'
|
|
400
|
+
? utils.getBtTempHumData(
|
|
401
|
+
parsedData[cnt + 3].substring(4, 8)
|
|
402
|
+
)
|
|
403
|
+
: ['64', '65'].includes(
|
|
404
|
+
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}`
|
|
405
|
+
)
|
|
406
|
+
? parseInt(parsedData[cnt + 3].substring(0, 4), 16) /
|
|
407
|
+
100
|
|
408
|
+
: null
|
|
371
409
|
}
|
|
372
410
|
: null,
|
|
373
411
|
name:
|
|
@@ -470,7 +508,7 @@ const parse = raw => {
|
|
|
470
508
|
if (number > 1) {
|
|
471
509
|
let moreData = []
|
|
472
510
|
for (let i = 1; i < number; i++) {
|
|
473
|
-
let gnssIx = 8 + (12 +
|
|
511
|
+
let gnssIx = 8 + (12 + gnnsTriggerType + satelliteInfo + accuracyInfo) * i
|
|
474
512
|
moreData.push({
|
|
475
513
|
index: i,
|
|
476
514
|
loc: {
|
|
@@ -519,15 +557,27 @@ const parse = raw => {
|
|
|
519
557
|
? parseInt(parsedData[gnssIx + 10], 16)
|
|
520
558
|
: null,
|
|
521
559
|
satellites:
|
|
522
|
-
satelliteInfo && parsedData[gnssIx
|
|
523
|
-
? parseInt(parsedData[gnssIx
|
|
560
|
+
satelliteInfo && parsedData[gnssIx - (satelliteInfo + gnnsTriggerType + accuracyInfo)] !== ''
|
|
561
|
+
? parseInt(parsedData[gnssIx - (satelliteInfo + gnnsTriggerType + accuracyInfo)], 10)
|
|
524
562
|
: null,
|
|
525
563
|
gnssTrigger:
|
|
526
|
-
|
|
527
|
-
|
|
564
|
+
gnnsTriggerType &&
|
|
565
|
+
parsedData[gnssIx - (gnnsTriggerType + accuracyInfo)] !== ''
|
|
528
566
|
? utils.gnssTriggerTypes[
|
|
529
|
-
|
|
567
|
+
parsedData[gnssIx - (gnnsTriggerType + accuracyInfo)]
|
|
530
568
|
]
|
|
569
|
+
: null,
|
|
570
|
+
Hdop:
|
|
571
|
+
accuracyInfo && parsedData[gnssIx - (accuracyInfo)] !== ''
|
|
572
|
+
? parseFloat(parsedData[gnssIx - (accuracyInfo)], 10)
|
|
573
|
+
: null,
|
|
574
|
+
Vdop:
|
|
575
|
+
accuracyInfo && parsedData[gnssIx - (accuracyInfo) + 1] !== ''
|
|
576
|
+
? parseFloat(parsedData[gnssIx - (accuracyInfo) + 1], 10)
|
|
577
|
+
: null,
|
|
578
|
+
Ddop:
|
|
579
|
+
accuracyInfo && parsedData[gnssIx - 1] !== ''
|
|
580
|
+
? parseFloat(parsedData[gnssIx - 1], 10)
|
|
531
581
|
: null
|
|
532
582
|
})
|
|
533
583
|
}
|
|
@@ -578,8 +628,8 @@ const parse = raw => {
|
|
|
578
628
|
raw: `${parsedData[21]}${parsedData[22]}`,
|
|
579
629
|
sos: false,
|
|
580
630
|
input: {
|
|
581
|
-
'2': utils.nHexDigit(utils.hex2bin(parsedData[21]), 8)[
|
|
582
|
-
'1': utils.nHexDigit(utils.hex2bin(parsedData[21]), 8)[
|
|
631
|
+
'2': utils.nHexDigit(utils.hex2bin(parsedData[21]), 8)[6] === '1',
|
|
632
|
+
'1': utils.nHexDigit(utils.hex2bin(parsedData[21]), 8)[7] === '1'
|
|
583
633
|
},
|
|
584
634
|
output: {
|
|
585
635
|
'3': utils.nHexDigit(utils.hex2bin(parsedData[22]), 8)[5] === '1',
|
|
@@ -614,17 +664,9 @@ const parse = raw => {
|
|
|
614
664
|
) {
|
|
615
665
|
// Common Alarms
|
|
616
666
|
let number = parsedData[6] !== '' ? parseInt(parsedData[6], 10) : 1
|
|
617
|
-
let
|
|
618
|
-
let
|
|
619
|
-
|
|
620
|
-
let includeStatus =
|
|
621
|
-
parsedData[index] !== '' ? parseInt(parsedData[index]) > 3 : null
|
|
622
|
-
|
|
623
|
-
// If get satellites is configured
|
|
624
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
625
|
-
index += 1
|
|
626
|
-
satelliteInfo = true
|
|
627
|
-
}
|
|
667
|
+
let satelliteInfo = utils.includeSatellites(parsedData[18])
|
|
668
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[18]) ? 3 : 0
|
|
669
|
+
let index = 6 + (12 + satelliteInfo + accuracyInfo) * number
|
|
628
670
|
|
|
629
671
|
data = Object.assign(data, {
|
|
630
672
|
alarm: utils.getAlarm(command[1], parsedData[5], 'gv58lau'),
|
|
@@ -645,71 +687,36 @@ const parse = raw => {
|
|
|
645
687
|
battery: null,
|
|
646
688
|
inputCharge: null
|
|
647
689
|
},
|
|
648
|
-
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] : null,
|
|
690
|
+
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] || utils.latamMcc.default : null,
|
|
649
691
|
mnc: parsedData[15] !== '' ? utils.getMNC(parsedData[14], parsedData[15]) : null,
|
|
650
692
|
lac: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
651
693
|
cid: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
652
694
|
satellites:
|
|
653
|
-
satelliteInfo && parsedData[index] !== ''
|
|
654
|
-
? parseInt(parsedData[index])
|
|
695
|
+
satelliteInfo && parsedData[index - (satelliteInfo + accuracyInfo) + 1] !== ''
|
|
696
|
+
? parseInt(parsedData[index - (satelliteInfo + accuracyInfo) + 1], 10)
|
|
655
697
|
: null,
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
664
|
-
8
|
|
665
|
-
)[7] === '1',
|
|
666
|
-
'1':
|
|
667
|
-
utils.nHexDigit(
|
|
668
|
-
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
669
|
-
8
|
|
670
|
-
)[6] === '1'
|
|
671
|
-
},
|
|
672
|
-
output: {
|
|
673
|
-
'3':
|
|
674
|
-
utils.nHexDigit(
|
|
675
|
-
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
676
|
-
8
|
|
677
|
-
)[5] === '1',
|
|
678
|
-
'2':
|
|
679
|
-
utils.nHexDigit(
|
|
680
|
-
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
681
|
-
8
|
|
682
|
-
)[6] === '1',
|
|
683
|
-
'1':
|
|
684
|
-
utils.nHexDigit(
|
|
685
|
-
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
686
|
-
8
|
|
687
|
-
)[7] === '1'
|
|
688
|
-
},
|
|
689
|
-
charge: null,
|
|
690
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
691
|
-
}
|
|
692
|
-
: null,
|
|
693
|
-
odometer: includeStatus
|
|
694
|
-
? parsedData[index + 2] !== ''
|
|
695
|
-
? parseFloat(parsedData[index + 2])
|
|
696
|
-
: null
|
|
697
|
-
: parsedData[index + 1] !== ''
|
|
698
|
-
? parseFloat(parsedData[index + 1])
|
|
698
|
+
Hdop:
|
|
699
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
700
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
701
|
+
: null,
|
|
702
|
+
Vdop:
|
|
703
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
704
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
699
705
|
: null,
|
|
706
|
+
Ddop:
|
|
707
|
+
accuracyInfo && parsedData[index] !== ''
|
|
708
|
+
? parseFloat(parsedData[index])
|
|
709
|
+
: null,
|
|
710
|
+
odometer:
|
|
711
|
+
parsedData[index + 1] !== '' ? parseFloat(parsedData[index + 1]) : null,
|
|
700
712
|
hourmeter: null
|
|
701
713
|
})
|
|
702
714
|
} else if (command[1] === 'GTEPS' || command[1] === 'GTAIS') {
|
|
703
715
|
// External low battery and Low voltage for analog input
|
|
704
716
|
let number = parsedData[6] !== '' ? parseInt(parsedData[6], 10) : 1
|
|
705
|
-
let
|
|
706
|
-
let
|
|
707
|
-
|
|
708
|
-
// If get satellites is configured
|
|
709
|
-
if (utils.includeSatellites(parsedData[18])) {
|
|
710
|
-
index += 1
|
|
711
|
-
satelliteInfo = true
|
|
712
|
-
}
|
|
717
|
+
let satelliteInfo = utils.includeSatellites(parsedData[18])
|
|
718
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[18]) ? 3 : 0
|
|
719
|
+
let index = 6 + (12 + satelliteInfo + accuracyInfo) * number
|
|
713
720
|
|
|
714
721
|
data = Object.assign(data, {
|
|
715
722
|
alarm: utils.getAlarm(command[1], parsedData[5]),
|
|
@@ -731,13 +738,25 @@ const parse = raw => {
|
|
|
731
738
|
battery: parsedData[4] !== '' ? parseFloat(parsedData[4]) / 1000 : null,
|
|
732
739
|
inputCharge: null
|
|
733
740
|
},
|
|
734
|
-
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] : null,
|
|
741
|
+
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] || utils.latamMcc.default : null,
|
|
735
742
|
mnc: parsedData[15] !== '' ? utils.getMNC(parsedData[14], parsedData[15]) : null,
|
|
736
743
|
lac: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
737
744
|
cid: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
738
745
|
satellites:
|
|
739
|
-
satelliteInfo && parsedData[index] !== ''
|
|
740
|
-
? parseInt(parsedData[index])
|
|
746
|
+
satelliteInfo && parsedData[index - (satelliteInfo + accuracyInfo) + 1] !== ''
|
|
747
|
+
? parseInt(parsedData[index - (satelliteInfo + accuracyInfo) + 1], 10)
|
|
748
|
+
: null,
|
|
749
|
+
Hdop:
|
|
750
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
751
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
752
|
+
: null,
|
|
753
|
+
Vdop:
|
|
754
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
755
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
756
|
+
: null,
|
|
757
|
+
Ddop:
|
|
758
|
+
accuracyInfo && parsedData[index] !== ''
|
|
759
|
+
? parseFloat(parsedData[index])
|
|
741
760
|
: null,
|
|
742
761
|
odometer:
|
|
743
762
|
parsedData[index + 1] !== '' ? parseFloat(parsedData[index + 1]) : null,
|
|
@@ -781,16 +800,10 @@ const parse = raw => {
|
|
|
781
800
|
command[1] === 'GTMPF' ||
|
|
782
801
|
command[1] === 'GTBTC'
|
|
783
802
|
) {
|
|
784
|
-
|
|
785
|
-
let
|
|
786
|
-
let
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
// If get satellites is configured
|
|
790
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
791
|
-
index += 1
|
|
792
|
-
satelliteInfo = true
|
|
793
|
-
}
|
|
803
|
+
let satelliteInfo = utils.includeSatellites(parsedData[15])
|
|
804
|
+
let includeStatus = utils.includeStatus(parsedData[15])
|
|
805
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[15]) ? 3 : 0
|
|
806
|
+
let index = 15 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
794
807
|
|
|
795
808
|
data = Object.assign(data, {
|
|
796
809
|
alarm: utils.getAlarm(command[1], null),
|
|
@@ -811,51 +824,63 @@ const parse = raw => {
|
|
|
811
824
|
battery: null,
|
|
812
825
|
inputCharge: null
|
|
813
826
|
},
|
|
814
|
-
mcc: parsedData[11] !== '' ? utils.latamMcc[parseInt(parsedData[11], 10)] : null,
|
|
827
|
+
mcc: parsedData[11] !== '' ? utils.latamMcc[parseInt(parsedData[11], 10)] || utils.latamMcc.default : null,
|
|
815
828
|
mnc: parsedData[12] !== '' ? utils.getMNC(parsedData[11], parsedData[12]) : null,
|
|
816
829
|
lac: parsedData[13] !== '' ? parseInt(parsedData[13], 16) : null,
|
|
817
830
|
cid: parsedData[14] !== '' ? parseInt(parsedData[14], 16) : null,
|
|
818
831
|
satellites:
|
|
819
|
-
satelliteInfo && parsedData[index] !== ''
|
|
820
|
-
? parseInt(parsedData[index])
|
|
832
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
833
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
821
834
|
: null,
|
|
822
|
-
status: includeStatus
|
|
835
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
823
836
|
? {
|
|
824
|
-
raw: parsedData[index + 1],
|
|
837
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
825
838
|
sos: false,
|
|
826
839
|
input: {
|
|
827
840
|
'2':
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
841
|
+
utils.nHexDigit(
|
|
842
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
843
|
+
8
|
|
844
|
+
)[6] === '1',
|
|
832
845
|
'1':
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
846
|
+
utils.nHexDigit(
|
|
847
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
848
|
+
8
|
|
849
|
+
)[7] === '1'
|
|
837
850
|
},
|
|
838
851
|
output: {
|
|
839
852
|
'3':
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
853
|
+
utils.nHexDigit(
|
|
854
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
855
|
+
8
|
|
856
|
+
)[5] === '1',
|
|
844
857
|
'2':
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
858
|
+
utils.nHexDigit(
|
|
859
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
860
|
+
8
|
|
861
|
+
)[6] === '1',
|
|
849
862
|
'1':
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
863
|
+
utils.nHexDigit(
|
|
864
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
865
|
+
8
|
|
866
|
+
)[7] === '1'
|
|
854
867
|
},
|
|
855
868
|
charge: null,
|
|
856
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
869
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
857
870
|
}
|
|
858
871
|
: null,
|
|
872
|
+
Hdop:
|
|
873
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
874
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
875
|
+
: null,
|
|
876
|
+
Vdop:
|
|
877
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
878
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
879
|
+
: null,
|
|
880
|
+
Ddop:
|
|
881
|
+
accuracyInfo && parsedData[index] !== ''
|
|
882
|
+
? parseFloat(parsedData[index])
|
|
883
|
+
: null,
|
|
859
884
|
odometer: null,
|
|
860
885
|
hourmeter: null
|
|
861
886
|
})
|
|
@@ -867,16 +892,10 @@ const parse = raw => {
|
|
|
867
892
|
command[1] === 'GTBPL' ||
|
|
868
893
|
command[1] === 'GTSTT'
|
|
869
894
|
) {
|
|
870
|
-
let
|
|
871
|
-
let
|
|
872
|
-
let
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
// If get satellites is configured
|
|
876
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
877
|
-
index += 1
|
|
878
|
-
satelliteInfo = true
|
|
879
|
-
}
|
|
895
|
+
let satelliteInfo = utils.includeSatellites(parsedData[16])
|
|
896
|
+
let includeStatus = utils.includeStatus(parsedData[16])
|
|
897
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[16]) ? 3 : 0
|
|
898
|
+
let index = 16 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
880
899
|
|
|
881
900
|
data = Object.assign(data, {
|
|
882
901
|
alarm: utils.getAlarm(command[1], parsedData[4]),
|
|
@@ -902,46 +921,58 @@ const parse = raw => {
|
|
|
902
921
|
lac: parsedData[14] !== '' ? parseInt(parsedData[14], 16) : null,
|
|
903
922
|
cid: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
904
923
|
satellites:
|
|
905
|
-
satelliteInfo && parsedData[index] !== ''
|
|
906
|
-
? parseInt(parsedData[index])
|
|
924
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
925
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
907
926
|
: null,
|
|
908
|
-
status: includeStatus
|
|
927
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
909
928
|
? {
|
|
910
|
-
raw: parsedData[index + 1],
|
|
929
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
911
930
|
sos: false,
|
|
912
931
|
input: {
|
|
913
932
|
'2':
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
933
|
+
utils.nHexDigit(
|
|
934
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
935
|
+
8
|
|
936
|
+
)[6] === '1',
|
|
918
937
|
'1':
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
938
|
+
utils.nHexDigit(
|
|
939
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
940
|
+
8
|
|
941
|
+
)[7] === '1'
|
|
923
942
|
},
|
|
924
943
|
output: {
|
|
925
944
|
'3':
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
945
|
+
utils.nHexDigit(
|
|
946
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
947
|
+
8
|
|
948
|
+
)[5] === '1',
|
|
930
949
|
'2':
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
950
|
+
utils.nHexDigit(
|
|
951
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
952
|
+
8
|
|
953
|
+
)[6] === '1',
|
|
935
954
|
'1':
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
955
|
+
utils.nHexDigit(
|
|
956
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
957
|
+
8
|
|
958
|
+
)[7] === '1'
|
|
940
959
|
},
|
|
941
960
|
charge: null,
|
|
942
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
961
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
943
962
|
}
|
|
944
963
|
: null,
|
|
964
|
+
Hdop:
|
|
965
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
966
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
967
|
+
: null,
|
|
968
|
+
Vdop:
|
|
969
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
970
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
971
|
+
: null,
|
|
972
|
+
Ddop:
|
|
973
|
+
accuracyInfo && parsedData[index] !== ''
|
|
974
|
+
? parseFloat(parsedData[index])
|
|
975
|
+
: null,
|
|
945
976
|
odometer: null,
|
|
946
977
|
hourmeter: null
|
|
947
978
|
})
|
|
@@ -1000,16 +1031,10 @@ const parse = raw => {
|
|
|
1000
1031
|
gnssData: more
|
|
1001
1032
|
})
|
|
1002
1033
|
} else if (command[1] === 'GTJDS') {
|
|
1003
|
-
let
|
|
1004
|
-
let
|
|
1005
|
-
let
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
// If get satellites is configured
|
|
1009
|
-
if (utils.includeSatellites(parsedData[17])) {
|
|
1010
|
-
index += 1
|
|
1011
|
-
satelliteInfo = true
|
|
1012
|
-
}
|
|
1034
|
+
let satelliteInfo = utils.includeSatellites(parsedData[17])
|
|
1035
|
+
let includeStatus = utils.includeStatus(parsedData[17])
|
|
1036
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[17]) ? 3 : 0
|
|
1037
|
+
let index = 17 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1013
1038
|
|
|
1014
1039
|
data = Object.assign(data, {
|
|
1015
1040
|
alarm: utils.getAlarm(command[1], parsedData[4], parsedData[5]),
|
|
@@ -1030,65 +1055,71 @@ const parse = raw => {
|
|
|
1030
1055
|
battery: null,
|
|
1031
1056
|
inputCharge: null
|
|
1032
1057
|
},
|
|
1033
|
-
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] : null,
|
|
1058
|
+
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] || utils.latamMcc.default : null,
|
|
1034
1059
|
mnc: parsedData[14] !== '' ? utils.getMNC(parsedData[13], parsedData[14]) : null,
|
|
1035
1060
|
lac: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
1036
1061
|
cid: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
1037
1062
|
satellites:
|
|
1038
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1039
|
-
? parseInt(parsedData[index], 10)
|
|
1063
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1064
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
1040
1065
|
: null,
|
|
1041
|
-
status: includeStatus
|
|
1066
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
1042
1067
|
? {
|
|
1043
|
-
raw: parsedData[index + 1],
|
|
1068
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
1044
1069
|
sos: false,
|
|
1045
1070
|
input: {
|
|
1046
1071
|
'2':
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1072
|
+
utils.nHexDigit(
|
|
1073
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1074
|
+
8
|
|
1075
|
+
)[6] === '1',
|
|
1051
1076
|
'1':
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1077
|
+
utils.nHexDigit(
|
|
1078
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1079
|
+
8
|
|
1080
|
+
)[7] === '1'
|
|
1056
1081
|
},
|
|
1057
1082
|
output: {
|
|
1058
1083
|
'3':
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1084
|
+
utils.nHexDigit(
|
|
1085
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1086
|
+
8
|
|
1087
|
+
)[5] === '1',
|
|
1063
1088
|
'2':
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1089
|
+
utils.nHexDigit(
|
|
1090
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1091
|
+
8
|
|
1092
|
+
)[6] === '1',
|
|
1068
1093
|
'1':
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1094
|
+
utils.nHexDigit(
|
|
1095
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1096
|
+
8
|
|
1097
|
+
)[7] === '1'
|
|
1073
1098
|
},
|
|
1074
1099
|
charge: null,
|
|
1075
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1100
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
1076
1101
|
}
|
|
1077
1102
|
: null,
|
|
1103
|
+
Hdop:
|
|
1104
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1105
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1106
|
+
: null,
|
|
1107
|
+
Vdop:
|
|
1108
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1109
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1110
|
+
: null,
|
|
1111
|
+
Ddop:
|
|
1112
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1113
|
+
? parseFloat(parsedData[index])
|
|
1114
|
+
: null,
|
|
1078
1115
|
odometer: null,
|
|
1079
1116
|
hourmeter: null
|
|
1080
1117
|
})
|
|
1081
1118
|
} else if (command[1] === 'GTIGN' || command[1] === 'GTIGF') {
|
|
1082
|
-
let
|
|
1083
|
-
let
|
|
1084
|
-
let
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
// If get satellites is configured
|
|
1088
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1089
|
-
index += 1
|
|
1090
|
-
satelliteInfo = true
|
|
1091
|
-
}
|
|
1119
|
+
let satelliteInfo = utils.includeSatellites(parsedData[16])
|
|
1120
|
+
let includeStatus = utils.includeStatus(parsedData[16])
|
|
1121
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[16]) ? 3 : 0
|
|
1122
|
+
let index = 16 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1092
1123
|
|
|
1093
1124
|
data = Object.assign(data, {
|
|
1094
1125
|
alarm: utils.getAlarm(command[1], parsedData[4]),
|
|
@@ -1109,77 +1140,80 @@ const parse = raw => {
|
|
|
1109
1140
|
battery: null,
|
|
1110
1141
|
inputCharge: null
|
|
1111
1142
|
},
|
|
1112
|
-
mcc: parsedData[12] !== '' ? utils.latamMcc[parseInt(parsedData[12], 10)] : null,
|
|
1143
|
+
mcc: parsedData[12] !== '' ? utils.latamMcc[parseInt(parsedData[12], 10)] || utils.latamMcc.default : null,
|
|
1113
1144
|
mnc: parsedData[13] !== '' ? utils.getMNC(parsedData[12], parsedData[13]) : null,
|
|
1114
1145
|
lac: parsedData[14] !== '' ? parseInt(parsedData[14], 16) : null,
|
|
1115
1146
|
cid: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
1116
1147
|
satellites:
|
|
1117
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1118
|
-
? parseInt(parsedData[index], 10)
|
|
1148
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1149
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
1119
1150
|
: null,
|
|
1120
|
-
status: includeStatus
|
|
1151
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
1121
1152
|
? {
|
|
1122
|
-
raw: parsedData[index + 1],
|
|
1153
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
1123
1154
|
sos: false,
|
|
1124
1155
|
input: {
|
|
1125
1156
|
'2':
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1157
|
+
utils.nHexDigit(
|
|
1158
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1159
|
+
8
|
|
1160
|
+
)[6] === '1',
|
|
1130
1161
|
'1':
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1162
|
+
utils.nHexDigit(
|
|
1163
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1164
|
+
8
|
|
1165
|
+
)[7] === '1'
|
|
1135
1166
|
},
|
|
1136
1167
|
output: {
|
|
1137
1168
|
'3':
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1169
|
+
utils.nHexDigit(
|
|
1170
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1171
|
+
8
|
|
1172
|
+
)[5] === '1',
|
|
1142
1173
|
'2':
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1174
|
+
utils.nHexDigit(
|
|
1175
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1176
|
+
8
|
|
1177
|
+
)[6] === '1',
|
|
1147
1178
|
'1':
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1179
|
+
utils.nHexDigit(
|
|
1180
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1181
|
+
8
|
|
1182
|
+
)[7] === '1'
|
|
1152
1183
|
},
|
|
1153
1184
|
charge: null,
|
|
1154
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1185
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
1155
1186
|
}
|
|
1156
1187
|
: null,
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
? parseFloat(parsedData[index +
|
|
1160
|
-
: null
|
|
1161
|
-
: parsedData[index + 2] !== ''
|
|
1162
|
-
? parseFloat(parsedData[index + 2])
|
|
1188
|
+
Hdop:
|
|
1189
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1190
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1163
1191
|
: null,
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
?
|
|
1167
|
-
: null
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1192
|
+
Vdop:
|
|
1193
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1194
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1195
|
+
: null,
|
|
1196
|
+
Ddop:
|
|
1197
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1198
|
+
? parseFloat(parsedData[index])
|
|
1199
|
+
: null,
|
|
1200
|
+
hourmeter: parsedData[index + 1] !== ''
|
|
1201
|
+
? parseFloat(parsedData[index + 1])
|
|
1202
|
+
: null,
|
|
1203
|
+
odometer: parsedData[index + 2] !== ''
|
|
1204
|
+
? parseFloat(parsedData[index + 2])
|
|
1205
|
+
: null
|
|
1171
1206
|
})
|
|
1172
|
-
} else if (
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1207
|
+
} else if (
|
|
1208
|
+
command[1] === 'GTIDN' ||
|
|
1209
|
+
command[1] === 'GTIDF' ||
|
|
1210
|
+
command[1] === 'GTSTR' ||
|
|
1211
|
+
command[1] === 'GTSTP' ||
|
|
1212
|
+
command[1] === 'GTLSP') {
|
|
1213
|
+
let satelliteInfo = utils.includeSatellites(parsedData[17])
|
|
1214
|
+
let includeStatus = utils.includeStatus(parsedData[17])
|
|
1215
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[17]) ? 3 : 0
|
|
1216
|
+
let index = 17 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1183
1217
|
|
|
1184
1218
|
data = Object.assign(data, {
|
|
1185
1219
|
alarm: utils.getAlarm(command[1], parsedData[5]),
|
|
@@ -1200,161 +1234,73 @@ const parse = raw => {
|
|
|
1200
1234
|
battery: null,
|
|
1201
1235
|
inputCharge: null
|
|
1202
1236
|
},
|
|
1203
|
-
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] : null,
|
|
1237
|
+
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] || utils.latamMcc.default : null,
|
|
1204
1238
|
mnc: parsedData[14] !== '' ? utils.getMNC(parsedData[13], parsedData[14]) : null,
|
|
1205
1239
|
lac: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
1206
1240
|
cid: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
1207
1241
|
satellites:
|
|
1208
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1209
|
-
? parseInt(parsedData[index], 10)
|
|
1242
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1243
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
1210
1244
|
: null,
|
|
1211
|
-
status: includeStatus
|
|
1245
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
1212
1246
|
? {
|
|
1213
|
-
raw: parsedData[index + 1],
|
|
1247
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
1214
1248
|
sos: false,
|
|
1215
1249
|
input: {
|
|
1216
1250
|
'2':
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1251
|
+
utils.nHexDigit(
|
|
1252
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1253
|
+
8
|
|
1254
|
+
)[6] === '1',
|
|
1221
1255
|
'1':
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1256
|
+
utils.nHexDigit(
|
|
1257
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1258
|
+
8
|
|
1259
|
+
)[7] === '1'
|
|
1226
1260
|
},
|
|
1227
1261
|
output: {
|
|
1228
1262
|
'3':
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1263
|
+
utils.nHexDigit(
|
|
1264
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1265
|
+
8
|
|
1266
|
+
)[5] === '1',
|
|
1233
1267
|
'2':
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1268
|
+
utils.nHexDigit(
|
|
1269
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1270
|
+
8
|
|
1271
|
+
)[6] === '1',
|
|
1238
1272
|
'1':
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1273
|
+
utils.nHexDigit(
|
|
1274
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1275
|
+
8
|
|
1276
|
+
)[7] === '1'
|
|
1243
1277
|
},
|
|
1244
1278
|
charge: null,
|
|
1245
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1279
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
1246
1280
|
}
|
|
1247
1281
|
: null,
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
? parseFloat(parsedData[index +
|
|
1251
|
-
: null
|
|
1252
|
-
: parsedData[index + 1] !== ''
|
|
1253
|
-
? parseFloat(parsedData[index + 1])
|
|
1282
|
+
Hdop:
|
|
1283
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1284
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1254
1285
|
: null,
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
command[1] === 'GTSTR' ||
|
|
1259
|
-
command[1] === 'GTSTP' ||
|
|
1260
|
-
command[1] === 'GTLSP'
|
|
1261
|
-
) {
|
|
1262
|
-
let index = 17 // position append mask
|
|
1263
|
-
let satelliteInfo = false
|
|
1264
|
-
let includeStatus =
|
|
1265
|
-
parsedData[index] !== '' ? parseInt(parsedData[index]) > 3 : null
|
|
1266
|
-
|
|
1267
|
-
// If get satellites is configured
|
|
1268
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1269
|
-
index += 1
|
|
1270
|
-
satelliteInfo = true
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
data = Object.assign(data, {
|
|
1274
|
-
alarm: utils.getAlarm(command[1], null),
|
|
1275
|
-
loc: {
|
|
1276
|
-
type: 'Point',
|
|
1277
|
-
coordinates: [parseFloat(parsedData[10]), parseFloat(parsedData[11])]
|
|
1278
|
-
},
|
|
1279
|
-
speed: parsedData[7] !== '' ? parseFloat(parsedData[7]) : null,
|
|
1280
|
-
gpsStatus: utils.checkGps(
|
|
1281
|
-
parseFloat(parsedData[10]),
|
|
1282
|
-
parseFloat(parsedData[11])
|
|
1283
|
-
),
|
|
1284
|
-
hdop: parsedData[6] !== '' ? parseFloat(parsedData[6]) : null,
|
|
1285
|
-
azimuth: parsedData[8] !== '' ? parseFloat(parsedData[8]) : null,
|
|
1286
|
-
altitude: parsedData[9] !== '' ? parseFloat(parsedData[9]) : null,
|
|
1287
|
-
datetime: parsedData[12] !== '' ? utils.parseDate(parsedData[12]) : null,
|
|
1288
|
-
voltage: {
|
|
1289
|
-
battery: null,
|
|
1290
|
-
inputCharge: null
|
|
1291
|
-
},
|
|
1292
|
-
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] : null,
|
|
1293
|
-
mnc: parsedData[14] !== '' ? utils.getMNC(parsedData[13], parsedData[14]) : null,
|
|
1294
|
-
lac: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
1295
|
-
cid: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
1296
|
-
satellites:
|
|
1297
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1298
|
-
? parseInt(parsedData[index], 10)
|
|
1286
|
+
Vdop:
|
|
1287
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1288
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1299
1289
|
: null,
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
sos: false,
|
|
1304
|
-
input: {
|
|
1305
|
-
'2':
|
|
1306
|
-
utils.nHexDigit(
|
|
1307
|
-
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
1308
|
-
8
|
|
1309
|
-
)[7] === '1',
|
|
1310
|
-
'1':
|
|
1311
|
-
utils.nHexDigit(
|
|
1312
|
-
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
1313
|
-
8
|
|
1314
|
-
)[6] === '1'
|
|
1315
|
-
},
|
|
1316
|
-
output: {
|
|
1317
|
-
'3':
|
|
1318
|
-
utils.nHexDigit(
|
|
1319
|
-
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
1320
|
-
8
|
|
1321
|
-
)[5] === '1',
|
|
1322
|
-
'2':
|
|
1323
|
-
utils.nHexDigit(
|
|
1324
|
-
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
1325
|
-
8
|
|
1326
|
-
)[6] === '1',
|
|
1327
|
-
'1':
|
|
1328
|
-
utils.nHexDigit(
|
|
1329
|
-
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
1330
|
-
8
|
|
1331
|
-
)[7] === '1'
|
|
1332
|
-
},
|
|
1333
|
-
charge: null,
|
|
1334
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1335
|
-
}
|
|
1336
|
-
: null,
|
|
1337
|
-
odometer: includeStatus
|
|
1338
|
-
? parsedData[index + 2] !== ''
|
|
1339
|
-
? parseFloat(parsedData[index + 2])
|
|
1340
|
-
: null
|
|
1341
|
-
: parsedData[index + 1] !== ''
|
|
1342
|
-
? parseFloat(parsedData[index + 1])
|
|
1290
|
+
Ddop:
|
|
1291
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1292
|
+
? parseFloat(parsedData[index])
|
|
1343
1293
|
: null,
|
|
1294
|
+
odometer: parsedData[index + 1] !== ''
|
|
1295
|
+
? parseFloat(parsedData[index + 1])
|
|
1296
|
+
: null,
|
|
1344
1297
|
hourmeter: null
|
|
1345
1298
|
})
|
|
1346
1299
|
} else if (command[1] === 'GTGSS') {
|
|
1347
|
-
|
|
1348
|
-
let
|
|
1349
|
-
let
|
|
1350
|
-
let includeStatus
|
|
1351
|
-
parsedData[index] !== '' ? parseInt(parsedData[index]) > 3 : null
|
|
1352
|
-
|
|
1353
|
-
// If get satellites is configured
|
|
1354
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1355
|
-
index += 1
|
|
1356
|
-
satelliteInfo = true
|
|
1357
|
-
}
|
|
1300
|
+
let satelliteInfo = utils.includeSatellites(parsedData[19])
|
|
1301
|
+
let includeStatus = utils.includeStatus(parsedData[19])
|
|
1302
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[19]) ? 3 : 0
|
|
1303
|
+
let index = 19 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1358
1304
|
|
|
1359
1305
|
data = Object.assign(data, {
|
|
1360
1306
|
alarm: utils.getAlarm(command[1], parsedData[4]),
|
|
@@ -1375,66 +1321,72 @@ const parse = raw => {
|
|
|
1375
1321
|
battery: null,
|
|
1376
1322
|
inputCharge: null
|
|
1377
1323
|
},
|
|
1378
|
-
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] : null,
|
|
1324
|
+
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] || utils.latamMcc.default : null,
|
|
1379
1325
|
mnc: parsedData[16] !== '' ? utils.getMNC(parsedData[15], parsedData[16]) : null,
|
|
1380
1326
|
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
1381
1327
|
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
1382
1328
|
usedSatellites: parsedData[5] !== '' ? parseInt(parsedData[5], 16) : null,
|
|
1383
1329
|
satellites:
|
|
1384
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1385
|
-
? parseInt(parsedData[index], 10)
|
|
1330
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1331
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
1386
1332
|
: null,
|
|
1387
|
-
status: includeStatus
|
|
1333
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
1388
1334
|
? {
|
|
1389
|
-
raw: parsedData[index + 1],
|
|
1335
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
1390
1336
|
sos: false,
|
|
1391
1337
|
input: {
|
|
1392
1338
|
'2':
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1339
|
+
utils.nHexDigit(
|
|
1340
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1341
|
+
8
|
|
1342
|
+
)[6] === '1',
|
|
1397
1343
|
'1':
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1344
|
+
utils.nHexDigit(
|
|
1345
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1346
|
+
8
|
|
1347
|
+
)[7] === '1'
|
|
1402
1348
|
},
|
|
1403
1349
|
output: {
|
|
1404
1350
|
'3':
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1351
|
+
utils.nHexDigit(
|
|
1352
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1353
|
+
8
|
|
1354
|
+
)[5] === '1',
|
|
1409
1355
|
'2':
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1356
|
+
utils.nHexDigit(
|
|
1357
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1358
|
+
8
|
|
1359
|
+
)[6] === '1',
|
|
1414
1360
|
'1':
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1361
|
+
utils.nHexDigit(
|
|
1362
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1363
|
+
8
|
|
1364
|
+
)[7] === '1'
|
|
1419
1365
|
},
|
|
1420
1366
|
charge: null,
|
|
1421
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1367
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
1422
1368
|
}
|
|
1423
1369
|
: null,
|
|
1370
|
+
Hdop:
|
|
1371
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1372
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1373
|
+
: null,
|
|
1374
|
+
Vdop:
|
|
1375
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1376
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1377
|
+
: null,
|
|
1378
|
+
Ddop:
|
|
1379
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1380
|
+
? parseFloat(parsedData[index])
|
|
1381
|
+
: null,
|
|
1424
1382
|
odometer: null,
|
|
1425
1383
|
hourmeter: null
|
|
1426
1384
|
})
|
|
1427
1385
|
} else if (command[1] === 'GTIDA') {
|
|
1428
|
-
|
|
1429
|
-
let
|
|
1430
|
-
let
|
|
1431
|
-
let
|
|
1432
|
-
|
|
1433
|
-
// If get satellites is configured
|
|
1434
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1435
|
-
index += 1
|
|
1436
|
-
satelliteInfo = true
|
|
1437
|
-
}
|
|
1386
|
+
let number = parsedData[7] !== '' ? parseInt(parsedData[7]) : 1
|
|
1387
|
+
let satelliteInfo = utils.includeSatellites(parsedData[19])
|
|
1388
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[19]) ? 3 : 0
|
|
1389
|
+
let index = 7 + (12 + satelliteInfo + accuracyInfo) * number
|
|
1438
1390
|
|
|
1439
1391
|
data = Object.assign(data, {
|
|
1440
1392
|
alarm: utils.getAlarm(command[1], `${parsedData[5]},${parsedData[6]}`),
|
|
@@ -1449,296 +1401,85 @@ const parse = raw => {
|
|
|
1449
1401
|
),
|
|
1450
1402
|
hdop: parsedData[8] !== '' ? parseFloat(parsedData[8]) : null,
|
|
1451
1403
|
status: null,
|
|
1452
|
-
azimuth: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null,
|
|
1453
|
-
altitude: parsedData[11] !== '' ? parseFloat(parsedData[11]) : null,
|
|
1454
|
-
datetime: parsedData[14] !== '' ? utils.parseDate(parsedData[14]) : null,
|
|
1455
|
-
voltage: {
|
|
1456
|
-
battery: null,
|
|
1457
|
-
inputCharge: null
|
|
1458
|
-
},
|
|
1459
|
-
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] : null,
|
|
1460
|
-
mnc: parsedData[16] !== '' ? utils.getMNC(parsedData[15], parsedData[16]) : null,
|
|
1461
|
-
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
1462
|
-
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
1463
|
-
satellites:
|
|
1464
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1465
|
-
? parseInt(parsedData[index], 10)
|
|
1466
|
-
: null,
|
|
1467
|
-
|
|
1468
|
-
parsedData[index + 1] !== ''
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
let
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
:
|
|
1493
|
-
|
|
1494
|
-
parsedData[
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
parsedData[
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
parsedData[
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
azimuth: parsedData[58] !== '' ? parseFloat(parsedData[58]) : null,
|
|
1532
|
-
altitude: parsedData[59] !== '' ? parseFloat(parsedData[59]) : null,
|
|
1533
|
-
datetime: parsedData[62] !== '' ? utils.parseDate(parsedData[62]) : null,
|
|
1534
|
-
voltage: {
|
|
1535
|
-
battery: null,
|
|
1536
|
-
inputCharge: null
|
|
1537
|
-
},
|
|
1538
|
-
mcc: parsedData[63] !== '' ? utils.latamMcc[parseInt(parsedData[63], 10)] : null,
|
|
1539
|
-
mnc: parsedData[64] !== '' ? utils.getMNC(parsedData[63], parsedData[64]) : null,
|
|
1540
|
-
lac: parsedData[65] !== '' ? parseInt(parsedData[65], 16) : null,
|
|
1541
|
-
cid: parsedData[66] !== '' ? parseInt(parsedData[66], 16) : null,
|
|
1542
|
-
satellites:
|
|
1543
|
-
satelliteInfo && parsedData[index]
|
|
1544
|
-
? parseInt(parsedData[index], 10)
|
|
1545
|
-
: null,
|
|
1546
|
-
odometer: null,
|
|
1547
|
-
hourmeter: null,
|
|
1548
|
-
can: {
|
|
1549
|
-
comunicationOk: parsedData[5] === '1',
|
|
1550
|
-
vin: parsedData[7] !== '' ? parsedData[7] : null,
|
|
1551
|
-
ignitionKey: parsedData[8] !== '' ? parseInt(parsedData[8], 10) : null,
|
|
1552
|
-
distance: parsedData[9] !== '' ? parsedData[9] : null,
|
|
1553
|
-
fuelUsed: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null, // float
|
|
1554
|
-
rpm: parsedData[11] !== '' ? parseInt(parsedData[11], 10) : null, // int
|
|
1555
|
-
speed: parsedData[12] !== '' ? parseFloat(parsedData[12]) : null,
|
|
1556
|
-
coolantTemp:
|
|
1557
|
-
parsedData[13] !== '' ? parseInt(parsedData[13], 10) : null,
|
|
1558
|
-
fuelConsumption: parsedData[14] !== '' ? parsedData[14] : null,
|
|
1559
|
-
fuelLevel: parsedData[15] !== '' ? parsedData[15] : null,
|
|
1560
|
-
range: parsedData[16] !== '' ? parsedData[16] : null,
|
|
1561
|
-
acceleratorPressure:
|
|
1562
|
-
parsedData[17] !== '' ? parseFloat(parsedData[17]) : null, // %
|
|
1563
|
-
engineHours: parsedData[18] !== '' ? parseFloat(parsedData[18]) : null,
|
|
1564
|
-
drivingTime: parsedData[19] !== '' ? parseFloat(parsedData[19]) : null,
|
|
1565
|
-
idleTime: parsedData[20] !== '' ? parseFloat(parsedData[20]) : null,
|
|
1566
|
-
idleFuelUsed: parsedData[21] !== '' ? parseFloat(parsedData[21]) : null,
|
|
1567
|
-
axleWight: parsedData[22] !== '' ? parsedData[22] : null,
|
|
1568
|
-
tachograph: {
|
|
1569
|
-
raw: parsedData[23] !== '' ? parsedData[23] : null,
|
|
1570
|
-
validDriverData: tachographBin ? tachographBin[7] === '1' : null,
|
|
1571
|
-
insertedDriverCard: tachographBin ? tachographBin[5] === '1' : null,
|
|
1572
|
-
driverWorkingState: tachographBin
|
|
1573
|
-
? utils.dWorkingStates[parseInt(tachographBin.substring(3, 5), 2)]
|
|
1574
|
-
: null,
|
|
1575
|
-
drivingTimeState: tachographBin
|
|
1576
|
-
? utils.dTimeStates[parseInt(tachographBin.substring(5, 8), 2)]
|
|
1577
|
-
: null
|
|
1578
|
-
},
|
|
1579
|
-
indicators: {
|
|
1580
|
-
raw: parsedData[24] !== '' ? parsedData[24] : null,
|
|
1581
|
-
lowFuel: inicatorsBin ? inicatorsBin[0] === '1' : null,
|
|
1582
|
-
driverSeatbelt: inicatorsBin ? inicatorsBin[1] === '1' : null,
|
|
1583
|
-
airConditioning: inicatorsBin ? inicatorsBin[2] === '1' : null,
|
|
1584
|
-
cruiseControl: inicatorsBin ? inicatorsBin[3] === '1' : null,
|
|
1585
|
-
brakePedal: inicatorsBin ? inicatorsBin[4] === '1' : null,
|
|
1586
|
-
clutchPedal: inicatorsBin ? inicatorsBin[5] === '1' : null,
|
|
1587
|
-
handbrake: inicatorsBin ? inicatorsBin[6] === '1' : null,
|
|
1588
|
-
centralLock: inicatorsBin ? inicatorsBin[7] === '1' : null,
|
|
1589
|
-
reverseGear: inicatorsBin ? inicatorsBin[8] === '1' : null,
|
|
1590
|
-
runningLights: inicatorsBin ? inicatorsBin[9] === '1' : null,
|
|
1591
|
-
lowBeams: inicatorsBin ? inicatorsBin[10] === '1' : null,
|
|
1592
|
-
highBeams: inicatorsBin ? inicatorsBin[11] === '1' : null,
|
|
1593
|
-
rearFogLights: inicatorsBin ? inicatorsBin[12] === '1' : null,
|
|
1594
|
-
frontFogLights: inicatorsBin ? inicatorsBin[13] === '1' : null,
|
|
1595
|
-
doors: inicatorsBin ? inicatorsBin[14] === '1' : null,
|
|
1596
|
-
trunk: inicatorsBin ? inicatorsBin[15] === '1' : null
|
|
1597
|
-
},
|
|
1598
|
-
lights: {
|
|
1599
|
-
raw: parsedData[25] !== '' ? parsedData[25] : null,
|
|
1600
|
-
running: lights ? lights[0] === '1' : null,
|
|
1601
|
-
lowBeams: lights ? lights[1] === '1' : null,
|
|
1602
|
-
frontFog: lights ? lights[2] === '1' : null,
|
|
1603
|
-
rearFog: lights ? lights[3] === '1' : null,
|
|
1604
|
-
hazard: lights ? lights[4] === '1' : null
|
|
1605
|
-
},
|
|
1606
|
-
doors: {
|
|
1607
|
-
raw: parsedData[26] !== '' ? parsedData[26] : null,
|
|
1608
|
-
driver: doors ? doors[0] === '1' : null,
|
|
1609
|
-
passenger: doors ? doors[1] === '1' : null,
|
|
1610
|
-
rearLeft: doors ? doors[2] === '1' : null,
|
|
1611
|
-
rearRight: doors ? doors[3] === '1' : null,
|
|
1612
|
-
trunk: doors ? doors[4] === '1' : null,
|
|
1613
|
-
hood: doors ? doors[5] === '1' : null
|
|
1614
|
-
},
|
|
1615
|
-
overSpeedTime: parsedData[27] !== '' ? parsedData[27] : null,
|
|
1616
|
-
overSpeedEngineTime: parsedData[28] !== '' ? parsedData[28] : null,
|
|
1617
|
-
canReportExpansionMask: {
|
|
1618
|
-
raw: parsedData[29] !== '' ? parsedData[29] : null,
|
|
1619
|
-
engineTorque: canExpansionMask ? canExpansionMask[23] === '1' : null,
|
|
1620
|
-
rapidAccelerations: canExpansionMask
|
|
1621
|
-
? canExpansionMask[22] === '1'
|
|
1622
|
-
: null,
|
|
1623
|
-
rapidBrakings: canExpansionMask ? canExpansionMask[21] === '1' : null,
|
|
1624
|
-
expansionInformation: canExpansionMask
|
|
1625
|
-
? canExpansionMask[20] === '1'
|
|
1626
|
-
: null,
|
|
1627
|
-
registrationNumber: canExpansionMask
|
|
1628
|
-
? canExpansionMask[19] === '1'
|
|
1629
|
-
: null,
|
|
1630
|
-
tachographDriver2Name: canExpansionMask
|
|
1631
|
-
? canExpansionMask[18] === '1'
|
|
1632
|
-
: null,
|
|
1633
|
-
tachographDriver1Name: canExpansionMask
|
|
1634
|
-
? canExpansionMask[17] === '1'
|
|
1635
|
-
: null,
|
|
1636
|
-
tachographDriver2Card: canExpansionMask
|
|
1637
|
-
? canExpansionMask[16] === '1'
|
|
1638
|
-
: null,
|
|
1639
|
-
tachographDriver1Card: canExpansionMask
|
|
1640
|
-
? canExpansionMask[15] === '1'
|
|
1641
|
-
: null,
|
|
1642
|
-
totalBrakeApplications: canExpansionMask
|
|
1643
|
-
? canExpansionMask[14] === '1'
|
|
1644
|
-
: null,
|
|
1645
|
-
totalAcceleratorKickDownTime: canExpansionMask
|
|
1646
|
-
? canExpansionMask[13] === '1'
|
|
1647
|
-
: null,
|
|
1648
|
-
totalCruiseControlTime: canExpansionMask
|
|
1649
|
-
? canExpansionMask[12] === '1'
|
|
1650
|
-
: null,
|
|
1651
|
-
totalEffectiveEngineSpeedTime: canExpansionMask
|
|
1652
|
-
? canExpansionMask[11] === '1'
|
|
1653
|
-
: null,
|
|
1654
|
-
totalAcceleratorKickDown: canExpansionMask
|
|
1655
|
-
? canExpansionMask[10] === '1'
|
|
1656
|
-
: null,
|
|
1657
|
-
pedalBrakingFactor: canExpansionMask
|
|
1658
|
-
? canExpansionMask[9] === '1'
|
|
1659
|
-
: null,
|
|
1660
|
-
engineBrakingFactor: canExpansionMask
|
|
1661
|
-
? canExpansionMask[8] === '1'
|
|
1662
|
-
: null,
|
|
1663
|
-
analogInputValue: canExpansionMask
|
|
1664
|
-
? canExpansionMask[7] === '1'
|
|
1665
|
-
: null,
|
|
1666
|
-
tachographDrivingDirection: canExpansionMask
|
|
1667
|
-
? canExpansionMask[6] === '1'
|
|
1668
|
-
: null,
|
|
1669
|
-
tachographVehicleMotionSignal: canExpansionMask
|
|
1670
|
-
? canExpansionMask[5] === '1'
|
|
1671
|
-
: null,
|
|
1672
|
-
tachographOverspeedSignal: canExpansionMask
|
|
1673
|
-
? canExpansionMask[4] === '1'
|
|
1674
|
-
: null,
|
|
1675
|
-
AxleWeight4: canExpansionMask ? canExpansionMask[3] === '1' : null,
|
|
1676
|
-
AxleWeight3: canExpansionMask ? canExpansionMask[2] === '1' : null,
|
|
1677
|
-
AxleWeight1: canExpansionMask ? canExpansionMask[1] === '1' : null,
|
|
1678
|
-
adBlueLevel: canExpansionMask ? canExpansionMask[0] === '1' : null
|
|
1679
|
-
},
|
|
1680
|
-
canExpanded: {
|
|
1681
|
-
adBlueLevel:
|
|
1682
|
-
parsedData[30] !== '' ? parseFloat(parsedData[30]) : null,
|
|
1683
|
-
axleWeight1: parsedData[31] !== '' ? parseInt(parsedData[31]) : null,
|
|
1684
|
-
axleWeight3: parsedData[32] !== '' ? parseInt(parsedData[32]) : null,
|
|
1685
|
-
axleWeight4: parsedData[33] !== '' ? parseInt(parsedData[33]) : null,
|
|
1686
|
-
tachographOverspeedSignal:
|
|
1687
|
-
parsedData[34] !== '' ? parseInt(parsedData[34]) : null,
|
|
1688
|
-
tachographVehicleMotionSignal:
|
|
1689
|
-
parsedData[35] !== '' ? parseInt(parsedData[35]) : null,
|
|
1690
|
-
tachographDrivingDirection:
|
|
1691
|
-
parsedData[36] !== '' ? parseInt(parsedData[36]) : null,
|
|
1692
|
-
analogInputValue:
|
|
1693
|
-
parsedData[37] !== '' ? parseInt(parsedData[37]) : null,
|
|
1694
|
-
engineBrakingFactor:
|
|
1695
|
-
parsedData[38] !== '' ? parseInt(parsedData[38]) : null,
|
|
1696
|
-
pedalBrakingFactor:
|
|
1697
|
-
parsedData[39] !== '' ? parseInt(parsedData[39]) : null,
|
|
1698
|
-
totalAcceleratorKickDown:
|
|
1699
|
-
parsedData[40] !== '' ? parseInt(parsedData[40]) : null,
|
|
1700
|
-
totalEffectiveEngineSpeedTime:
|
|
1701
|
-
parsedData[41] !== '' ? parseFloat(parsedData[41]) : null,
|
|
1702
|
-
totalCruiseControlTime:
|
|
1703
|
-
parsedData[42] !== '' ? parseFloat(parsedData[42]) : null,
|
|
1704
|
-
totalAcceleratorKickDownTime:
|
|
1705
|
-
parsedData[43] !== '' ? parseFloat(parsedData[43]) : null,
|
|
1706
|
-
totalBrakeApplications:
|
|
1707
|
-
parsedData[44] !== '' ? parseInt(parsedData[44]) : null,
|
|
1708
|
-
tachographDriver1Card:
|
|
1709
|
-
parsedData[45] !== '' ? parseInt(parsedData[45]) : null,
|
|
1710
|
-
tachographDriver2Card:
|
|
1711
|
-
parsedData[46] !== '' ? parseInt(parsedData[46]) : null,
|
|
1712
|
-
tachographDriver1Name: parsedData[47] !== '' ? parsedData[47] : null,
|
|
1713
|
-
tachographDriver2Name: parsedData[48] !== '' ? parsedData[48] : null,
|
|
1714
|
-
registrationNumber:
|
|
1715
|
-
parsedData[49] !== '' ? parseInt(parsedData[49]) : null,
|
|
1716
|
-
expansionInformation: {
|
|
1717
|
-
raw: parsedData[50] !== '' ? parsedData[50] : null,
|
|
1718
|
-
webasto: expansionBin ? expansionBin[0] === '1' : null,
|
|
1719
|
-
brakeFluidLowIndicator: expansionBin
|
|
1720
|
-
? expansionBin[1] === '1'
|
|
1721
|
-
: null,
|
|
1722
|
-
coolantLevelLowIndicator: expansionBin
|
|
1723
|
-
? expansionBin[2] === '1'
|
|
1724
|
-
: null,
|
|
1725
|
-
batteryIndicator: expansionBin ? expansionBin[3] === '1' : null,
|
|
1726
|
-
brakeSystemaFailureIndicator: expansionBin
|
|
1727
|
-
? expansionBin[4] === '1'
|
|
1728
|
-
: null,
|
|
1729
|
-
oilPressureIndicator: expansionBin ? expansionBin[5] === '1' : null,
|
|
1730
|
-
engineHotIndicator: expansionBin ? expansionBin[6] === '1' : null,
|
|
1731
|
-
ABSFailureIndicator: expansionBin ? expansionBin[7] === '1' : null,
|
|
1732
|
-
checkEngineIndicator: expansionBin ? expansionBin[9] === '1' : null,
|
|
1733
|
-
aribagsIndicator: expansionBin ? expansionBin[10] === '1' : null,
|
|
1734
|
-
serviceCallIndicator: expansionBin
|
|
1735
|
-
? expansionBin[11] === '1'
|
|
1736
|
-
: null,
|
|
1737
|
-
oilLevelLowIndicator: expansionBin ? expansionBin[12] === '1' : null
|
|
1738
|
-
},
|
|
1739
|
-
adblueLevel: parsedData[30] !== '' ? parsedData[30] : null
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1404
|
+
azimuth: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null,
|
|
1405
|
+
altitude: parsedData[11] !== '' ? parseFloat(parsedData[11]) : null,
|
|
1406
|
+
datetime: parsedData[14] !== '' ? utils.parseDate(parsedData[14]) : null,
|
|
1407
|
+
voltage: {
|
|
1408
|
+
battery: null,
|
|
1409
|
+
inputCharge: null
|
|
1410
|
+
},
|
|
1411
|
+
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] || utils.latamMcc.default : null,
|
|
1412
|
+
mnc: parsedData[16] !== '' ? utils.getMNC(parsedData[15], parsedData[16]) : null,
|
|
1413
|
+
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
1414
|
+
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
1415
|
+
satellites:
|
|
1416
|
+
satelliteInfo && parsedData[index - (satelliteInfo + accuracyInfo) + 1] !== ''
|
|
1417
|
+
? parseInt(parsedData[index - (satelliteInfo + accuracyInfo) + 1], 10)
|
|
1418
|
+
: null,
|
|
1419
|
+
Hdop:
|
|
1420
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1421
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1], 10)
|
|
1422
|
+
: null,
|
|
1423
|
+
Vdop:
|
|
1424
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1425
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2], 10)
|
|
1426
|
+
: null,
|
|
1427
|
+
Ddop:
|
|
1428
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1429
|
+
? parseFloat(parsedData[index], 10)
|
|
1430
|
+
: null,
|
|
1431
|
+
odometer:
|
|
1432
|
+
parsedData[index + 1] !== '' ? parseFloat(parsedData[index + 1]) : null,
|
|
1433
|
+
hourmeter: null
|
|
1434
|
+
})
|
|
1435
|
+
} else if (command[1] === 'GTCAN') {
|
|
1436
|
+
let satelliteInfo = utils.includeSatellites(parsedData[67])
|
|
1437
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[67]) ? 3 : 0
|
|
1438
|
+
let index = 67 + (satelliteInfo + accuracyInfo)
|
|
1439
|
+
|
|
1440
|
+
data = Object.assign(data, {
|
|
1441
|
+
alarm: utils.getAlarm(command[1], parsedData[4]),
|
|
1442
|
+
loc: {
|
|
1443
|
+
type: 'Point',
|
|
1444
|
+
coordinates: [parseFloat(parsedData[60]), parseFloat(parsedData[61])]
|
|
1445
|
+
},
|
|
1446
|
+
speed: parsedData[57] !== '' ? parseFloat(parsedData[57]) : null,
|
|
1447
|
+
gpsStatus: utils.checkGps(
|
|
1448
|
+
parseFloat(parsedData[60]),
|
|
1449
|
+
parseFloat(parsedData[61])
|
|
1450
|
+
),
|
|
1451
|
+
hdop: parsedData[56] !== '' ? parseFloat(parsedData[56]) : null,
|
|
1452
|
+
status: null,
|
|
1453
|
+
azimuth: parsedData[58] !== '' ? parseFloat(parsedData[58]) : null,
|
|
1454
|
+
altitude: parsedData[59] !== '' ? parseFloat(parsedData[59]) : null,
|
|
1455
|
+
datetime: parsedData[62] !== '' ? utils.parseDate(parsedData[62]) : null,
|
|
1456
|
+
voltage: {
|
|
1457
|
+
battery: null,
|
|
1458
|
+
inputCharge: null
|
|
1459
|
+
},
|
|
1460
|
+
mcc: parsedData[63] !== '' ? utils.latamMcc[parseInt(parsedData[63], 10)] || utils.latamMcc.default : null,
|
|
1461
|
+
mnc: parsedData[64] !== '' ? utils.getMNC(parsedData[63], parsedData[64]) : null,
|
|
1462
|
+
lac: parsedData[65] !== '' ? parseInt(parsedData[65], 16) : null,
|
|
1463
|
+
cid: parsedData[66] !== '' ? parseInt(parsedData[66], 16) : null,
|
|
1464
|
+
satellites:
|
|
1465
|
+
satelliteInfo && parsedData[index - (satelliteInfo + accuracyInfo) + 1] !== ''
|
|
1466
|
+
? parseInt(parsedData[index - (satelliteInfo + accuracyInfo) + 1], 10)
|
|
1467
|
+
: null,
|
|
1468
|
+
Hdop:
|
|
1469
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1470
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1], 10)
|
|
1471
|
+
: null,
|
|
1472
|
+
Vdop:
|
|
1473
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1474
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2], 10)
|
|
1475
|
+
: null,
|
|
1476
|
+
Ddop:
|
|
1477
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1478
|
+
? parseFloat(parsedData[index], 10)
|
|
1479
|
+
: null,
|
|
1480
|
+
odometer: null,
|
|
1481
|
+
hourmeter: null,
|
|
1482
|
+
can: utils.getCanData(parsedData, 5),
|
|
1742
1483
|
})
|
|
1743
1484
|
} else if (command[1] === 'GTDAT') {
|
|
1744
1485
|
let dataIndex = 4
|
|
@@ -1749,14 +1490,9 @@ const parse = raw => {
|
|
|
1749
1490
|
})
|
|
1750
1491
|
} else {
|
|
1751
1492
|
dataIndex = 7
|
|
1752
|
-
let
|
|
1753
|
-
let
|
|
1754
|
-
|
|
1755
|
-
// If get satellites is configured
|
|
1756
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1757
|
-
index += 1
|
|
1758
|
-
satelliteInfo = true
|
|
1759
|
-
}
|
|
1493
|
+
let satelliteInfo = utils.includeSatellites(parsedData[19])
|
|
1494
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[19]) ? 3 : 0
|
|
1495
|
+
let index = 19 + (satelliteInfo + accuracyInfo)
|
|
1760
1496
|
|
|
1761
1497
|
data = Object.assign(data, {
|
|
1762
1498
|
loc: {
|
|
@@ -1781,13 +1517,25 @@ const parse = raw => {
|
|
|
1781
1517
|
adb: null,
|
|
1782
1518
|
adc: null
|
|
1783
1519
|
},
|
|
1784
|
-
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] : null,
|
|
1520
|
+
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] || utils.latamMcc.default : null,
|
|
1785
1521
|
mnc: parsedData[16] !== '' ? utils.getMNC(parsedData[15], parsedData[16]) : null,
|
|
1786
1522
|
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
1787
1523
|
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
1788
1524
|
satellites:
|
|
1789
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1790
|
-
? parseInt(parsedData[index], 10)
|
|
1525
|
+
satelliteInfo && parsedData[index - (satelliteInfo + accuracyInfo) + 1] !== ''
|
|
1526
|
+
? parseInt(parsedData[index - (satelliteInfo + accuracyInfo) + 1], 10)
|
|
1527
|
+
: null,
|
|
1528
|
+
Hdop:
|
|
1529
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1530
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1], 10)
|
|
1531
|
+
: null,
|
|
1532
|
+
Vdop:
|
|
1533
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1534
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2], 10)
|
|
1535
|
+
: null,
|
|
1536
|
+
Ddop:
|
|
1537
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1538
|
+
? parseFloat(parsedData[index], 10)
|
|
1791
1539
|
: null,
|
|
1792
1540
|
odometer: null,
|
|
1793
1541
|
hourmeter: null
|
|
@@ -1798,16 +1546,10 @@ const parse = raw => {
|
|
|
1798
1546
|
alarm: utils.getAlarm(command[1], parsedData[dataIndex])
|
|
1799
1547
|
})
|
|
1800
1548
|
} else if (command[1] === 'GTDOS') {
|
|
1801
|
-
let
|
|
1802
|
-
let
|
|
1803
|
-
let
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
// If get satellites is configured
|
|
1807
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1808
|
-
index += 1
|
|
1809
|
-
satelliteInfo = true
|
|
1810
|
-
}
|
|
1549
|
+
let satelliteInfo = utils.includeSatellites(parsedData[17])
|
|
1550
|
+
let includeStatus = utils.includeStatus(parsedData[17])
|
|
1551
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[17]) ? 3 : 0
|
|
1552
|
+
let index = 17 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1811
1553
|
|
|
1812
1554
|
data = Object.assign(data, {
|
|
1813
1555
|
alarm: utils.getAlarm(command[1], `${parsedData[4]},${parsedData[5]}`),
|
|
@@ -1828,66 +1570,72 @@ const parse = raw => {
|
|
|
1828
1570
|
battery: null,
|
|
1829
1571
|
inputCharge: null
|
|
1830
1572
|
},
|
|
1831
|
-
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] : null,
|
|
1573
|
+
mcc: parsedData[13] !== '' ? utils.latamMcc[parseInt(parsedData[13], 10)] || utils.latamMcc.default : null,
|
|
1832
1574
|
mnc: parsedData[14] !== '' ? utils.getMNC(parsedData[13], parsedData[14]) : null,
|
|
1833
1575
|
lac: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
1834
1576
|
cid: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
1835
1577
|
satellites:
|
|
1836
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1837
|
-
? parseInt(parsedData[index], 10)
|
|
1578
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1579
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
1838
1580
|
: null,
|
|
1839
|
-
status: includeStatus
|
|
1581
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
1840
1582
|
? {
|
|
1841
|
-
raw: parsedData[index + 1],
|
|
1583
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
1842
1584
|
sos: false,
|
|
1843
1585
|
input: {
|
|
1844
1586
|
'2':
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1587
|
+
utils.nHexDigit(
|
|
1588
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1589
|
+
8
|
|
1590
|
+
)[6] === '1',
|
|
1849
1591
|
'1':
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1592
|
+
utils.nHexDigit(
|
|
1593
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1594
|
+
8
|
|
1595
|
+
)[7] === '1'
|
|
1854
1596
|
},
|
|
1855
1597
|
output: {
|
|
1856
1598
|
'3':
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1599
|
+
utils.nHexDigit(
|
|
1600
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1601
|
+
8
|
|
1602
|
+
)[5] === '1',
|
|
1861
1603
|
'2':
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1604
|
+
utils.nHexDigit(
|
|
1605
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1606
|
+
8
|
|
1607
|
+
)[6] === '1',
|
|
1866
1608
|
'1':
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1609
|
+
utils.nHexDigit(
|
|
1610
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1611
|
+
8
|
|
1612
|
+
)[7] === '1'
|
|
1871
1613
|
},
|
|
1872
1614
|
charge: null,
|
|
1873
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1615
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
1874
1616
|
}
|
|
1875
1617
|
: null,
|
|
1618
|
+
Hdop:
|
|
1619
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1620
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1621
|
+
: null,
|
|
1622
|
+
Vdop:
|
|
1623
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1624
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1625
|
+
: null,
|
|
1626
|
+
Ddop:
|
|
1627
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1628
|
+
? parseFloat(parsedData[index])
|
|
1629
|
+
: null,
|
|
1876
1630
|
odometer: null,
|
|
1877
1631
|
hourmeter: null
|
|
1878
1632
|
})
|
|
1879
1633
|
} else if (command[1] === 'GTDOM') {
|
|
1880
1634
|
// Waveform beeing monitored
|
|
1881
|
-
let
|
|
1882
|
-
let
|
|
1883
|
-
let
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
// If get satellites is configured
|
|
1887
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1888
|
-
index += 1
|
|
1889
|
-
satelliteInfo = true
|
|
1890
|
-
}
|
|
1635
|
+
let satelliteInfo = utils.includeSatellites(parsedData[18])
|
|
1636
|
+
let includeStatus = utils.includeStatus(parsedData[18])
|
|
1637
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[18]) ? 3 : 0
|
|
1638
|
+
let index = 18 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1891
1639
|
|
|
1892
1640
|
data = Object.assign(data, {
|
|
1893
1641
|
alarm: utils.getAlarm(command[1], [parsedData[4], parsedData[5]]),
|
|
@@ -1908,51 +1656,63 @@ const parse = raw => {
|
|
|
1908
1656
|
battery: null,
|
|
1909
1657
|
inputCharge: null
|
|
1910
1658
|
},
|
|
1911
|
-
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] : null,
|
|
1659
|
+
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] || utils.latamMcc.default : null,
|
|
1912
1660
|
mnc: parsedData[15] !== '' ? utils.getMNC(parsedData[14], parsedData[15]) : null,
|
|
1913
1661
|
lac: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
1914
1662
|
cid: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
1915
1663
|
satellites:
|
|
1916
|
-
satelliteInfo && parsedData[index] !== ''
|
|
1917
|
-
? parseInt(parsedData[index], 10)
|
|
1664
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1665
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
1918
1666
|
: null,
|
|
1919
|
-
status: includeStatus
|
|
1667
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
1920
1668
|
? {
|
|
1921
|
-
raw: parsedData[index + 1],
|
|
1669
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
1922
1670
|
sos: false,
|
|
1923
1671
|
input: {
|
|
1924
1672
|
'2':
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1673
|
+
utils.nHexDigit(
|
|
1674
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1675
|
+
8
|
|
1676
|
+
)[6] === '1',
|
|
1929
1677
|
'1':
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1678
|
+
utils.nHexDigit(
|
|
1679
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1680
|
+
8
|
|
1681
|
+
)[7] === '1'
|
|
1934
1682
|
},
|
|
1935
1683
|
output: {
|
|
1936
1684
|
'3':
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1685
|
+
utils.nHexDigit(
|
|
1686
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1687
|
+
8
|
|
1688
|
+
)[5] === '1',
|
|
1941
1689
|
'2':
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1690
|
+
utils.nHexDigit(
|
|
1691
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1692
|
+
8
|
|
1693
|
+
)[6] === '1',
|
|
1946
1694
|
'1':
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1695
|
+
utils.nHexDigit(
|
|
1696
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1697
|
+
8
|
|
1698
|
+
)[7] === '1'
|
|
1951
1699
|
},
|
|
1952
1700
|
charge: null,
|
|
1953
|
-
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
1701
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
1954
1702
|
}
|
|
1955
1703
|
: null,
|
|
1704
|
+
Hdop:
|
|
1705
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1706
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1707
|
+
: null,
|
|
1708
|
+
Vdop:
|
|
1709
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1710
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1711
|
+
: null,
|
|
1712
|
+
Ddop:
|
|
1713
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1714
|
+
? parseFloat(parsedData[index])
|
|
1715
|
+
: null,
|
|
1956
1716
|
odometer: null,
|
|
1957
1717
|
hourmeter: null
|
|
1958
1718
|
})
|
|
@@ -1966,16 +1726,10 @@ const parse = raw => {
|
|
|
1966
1726
|
})
|
|
1967
1727
|
} else if (command[1] === 'GTBCS' || command[1] === 'GTBDS') {
|
|
1968
1728
|
// Bluetooth connection/desconnection
|
|
1969
|
-
let
|
|
1970
|
-
let
|
|
1971
|
-
let
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
// If get satellites is configured
|
|
1975
|
-
if (utils.includeSatellites(parsedData[index])) {
|
|
1976
|
-
index = includeStatus ? index + 2 : index + 1
|
|
1977
|
-
satelliteInfo = true
|
|
1978
|
-
}
|
|
1729
|
+
let satelliteInfo = utils.includeSatellites(parsedData[16])
|
|
1730
|
+
let includeStatus = utils.includeStatus(parsedData[16])
|
|
1731
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[16]) ? 3 : 0
|
|
1732
|
+
let index = 16 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1979
1733
|
|
|
1980
1734
|
data = Object.assign(data, {
|
|
1981
1735
|
alarm: utils.getAlarm(command[1], null, 'gv58lau'),
|
|
@@ -1996,54 +1750,63 @@ const parse = raw => {
|
|
|
1996
1750
|
battery: null,
|
|
1997
1751
|
inputCharge: null
|
|
1998
1752
|
},
|
|
1999
|
-
mcc: parsedData[12] !== '' ? utils.latamMcc[parseInt(parsedData[12], 10)] : null,
|
|
1753
|
+
mcc: parsedData[12] !== '' ? utils.latamMcc[parseInt(parsedData[12], 10)] || utils.latamMcc.default : null,
|
|
2000
1754
|
mnc: parsedData[13] !== '' ? utils.getMNC(parsedData[12], parsedData[13]) : null,
|
|
2001
1755
|
lac: parsedData[14] !== '' ? parseInt(parsedData[14], 16) : null,
|
|
2002
1756
|
cid: parsedData[15] !== '' ? parseInt(parsedData[15], 16) : null,
|
|
2003
|
-
satellites:
|
|
2004
|
-
|
|
2005
|
-
? parseInt(parsedData[index - 1])
|
|
2006
|
-
: null
|
|
2007
|
-
: satelliteInfo && parsedData[index] !== ''
|
|
2008
|
-
? parseInt(parsedData[index])
|
|
1757
|
+
satellites:
|
|
1758
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1759
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
2009
1760
|
: null,
|
|
2010
|
-
status: includeStatus
|
|
1761
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
2011
1762
|
? {
|
|
2012
|
-
raw: parsedData[index],
|
|
1763
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
2013
1764
|
sos: false,
|
|
2014
1765
|
input: {
|
|
2015
1766
|
'2':
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
1767
|
+
utils.nHexDigit(
|
|
1768
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1769
|
+
8
|
|
1770
|
+
)[6] === '1',
|
|
2020
1771
|
'1':
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
1772
|
+
utils.nHexDigit(
|
|
1773
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1774
|
+
8
|
|
1775
|
+
)[7] === '1'
|
|
2025
1776
|
},
|
|
2026
1777
|
output: {
|
|
2027
1778
|
'3':
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1779
|
+
utils.nHexDigit(
|
|
1780
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1781
|
+
8
|
|
1782
|
+
)[5] === '1',
|
|
2032
1783
|
'2':
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
1784
|
+
utils.nHexDigit(
|
|
1785
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1786
|
+
8
|
|
1787
|
+
)[6] === '1',
|
|
2037
1788
|
'1':
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
1789
|
+
utils.nHexDigit(
|
|
1790
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1791
|
+
8
|
|
1792
|
+
)[7] === '1'
|
|
2042
1793
|
},
|
|
2043
1794
|
charge: null,
|
|
2044
|
-
state: utils.states[parsedData[index].substring(0, 2)]
|
|
1795
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
2045
1796
|
}
|
|
2046
1797
|
: null,
|
|
1798
|
+
Hdop:
|
|
1799
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1800
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1801
|
+
: null,
|
|
1802
|
+
Vdop:
|
|
1803
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
1804
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
1805
|
+
: null,
|
|
1806
|
+
Ddop:
|
|
1807
|
+
accuracyInfo && parsedData[index] !== ''
|
|
1808
|
+
? parseFloat(parsedData[index])
|
|
1809
|
+
: null,
|
|
2047
1810
|
odometer: null,
|
|
2048
1811
|
hourmeter: null,
|
|
2049
1812
|
bluetooth: {
|
|
@@ -2052,13 +1815,13 @@ const parse = raw => {
|
|
|
2052
1815
|
bluetoothInfo: {
|
|
2053
1816
|
name:
|
|
2054
1817
|
parsedData[index + 2] !== '' &&
|
|
2055
|
-
|
|
1818
|
+
utils.nHexDigit(utils.hex2bin(parsedData[index + 1]), 16)[15] ===
|
|
2056
1819
|
'1'
|
|
2057
1820
|
? parsedData[index + 2]
|
|
2058
1821
|
: null,
|
|
2059
1822
|
mac:
|
|
2060
1823
|
parsedData[index + 3] !== '' &&
|
|
2061
|
-
|
|
1824
|
+
utils.nHexDigit(utils.hex2bin(parsedData[index + 1]), 16)[14] ===
|
|
2062
1825
|
'1'
|
|
2063
1826
|
? parsedData[index + 3]
|
|
2064
1827
|
: null
|
|
@@ -2069,17 +1832,17 @@ const parse = raw => {
|
|
|
2069
1832
|
name: null,
|
|
2070
1833
|
role:
|
|
2071
1834
|
parsedData[index + 4] !== '' &&
|
|
2072
|
-
|
|
1835
|
+
utils.nHexDigit(utils.hex2bin(parsedData[index + 1]), 16)[7] === '1'
|
|
2073
1836
|
? utils.peerRoles[parsedData[index + 4]]
|
|
2074
1837
|
: null,
|
|
2075
1838
|
type:
|
|
2076
1839
|
parsedData[index + 5] !== '' &&
|
|
2077
|
-
|
|
1840
|
+
utils.nHexDigit(utils.hex2bin(parsedData[index + 1]), 16)[5] === '1'
|
|
2078
1841
|
? utils.peerAddressesTypes[parsedData[index + 5]]
|
|
2079
1842
|
: null,
|
|
2080
1843
|
mac:
|
|
2081
1844
|
parsedData[index + 6] !== '' &&
|
|
2082
|
-
|
|
1845
|
+
utils.nHexDigit(utils.hex2bin(parsedData[index + 1]), 16)[4] === '1'
|
|
2083
1846
|
? parsedData[index + 6]
|
|
2084
1847
|
: null
|
|
2085
1848
|
},
|
|
@@ -2109,7 +1872,6 @@ const parse = raw => {
|
|
|
2109
1872
|
})
|
|
2110
1873
|
} else if (command[1] === 'GTBAA') {
|
|
2111
1874
|
// Bluetooth alarms
|
|
2112
|
-
let satelliteInfo = false
|
|
2113
1875
|
let appendIx = 8
|
|
2114
1876
|
let appendMask = utils.nHexDigit(utils.hex2bin(parsedData[appendIx]), 16)
|
|
2115
1877
|
let btAccessory = parsedData[5]
|
|
@@ -2132,16 +1894,11 @@ const parse = raw => {
|
|
|
2132
1894
|
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
2133
1895
|
|
|
2134
1896
|
let newIndex = appendMask[1] === '1' ? relIx + 2 : relIx + 1
|
|
2135
|
-
let satIndex = newIndex + 11
|
|
2136
1897
|
|
|
2137
|
-
let
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
if (utils.includeSatellites(parsedData[satIndex])) {
|
|
2142
|
-
satIndex += 1
|
|
2143
|
-
satelliteInfo = true
|
|
2144
|
-
}
|
|
1898
|
+
let satelliteInfo = utils.includeSatellites(parsedData[newIndex + 11])
|
|
1899
|
+
let includeStatus = utils.includeStatus(parsedData[newIndex + 11])
|
|
1900
|
+
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[newIndex + 11]) ? 3 : 0
|
|
1901
|
+
let index = newIndex + 11 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
2145
1902
|
|
|
2146
1903
|
data = Object.assign(data, {
|
|
2147
1904
|
alarm: utils.getAlarm(command[1], parsedData[7], 'gv58lau'),
|
|
@@ -2195,46 +1952,58 @@ const parse = raw => {
|
|
|
2195
1952
|
? parseInt(parsedData[newIndex + 10], 16)
|
|
2196
1953
|
: null,
|
|
2197
1954
|
satellites:
|
|
2198
|
-
satelliteInfo && parsedData[
|
|
2199
|
-
? parseInt(parsedData[
|
|
1955
|
+
satelliteInfo && parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1] !== ''
|
|
1956
|
+
? parseInt(parsedData[index - (satelliteInfo + includeStatus + accuracyInfo) + 1], 10)
|
|
2200
1957
|
: null,
|
|
2201
|
-
status: includeStatus
|
|
1958
|
+
status: includeStatus && parsedData[index - (includeStatus + accuracyInfo) + 1]
|
|
2202
1959
|
? {
|
|
2203
|
-
raw: parsedData[
|
|
1960
|
+
raw: parsedData[index - (includeStatus + accuracyInfo) + 1],
|
|
2204
1961
|
sos: false,
|
|
2205
1962
|
input: {
|
|
2206
1963
|
'2':
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
1964
|
+
utils.nHexDigit(
|
|
1965
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1966
|
+
8
|
|
1967
|
+
)[6] === '1',
|
|
2211
1968
|
'1':
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
1969
|
+
utils.nHexDigit(
|
|
1970
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(2, 4)),
|
|
1971
|
+
8
|
|
1972
|
+
)[7] === '1'
|
|
2216
1973
|
},
|
|
2217
1974
|
output: {
|
|
2218
1975
|
'3':
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
1976
|
+
utils.nHexDigit(
|
|
1977
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1978
|
+
8
|
|
1979
|
+
)[5] === '1',
|
|
2223
1980
|
'2':
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
1981
|
+
utils.nHexDigit(
|
|
1982
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1983
|
+
8
|
|
1984
|
+
)[6] === '1',
|
|
2228
1985
|
'1':
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
1986
|
+
utils.nHexDigit(
|
|
1987
|
+
utils.hex2bin(parsedData[index - (includeStatus + accuracyInfo) + 1].substring(4, 6)),
|
|
1988
|
+
8
|
|
1989
|
+
)[7] === '1'
|
|
2233
1990
|
},
|
|
2234
1991
|
charge: null,
|
|
2235
|
-
state: utils.states[parsedData[
|
|
1992
|
+
state: utils.states[parsedData[index - (includeStatus + accuracyInfo) + 1].substring(0, 2)]
|
|
2236
1993
|
}
|
|
2237
1994
|
: null,
|
|
1995
|
+
Hdop:
|
|
1996
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 1] !== ''
|
|
1997
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 1])
|
|
1998
|
+
: null,
|
|
1999
|
+
Vdop:
|
|
2000
|
+
accuracyInfo && parsedData[index - (accuracyInfo) + 2] !== ''
|
|
2001
|
+
? parseFloat(parsedData[index - (accuracyInfo) + 2])
|
|
2002
|
+
: null,
|
|
2003
|
+
Ddop:
|
|
2004
|
+
accuracyInfo && parsedData[index] !== ''
|
|
2005
|
+
? parseFloat(parsedData[index])
|
|
2006
|
+
: null,
|
|
2238
2007
|
odometer: null,
|
|
2239
2008
|
hourmeter: null,
|
|
2240
2009
|
bluetooth: {
|
|
@@ -2449,29 +2218,29 @@ const parse = raw => {
|
|
|
2449
2218
|
appendMask[0] === '1' && parsedData[typeIx + 1] !== ''
|
|
2450
2219
|
? {
|
|
2451
2220
|
idMfrData:
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2221
|
+
parsedData[typeIx] === '0' && parsedData[typeIx + 1] !== ''
|
|
2222
|
+
? parsedData[typeIx + 1]
|
|
2223
|
+
: null,
|
|
2455
2224
|
uuid:
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2225
|
+
parsedData[typeIx] === '1' && parsedData[typeIx + 1] !== ''
|
|
2226
|
+
? parsedData[typeIx + 1]
|
|
2227
|
+
: null,
|
|
2459
2228
|
major:
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2229
|
+
parsedData[typeIx] === '1' && parsedData[typeIx + 2] !== ''
|
|
2230
|
+
? parsedData[typeIx + 2]
|
|
2231
|
+
: null,
|
|
2463
2232
|
minor:
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2233
|
+
parsedData[typeIx] === '1' && parsedData[typeIx + 3] !== ''
|
|
2234
|
+
? parsedData[typeIx + 3]
|
|
2235
|
+
: null,
|
|
2467
2236
|
nid:
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2237
|
+
parsedData[typeIx] === '2' && parsedData[typeIx + 1] !== ''
|
|
2238
|
+
? parsedData[typeIx + 1]
|
|
2239
|
+
: null,
|
|
2471
2240
|
bid:
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2241
|
+
parsedData[typeIx] === '2' && parsedData[typeIx + 2] !== ''
|
|
2242
|
+
? parsedData[typeIx + 2]
|
|
2243
|
+
: null
|
|
2475
2244
|
}
|
|
2476
2245
|
: null
|
|
2477
2246
|
})
|
|
@@ -2521,7 +2290,7 @@ const parse = raw => {
|
|
|
2521
2290
|
battery: null,
|
|
2522
2291
|
inputCharge: null
|
|
2523
2292
|
},
|
|
2524
|
-
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] : null,
|
|
2293
|
+
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] || utils.latamMcc.default : null,
|
|
2525
2294
|
mnc: parsedData[15] !== '' ? utils.getMNC(parsedData[14], parsedData[15]) : null,
|
|
2526
2295
|
lac: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
2527
2296
|
cid: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
@@ -2535,32 +2304,32 @@ const parse = raw => {
|
|
|
2535
2304
|
sos: false,
|
|
2536
2305
|
input: {
|
|
2537
2306
|
'2':
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2307
|
+
utils.nHexDigit(
|
|
2308
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
2309
|
+
8
|
|
2310
|
+
)[6] === '1',
|
|
2542
2311
|
'1':
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2312
|
+
utils.nHexDigit(
|
|
2313
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
2314
|
+
8
|
|
2315
|
+
)[7] === '1'
|
|
2547
2316
|
},
|
|
2548
2317
|
output: {
|
|
2549
2318
|
'3':
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2319
|
+
utils.nHexDigit(
|
|
2320
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2321
|
+
8
|
|
2322
|
+
)[5] === '1',
|
|
2554
2323
|
'2':
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2324
|
+
utils.nHexDigit(
|
|
2325
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2326
|
+
8
|
|
2327
|
+
)[6] === '1',
|
|
2559
2328
|
'1':
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2329
|
+
utils.nHexDigit(
|
|
2330
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2331
|
+
8
|
|
2332
|
+
)[7] === '1'
|
|
2564
2333
|
},
|
|
2565
2334
|
charge: null,
|
|
2566
2335
|
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
@@ -2597,12 +2366,12 @@ const parse = raw => {
|
|
|
2597
2366
|
: null,
|
|
2598
2367
|
lac:
|
|
2599
2368
|
parsedData[index + 2] !== '' ||
|
|
2600
|
-
|
|
2369
|
+
parsedData[index + 2].toUpperCase() === 'FFFF'
|
|
2601
2370
|
? parseInt(parsedData[index + 2], 16)
|
|
2602
2371
|
: null,
|
|
2603
2372
|
cid:
|
|
2604
2373
|
parsedData[index + 3] !== '' ||
|
|
2605
|
-
|
|
2374
|
+
parsedData[index + 3].toUpperCase() === 'FFFF'
|
|
2606
2375
|
? parseInt(parsedData[index + 3], 16)
|
|
2607
2376
|
: null,
|
|
2608
2377
|
rxLevel:
|
|
@@ -2631,12 +2400,12 @@ const parse = raw => {
|
|
|
2631
2400
|
: null,
|
|
2632
2401
|
lac:
|
|
2633
2402
|
parsedData[index + 2] !== '' ||
|
|
2634
|
-
|
|
2403
|
+
parsedData[index + 2].toUpperCase() === 'FFFF'
|
|
2635
2404
|
? parseInt(parsedData[index + 2], 16)
|
|
2636
2405
|
: null,
|
|
2637
2406
|
cid:
|
|
2638
2407
|
parsedData[index + 3] !== '' ||
|
|
2639
|
-
|
|
2408
|
+
parsedData[index + 3].toUpperCase() === 'FFFF'
|
|
2640
2409
|
? parseInt(parsedData[index + 3], 16)
|
|
2641
2410
|
: null,
|
|
2642
2411
|
rxLevel:
|
|
@@ -2741,7 +2510,7 @@ const parse = raw => {
|
|
|
2741
2510
|
azimuth: parsedData[62] !== '' ? parseFloat(parsedData[62]) : null,
|
|
2742
2511
|
altitude: parsedData[63] !== '' ? parseFloat(parsedData[63]) : null,
|
|
2743
2512
|
datetime: parsedData[66] !== '' ? utils.parseDate(parsedData[66]) : null,
|
|
2744
|
-
mcc: parsedData[67] !== '' ? utils.latamMcc[parseInt(parsedData[67], 10)] : null,
|
|
2513
|
+
mcc: parsedData[67] !== '' ? utils.latamMcc[parseInt(parsedData[67], 10)] || utils.latamMcc.default : null,
|
|
2745
2514
|
mnc: parsedData[68] !== '' ? utils.getMNC(parsedData[67], parsedData[68]) : null,
|
|
2746
2515
|
lac: parsedData[69] !== '' ? parseInt(parsedData[69], 16) : null,
|
|
2747
2516
|
cid: parsedData[70] !== '' ? parseInt(parsedData[70], 16) : null,
|
|
@@ -2755,32 +2524,32 @@ const parse = raw => {
|
|
|
2755
2524
|
sos: false,
|
|
2756
2525
|
input: {
|
|
2757
2526
|
'2':
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2527
|
+
utils.nHexDigit(
|
|
2528
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
2529
|
+
8
|
|
2530
|
+
)[6] === '1',
|
|
2762
2531
|
'1':
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2532
|
+
utils.nHexDigit(
|
|
2533
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
2534
|
+
8
|
|
2535
|
+
)[7] === '1'
|
|
2767
2536
|
},
|
|
2768
2537
|
output: {
|
|
2769
2538
|
'3':
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2539
|
+
utils.nHexDigit(
|
|
2540
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2541
|
+
8
|
|
2542
|
+
)[5] === '1',
|
|
2774
2543
|
'2':
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2544
|
+
utils.nHexDigit(
|
|
2545
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2546
|
+
8
|
|
2547
|
+
)[6] === '1',
|
|
2779
2548
|
'1':
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2549
|
+
utils.nHexDigit(
|
|
2550
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2551
|
+
8
|
|
2552
|
+
)[7] === '1'
|
|
2784
2553
|
},
|
|
2785
2554
|
charge: null,
|
|
2786
2555
|
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
@@ -3077,7 +2846,7 @@ const parse = raw => {
|
|
|
3077
2846
|
battery: null,
|
|
3078
2847
|
inputCharge: null
|
|
3079
2848
|
},
|
|
3080
|
-
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] : null,
|
|
2849
|
+
mcc: parsedData[15] !== '' ? utils.latamMcc[parseInt(parsedData[15], 10)] || utils.latamMcc.default : null,
|
|
3081
2850
|
mnc: parsedData[16] !== '' ? utils.getMNC(parsedData[15], parsedData[16]) : null,
|
|
3082
2851
|
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
3083
2852
|
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
@@ -3126,7 +2895,7 @@ const parse = raw => {
|
|
|
3126
2895
|
battery: null,
|
|
3127
2896
|
inputCharge: null
|
|
3128
2897
|
},
|
|
3129
|
-
mcc: parsedData[20] !== '' ? utils.latamMcc[parseInt(parsedData[20], 10)] : null,
|
|
2898
|
+
mcc: parsedData[20] !== '' ? utils.latamMcc[parseInt(parsedData[20], 10)] || utils.latamMcc.default : null,
|
|
3130
2899
|
mnc: parsedData[21] !== '' ? utils.getMNC(parsedData[20], parsedData[21]) : null,
|
|
3131
2900
|
lac: parsedData[22] !== '' ? parseInt(parsedData[22], 16) : null,
|
|
3132
2901
|
cid: parsedData[23] !== '' ? parseInt(parsedData[23], 16) : null,
|
|
@@ -3140,32 +2909,32 @@ const parse = raw => {
|
|
|
3140
2909
|
sos: false,
|
|
3141
2910
|
input: {
|
|
3142
2911
|
'2':
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
2912
|
+
utils.nHexDigit(
|
|
2913
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
2914
|
+
8
|
|
2915
|
+
)[6] === '1',
|
|
3147
2916
|
'1':
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
2917
|
+
utils.nHexDigit(
|
|
2918
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
2919
|
+
8
|
|
2920
|
+
)[7] === '1'
|
|
3152
2921
|
},
|
|
3153
2922
|
output: {
|
|
3154
2923
|
'3':
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
2924
|
+
utils.nHexDigit(
|
|
2925
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2926
|
+
8
|
|
2927
|
+
)[5] === '1',
|
|
3159
2928
|
'2':
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
2929
|
+
utils.nHexDigit(
|
|
2930
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2931
|
+
8
|
|
2932
|
+
)[6] === '1',
|
|
3164
2933
|
'1':
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
2934
|
+
utils.nHexDigit(
|
|
2935
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
2936
|
+
8
|
|
2937
|
+
)[7] === '1'
|
|
3169
2938
|
},
|
|
3170
2939
|
charge: null,
|
|
3171
2940
|
state: utils.states[parsedData[index + 1].substring(0, 2)]
|
|
@@ -3232,7 +3001,7 @@ const parse = raw => {
|
|
|
3232
3001
|
battery: null,
|
|
3233
3002
|
inputCharge: null
|
|
3234
3003
|
},
|
|
3235
|
-
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] : null,
|
|
3004
|
+
mcc: parsedData[14] !== '' ? utils.latamMcc[parseInt(parsedData[14], 10)] || utils.latamMcc.default : null,
|
|
3236
3005
|
mnc: parsedData[15] !== '' ? utils.getMNC(parsedData[14], parsedData[15]) : null,
|
|
3237
3006
|
lac: parsedData[16] !== '' ? parseInt(parsedData[16], 16) : null,
|
|
3238
3007
|
cid: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
@@ -3246,32 +3015,32 @@ const parse = raw => {
|
|
|
3246
3015
|
sos: false,
|
|
3247
3016
|
input: {
|
|
3248
3017
|
'2':
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3018
|
+
utils.nHexDigit(
|
|
3019
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
3020
|
+
8
|
|
3021
|
+
)[6] === '1',
|
|
3253
3022
|
'1':
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3023
|
+
utils.nHexDigit(
|
|
3024
|
+
utils.hex2bin(parsedData[index + 1].substring(2, 4)),
|
|
3025
|
+
8
|
|
3026
|
+
)[7] === '1'
|
|
3258
3027
|
},
|
|
3259
3028
|
output: {
|
|
3260
3029
|
'3':
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3030
|
+
utils.nHexDigit(
|
|
3031
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
3032
|
+
8
|
|
3033
|
+
)[5] === '1',
|
|
3265
3034
|
'2':
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3035
|
+
utils.nHexDigit(
|
|
3036
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
3037
|
+
8
|
|
3038
|
+
)[6] === '1',
|
|
3270
3039
|
'1':
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3040
|
+
utils.nHexDigit(
|
|
3041
|
+
utils.hex2bin(parsedData[index + 1].substring(4, 6)),
|
|
3042
|
+
8
|
|
3043
|
+
)[7] === '1'
|
|
3275
3044
|
},
|
|
3276
3045
|
charge: null,
|
|
3277
3046
|
state: utils.states[parsedData[index + 1].substring(0, 2)]
|