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/index.js
CHANGED
|
@@ -250,8 +250,10 @@ const parseCommand = data => {
|
|
|
250
250
|
const do5 = `${outputs[4]},${prevDurations['5']},${prevToggles['5']}`
|
|
251
251
|
const longOperation = data.longOperation || false ? '1' : '0'
|
|
252
252
|
const dosReport = data.dosReport || false ? '1' : '0'
|
|
253
|
-
if (data.device_serie === 'GV' &&
|
|
253
|
+
if (data.device_serie === 'GV' && password === 'gv57cg') {
|
|
254
254
|
command = `AT+GTDOS=${password},,,1,${do1},,,${dosReport},0,5,,,,${serialId}$`
|
|
255
|
+
} else if (data.device_serie === 'GV' && password === 'gv58lau') {
|
|
256
|
+
command = `AT+GTDOS=${password},0,3,1,${do1},0,,2,${do2},0,,3,${do3},0,,0,,,0${dosReport},,,FFFF$`
|
|
255
257
|
} else if (data.device_serie === 'GV') {
|
|
256
258
|
command = `AT+GTOUT=${password},${do1},${do2},${do3},${do4},${longOperation},${dosReport},,,${serialId}$`
|
|
257
259
|
} else if (data.device_serie === 'GMT') {
|
package/src/messages/es.json
CHANGED
|
@@ -283,6 +283,7 @@
|
|
|
283
283
|
"GTJDC": "Config: detección de jamming",
|
|
284
284
|
"GTASC": "Config: autocalibración de acelerómetro",
|
|
285
285
|
"GTOUT": "Config: salidas digitales",
|
|
286
|
+
"GTDOS": "Config: salidas digitales",
|
|
286
287
|
"GTDIS": "Config: entradas digitales",
|
|
287
288
|
"GTGDO": "Config: salidas digitales graduales",
|
|
288
289
|
"GTROS": "Config: restricción de salidas",
|
package/src/utils.js
CHANGED
|
@@ -293,9 +293,11 @@ const latamMcc = {
|
|
|
293
293
|
736: 'Bolivia',
|
|
294
294
|
740: 'Ecuador',
|
|
295
295
|
744: 'Paraguay',
|
|
296
|
-
748: 'Uruguay'
|
|
296
|
+
748: 'Uruguay',
|
|
297
|
+
default: 'Desconocido'
|
|
297
298
|
}
|
|
298
299
|
|
|
300
|
+
|
|
299
301
|
/*
|
|
300
302
|
Gets the Queclink Device Type
|
|
301
303
|
*/
|
|
@@ -363,7 +365,7 @@ const checkGps = (lng, lat) => {
|
|
|
363
365
|
included in the report
|
|
364
366
|
*/
|
|
365
367
|
const includeSatellites = positionAppendMask => {
|
|
366
|
-
return
|
|
368
|
+
return nHexDigit(hex2bin(positionAppendMask), 4)[3] == '1'
|
|
367
369
|
}
|
|
368
370
|
|
|
369
371
|
/*
|
|
@@ -371,19 +373,23 @@ const includeSatellites = positionAppendMask => {
|
|
|
371
373
|
included in the report
|
|
372
374
|
*/
|
|
373
375
|
const includeGnssTrigger = positionAppendMask => {
|
|
374
|
-
return
|
|
376
|
+
return nHexDigit(hex2bin(positionAppendMask), 4)[2] == '1'
|
|
375
377
|
}
|
|
376
378
|
|
|
377
379
|
/*
|
|
378
|
-
Returns if
|
|
379
|
-
|
|
380
|
+
Returns if the Status is
|
|
381
|
+
included in the report
|
|
380
382
|
*/
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
let statusInfo = parseInt(positionAppendMask) > 3
|
|
383
|
+
const includeStatus = positionAppendMask => {
|
|
384
|
+
return nHexDigit(hex2bin(positionAppendMask), 4)[1] == '1'
|
|
385
|
+
}
|
|
385
386
|
|
|
386
|
-
|
|
387
|
+
/*
|
|
388
|
+
Returns if the GNNS Accuracy is
|
|
389
|
+
included in the report
|
|
390
|
+
*/
|
|
391
|
+
const includeGnnsAccuracy = positionAppendMask => {
|
|
392
|
+
return nHexDigit(hex2bin(positionAppendMask), 4)[0] == '1'
|
|
387
393
|
}
|
|
388
394
|
|
|
389
395
|
/*
|
|
@@ -581,7 +587,7 @@ const getMNC = (countryData, opData) => {
|
|
|
581
587
|
operator = 'Desconocido'
|
|
582
588
|
}
|
|
583
589
|
return {
|
|
584
|
-
country: latamMcc[mcc], mnc: mnc, operator: operator
|
|
590
|
+
country: latamMcc[mcc] || latamMcc.default, mnc: mnc, operator: operator
|
|
585
591
|
}
|
|
586
592
|
}
|
|
587
593
|
|
|
@@ -601,7 +607,7 @@ const parseCanData = (data, key) => {
|
|
|
601
607
|
case 'ignitionKey':
|
|
602
608
|
return (data === '0' ? 'ignition_off' : data === '1' ? 'ignition_on' : data === '2' ? 'engine_on' : null)
|
|
603
609
|
case 'totalDistance':
|
|
604
|
-
if (data.slice(0,1) === 'H') {
|
|
610
|
+
if (data.slice(0, 1) === 'H') {
|
|
605
611
|
return hToKm(data)
|
|
606
612
|
} else {
|
|
607
613
|
return data
|
|
@@ -619,7 +625,7 @@ const parseCanData = (data, key) => {
|
|
|
619
625
|
case 'tachographDrivingDirection':
|
|
620
626
|
return data === '0' ? 'forward' : 'backward'
|
|
621
627
|
case 'adBlueLevel':
|
|
622
|
-
if(['P','L'].includes(data.slice(0,1))) {
|
|
628
|
+
if (['P', 'L'].includes(data.slice(0, 1))) {
|
|
623
629
|
return parseFloat(parseFloat(data.slice(1)).toFixed(2))
|
|
624
630
|
} else {
|
|
625
631
|
return parseFloat(parseFloat(data).toFixed(2))
|
|
@@ -672,7 +678,7 @@ const getCanData = (parsedData, ix) => {
|
|
|
672
678
|
vin: parsedData[ix + 2] ? parsedData[ix + 2] : null,
|
|
673
679
|
ignitionKey: parsedData[ix + 3] ? parseCanData(parsedData[ix + 3], 'ignitionKey') : null,
|
|
674
680
|
totalDistance: parsedData[ix + 4] ? parseCanData(parsedData[ix + 4], 'totalDistance') : null,
|
|
675
|
-
totalDistanceUnit: parsedData[ix + 4] ? parsedData[ix + 4].slice(0,1) === 'H' ? 'km' : 'I' : null,
|
|
681
|
+
totalDistanceUnit: parsedData[ix + 4] ? parsedData[ix + 4].slice(0, 1) === 'H' ? 'km' : 'I' : null,
|
|
676
682
|
fuelUsed: parsedData[ix + 5] ? parseFloat(parsedData[ix + 5]) : null, // float
|
|
677
683
|
rpm: parsedData[ix + 6] ? parseInt(parsedData[ix + 6], 10) : null, // int
|
|
678
684
|
speed: parsedData[ix + 7] ? parseFloat(parsedData[ix + 7]) : null,
|
|
@@ -680,7 +686,7 @@ const getCanData = (parsedData, ix) => {
|
|
|
680
686
|
parsedData[ix + 8] ? parseInt(parsedData[ix + 8], 10) : null,
|
|
681
687
|
fuelConsumption: parsedData[ix + 9] ? parseCanData(parsedData[ix + 9], 'fuelConsumption') : null,
|
|
682
688
|
fuelLevel: parsedData[ix + 10] ? parseFloat(parsedData[ix + 10].slice(1)) : null,
|
|
683
|
-
fuelLevelUnit: parsedData[ix + 10] ? parsedData[ix + 10].slice(0,1) === 'P' ? '%' : 'L' : null,
|
|
689
|
+
fuelLevelUnit: parsedData[ix + 10] ? parsedData[ix + 10].slice(0, 1) === 'P' ? '%' : 'L' : null,
|
|
684
690
|
range: parsedData[ix + 11] ? parseCanData(parsedData[ix + 11], 'range') : null,
|
|
685
691
|
acceleratorPressure:
|
|
686
692
|
parsedData[ix + 12] ? parseFloat(parsedData[ix + 12]) : null,
|
|
@@ -804,7 +810,7 @@ const getCanData = (parsedData, ix) => {
|
|
|
804
810
|
},
|
|
805
811
|
adBlueLevel:
|
|
806
812
|
parsedData[ix + 25] ? parseCanData(parsedData[ix + 25], 'adBlueLevel') : null,
|
|
807
|
-
adBlueLevelUnit: parsedData[ix + 25] ? parsedData[ix + 25].slice(0,1) === 'P' ? '%' : 'L' ? 'L': '
|
|
813
|
+
adBlueLevelUnit: parsedData[ix + 25] ? parsedData[ix + 25].slice(0, 1) === 'P' ? '%' : 'L' ? 'L' : '%' : null,
|
|
808
814
|
axleWeight1: parsedData[ix + 26] ? parseInt(parsedData[ix + 26]) : null,
|
|
809
815
|
axleWeight3: parsedData[ix + 27] ? parseInt(parsedData[ix + 27]) : null,
|
|
810
816
|
axleWeight4: parsedData[ix + 28] ? parseInt(parsedData[ix + 28]) : null,
|
|
@@ -1264,7 +1270,7 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1264
1270
|
magnitude: Number(
|
|
1265
1271
|
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)).toFixed(2)
|
|
1266
1272
|
).toString(),
|
|
1267
|
-
xyz: {x: x, y: y, z: z},
|
|
1273
|
+
xyz: { x: x, y: y, z: z },
|
|
1268
1274
|
message: messages[command][report[1]]
|
|
1269
1275
|
}
|
|
1270
1276
|
} else if (command === 'GTCRA') {
|
|
@@ -1510,7 +1516,8 @@ module.exports = {
|
|
|
1510
1516
|
checkGps: checkGps,
|
|
1511
1517
|
includeSatellites: includeSatellites,
|
|
1512
1518
|
includeGnssTrigger: includeGnssTrigger,
|
|
1513
|
-
|
|
1519
|
+
includeStatus: includeStatus,
|
|
1520
|
+
includeGnnsAccuracy: includeGnnsAccuracy,
|
|
1514
1521
|
getAccelerationMagnitude: getAccelerationMagnitude,
|
|
1515
1522
|
getTempInCelciousDegrees: getTempInCelciousDegrees,
|
|
1516
1523
|
getBtTempHumData: getBtTempHumData,
|