queclink-parser 1.8.3 → 1.8.5
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 +8 -0
- package/example.js +5 -1
- package/package.json +1 -1
- package/src/gv310lau.js +29 -29
- package/src/messages/es.json +14 -14
- package/src/utils.js +30 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#### 1.8.5 (2024-01-11)
|
|
2
|
+
|
|
3
|
+
#### 1.8.4 (2024-01-11)
|
|
4
|
+
|
|
5
|
+
##### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **replace:** new 'replace' deleted in utils. ([37598dfc](https://github.com/jaayesta/queclink-parser/commit/37598dfc8017fbbf8d0ea2ed40228c3f31408f7e))
|
|
8
|
+
|
|
1
9
|
#### 1.8.3 (2024-01-08)
|
|
2
10
|
|
|
3
11
|
#### 1.8.2 (2024-01-08)
|
package/example.js
CHANGED
|
@@ -50,6 +50,10 @@ var crg = '+RESP:GTCRG,6E0200,866775050906544,,1,10,1,1,0.0,18,113.5,117.129345,
|
|
|
50
50
|
var crd = '+RESP:GTCRD,6E0200,866775050906544,,01,06,1,1,000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000C0001FFAB000B0001FFAB000B0003FFAB000C0001FFAB000B0001FFAB000B0001FFAB000C0001FFAB000B0001FFAB000B0001FFAB000B0002FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000C0001FFAB000B0001FFAB000C0001FFAB000B0001FFAB000C0001FFAB000B0001FFAB000B0001FFAB000B0002FFAC000B0001FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0002FFAB000B0001FFAB000B0001FFAB000B0001FFAB000B0003FFAB000C0001FFAB000B0001FFAB000B0002FFAB000B0002FFAB000C0001FFAB000F0003FFAB000C0002FFAB00070000FFAB000B0002FFAB000B0001FFAB000C0001FFAB000B0002FFAB000F0004FFB0000D0004FFAF00190001FFAB001CFFFDFFAB00110004FFAB0010FFFFFFAA00060002FFAB000E0001FFAB00140004FFAB00100006FFAB000E0006FFAB000F0006FFAB00100004FFAC00150001FFAA00140003FFAA0006000AFFAB00060003FFABFFFD0000FFABFFF4FFFDFFABFFE8FFFCFFABFFE9000BFFABFFB3FFFAFFAA,20220826103154,1C3F$';
|
|
51
51
|
var acc = '+RESP:GTACC,6E0200,866775050906544,,000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0001FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000A0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000A0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000A0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB000B0002FFAB,,,,20220826104109,1C9E$';
|
|
52
52
|
var can = '+RESP:GTCAN,6E0100,866775050906767,,0,1,E03FFFFF,LSVNY41Z0B2521894,2,H1230,2.46,865,10,77,M167.0,P97.60,,0,0.92,0.61,0.31,11.20,,,0442,,20,0.08,0.00,00FFFFFF,100,326,253,306,1,1,1,999,617,996,307,0.03,0.19,0.22,947,1111111111,2222222222,123456789012345678901234567890abcdefghij,98765abcdefghij36254iuelopiedj5duebdkvde,5647893214,0000,0,0,89,,,1,0.0,173,86.8,117.129379,31.838965,20220712054346,0460,0000,550B,0E9E30A5,00,20220712054348,00D4$';
|
|
53
|
-
|
|
53
|
+
var vgl = '+RESP:GTVGL,270804,867162025516246,,,40,1,1,0.0,0,113.6,117.201344,31.832924,20171013053055,0460,0001,D5D6,8062B71,00,0.1,20171013053055,0573$';
|
|
54
|
+
var dis = '+RESP:GTDIS,270804,863835020303983,,,11,1,1,0.0,165,59.5,117.201427,31.833061,20150407012708,0460,0001,D5D6,5281,00,3.6,20150407092709,05F3$';
|
|
55
|
+
var hbm1 = '+RESP:GTHBM,270804,863835020307067,,,10,1,1,0.1,49,64.5,117.201427,31.833100,20150327012643,0460,0000,5665,47A1,00,34.0,20150327092644,031A$';
|
|
56
|
+
var hbm2 = '+RESP:GTHBM,270804,863835020307067,,,11,1,1,12.0,330,72.8,117.201388,31.833175,20150327012737,0460,0000,5665,47A1,00,34.0,20150327092738,031D$';
|
|
57
|
+
const raw = new Buffer(ver)
|
|
54
58
|
console.log(queclink.parse(raw))
|
|
55
59
|
// queclink.parse(raw)
|
package/package.json
CHANGED
package/src/gv310lau.js
CHANGED
|
@@ -1947,35 +1947,35 @@ const parse = raw => {
|
|
|
1947
1947
|
odometer: null,
|
|
1948
1948
|
hourmeter: null
|
|
1949
1949
|
})
|
|
1950
|
-
} else if (command[1] === 'GTCSQ') {
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1950
|
+
// } else if (command[1] === 'GTCSQ') {
|
|
1951
|
+
// data = Object.assign(data, {
|
|
1952
|
+
// alarm: utils.getAlarm(command[1], parsedData[5]),
|
|
1953
|
+
// loc: {
|
|
1954
|
+
// type: 'Point',
|
|
1955
|
+
// coordinates: [null, null]
|
|
1956
|
+
// },
|
|
1957
|
+
// speed: null,
|
|
1958
|
+
// gpsStatus: null,
|
|
1959
|
+
// hdop: null,
|
|
1960
|
+
// status: null,
|
|
1961
|
+
// azimuth: null,
|
|
1962
|
+
// altitude: null,
|
|
1963
|
+
// datetime: parsedData[6] !== '' ? utils.parseDate(parsedData[6]) : null,
|
|
1964
|
+
// voltage: {
|
|
1965
|
+
// battery: null,
|
|
1966
|
+
// inputCharge: null,
|
|
1967
|
+
// ada: null,
|
|
1968
|
+
// adb: null,
|
|
1969
|
+
// adc: null
|
|
1970
|
+
// },
|
|
1971
|
+
// mcc: null,
|
|
1972
|
+
// mnc: null,
|
|
1973
|
+
// lac: null,
|
|
1974
|
+
// cid: null,
|
|
1975
|
+
// satellites: null,
|
|
1976
|
+
// odometer: null,
|
|
1977
|
+
// hourmeter: null
|
|
1978
|
+
// })
|
|
1979
1979
|
} else if (command[1] === 'GTVER') {
|
|
1980
1980
|
data = Object.assign(data, {
|
|
1981
1981
|
alarm: utils.getAlarm(
|
package/src/messages/es.json
CHANGED
|
@@ -170,15 +170,15 @@
|
|
|
170
170
|
"GTWPB": "Botón SOS presionado",
|
|
171
171
|
"GTTOW": "Vehículo remolcado",
|
|
172
172
|
"GTDIS": {
|
|
173
|
-
"1": "Entrada digital
|
|
174
|
-
"0": "Entrada digital
|
|
173
|
+
"1": "Entrada digital id activada",
|
|
174
|
+
"0": "Entrada digital id desactivada"
|
|
175
175
|
},
|
|
176
176
|
"GTIOB": "Salida digital modificada por IOB",
|
|
177
177
|
"GTDOS": {
|
|
178
|
-
"1": "Salida digital
|
|
179
|
-
"0": "Salida digital
|
|
178
|
+
"1": "Salida digital activada",
|
|
179
|
+
"0": "Salida digital desactivada"
|
|
180
180
|
},
|
|
181
|
-
"GTDOM": "Salida digital
|
|
181
|
+
"GTDOM": "Salida digital activada",
|
|
182
182
|
"GTNMD": {
|
|
183
183
|
"0": "Vehículo en movimiento",
|
|
184
184
|
"1": "Vehículo detenido"
|
|
@@ -186,12 +186,12 @@
|
|
|
186
186
|
"GTDAT": "Datos del puerto serial recibidos",
|
|
187
187
|
"GTSOA": "Compartimento tarjeta SIM abierto",
|
|
188
188
|
"GTHBM": {
|
|
189
|
-
"0": "Frenada Brusca
|
|
190
|
-
"1": "Aceleración Brusca
|
|
191
|
-
"2": "Giro Brusco
|
|
192
|
-
"3": "Frenada Brusca Girando
|
|
193
|
-
"4": "Aceleración Brusca Girando
|
|
194
|
-
"5": "Comportamiento Brusco Desconocido
|
|
189
|
+
"0": "Frenada Brusca",
|
|
190
|
+
"1": "Aceleración Brusca",
|
|
191
|
+
"2": "Giro Brusco",
|
|
192
|
+
"3": "Frenada Brusca Girando",
|
|
193
|
+
"4": "Aceleración Brusca Girando",
|
|
194
|
+
"5": "Comportamiento Brusco Desconocido"
|
|
195
195
|
},
|
|
196
196
|
"GTHBE": {
|
|
197
197
|
"0": "Fin de Frenada Brusca",
|
|
@@ -247,9 +247,9 @@
|
|
|
247
247
|
},
|
|
248
248
|
"GTBID": "Se ha detectado baliza bluetooth",
|
|
249
249
|
"GTLBA": {
|
|
250
|
-
"1": "Batería baja en el WTS100
|
|
251
|
-
"2": "Batería baja en el WTH100
|
|
252
|
-
"3": "Batería baja en el botón SOS
|
|
250
|
+
"1": "Batería baja en el WTS100",
|
|
251
|
+
"2": "Batería baja en el WTH100",
|
|
252
|
+
"3": "Batería baja en el botón SOS bluetooth"
|
|
253
253
|
},
|
|
254
254
|
"+ACK": {
|
|
255
255
|
"GTBSI": "Config: APN",
|
package/src/utils.js
CHANGED
|
@@ -266,6 +266,9 @@ const getProtocolVersion = protocol => {
|
|
|
266
266
|
Gets the software/hardware version
|
|
267
267
|
*/
|
|
268
268
|
const getVersion = hexVersion => {
|
|
269
|
+
if (hexVersion === '') {
|
|
270
|
+
return 'no disponible'
|
|
271
|
+
}
|
|
269
272
|
const X = parseInt(hexVersion.substring(0, 2), 16)
|
|
270
273
|
const Y = parseInt(hexVersion.substring(2, 4), 16)
|
|
271
274
|
return `${X}.${Y}`
|
|
@@ -478,7 +481,7 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
478
481
|
type: 'DI',
|
|
479
482
|
number: reportID,
|
|
480
483
|
status: reportType === 1,
|
|
481
|
-
message: messages[command][reportType].replace('
|
|
484
|
+
message: messages[command][reportType].replace('id',reportID)
|
|
482
485
|
}
|
|
483
486
|
} else if (command === 'GTNMR') {
|
|
484
487
|
const reportType = report[1]
|
|
@@ -508,18 +511,16 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
508
511
|
message: messages[command][reportType === 0 ? '1' : '0']
|
|
509
512
|
}
|
|
510
513
|
} else if (command === 'GTVGL') {
|
|
511
|
-
let reportID = parseInt(report[0],
|
|
512
|
-
const reportType = parseInt(report[1],
|
|
513
|
-
if (reportID ===
|
|
514
|
-
reportID = ''
|
|
515
|
-
} else if (reportID === 1) {
|
|
516
|
-
reportID = ' por sensor de movimiento'
|
|
514
|
+
let reportID = parseInt(report[0], 16)
|
|
515
|
+
const reportType = parseInt(report[1], 16)
|
|
516
|
+
if (reportID === 1) {
|
|
517
|
+
reportID = 'por seYansor de movimiento'
|
|
517
518
|
} else if (reportID === 2) {
|
|
518
|
-
reportID = '
|
|
519
|
+
reportID = 'por voltaje de batería'
|
|
519
520
|
} else if (reportID === 4) {
|
|
520
|
-
reportID = '
|
|
521
|
+
reportID = 'por acelerómetro'
|
|
521
522
|
} else if (reportID === 7) {
|
|
522
|
-
reportID = '
|
|
523
|
+
reportID = 'por metodología combinada'
|
|
523
524
|
} else {
|
|
524
525
|
reportID = ''
|
|
525
526
|
}
|
|
@@ -527,10 +528,8 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
527
528
|
type: 'DI',
|
|
528
529
|
number: 1,
|
|
529
530
|
status: reportType === 0,
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
reportID
|
|
533
|
-
)
|
|
531
|
+
reason: reportID,
|
|
532
|
+
message: messages[command][reportType === 0 ? '1' : '0']
|
|
534
533
|
}
|
|
535
534
|
} else if (command === 'GTIGN') {
|
|
536
535
|
const duration = report !== '' ? parseInt(report, 10) : null
|
|
@@ -725,7 +724,7 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
725
724
|
type: 'DO',
|
|
726
725
|
number: outputId,
|
|
727
726
|
status: outputStatus === '1',
|
|
728
|
-
message: messages[command][outputStatus]
|
|
727
|
+
message: messages[command][outputStatus]
|
|
729
728
|
}
|
|
730
729
|
} else if (command === 'GTDOM') {
|
|
731
730
|
const waveShape = report[0] !== '' ? parseInt(report[0]) : null
|
|
@@ -735,8 +734,6 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
735
734
|
number: outputId,
|
|
736
735
|
wave: waveShape,
|
|
737
736
|
message: messages[command]
|
|
738
|
-
.replace('port', outputId)
|
|
739
|
-
.replace('wave', waveShape)
|
|
740
737
|
}
|
|
741
738
|
} else if (command === 'GTDAT') {
|
|
742
739
|
return {
|
|
@@ -772,21 +769,23 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
772
769
|
4: acceleration turning
|
|
773
770
|
5: unknown harsh behavior
|
|
774
771
|
*/
|
|
775
|
-
let reportID = parseInt(report[0],
|
|
772
|
+
let reportID = parseInt(report[0], 16)
|
|
773
|
+
let vel
|
|
776
774
|
if (reportID === 1) {
|
|
777
|
-
|
|
775
|
+
vel = 'baja'
|
|
778
776
|
} else if (reportID === 2) {
|
|
779
|
-
|
|
777
|
+
vel = 'media'
|
|
780
778
|
} else if (reportID === 3) {
|
|
781
|
-
|
|
779
|
+
vel = 'alta'
|
|
782
780
|
} else {
|
|
783
|
-
|
|
781
|
+
vel = ''
|
|
784
782
|
}
|
|
785
783
|
const reportType = report[1]
|
|
786
784
|
return {
|
|
787
785
|
type: 'Harsh_Behavior',
|
|
788
786
|
status: parseInt(reportType, 10),
|
|
789
|
-
|
|
787
|
+
velocity: vel !== '' ? vel : null,
|
|
788
|
+
message: messages[command][reportType]
|
|
790
789
|
}
|
|
791
790
|
} else if (command === 'GTHBE') {
|
|
792
791
|
/*
|
|
@@ -870,21 +869,24 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
870
869
|
return {
|
|
871
870
|
type: command,
|
|
872
871
|
status: 'BT_Low_Battery',
|
|
873
|
-
|
|
872
|
+
serialNumber: serial !== '' ? parseInt(serial, 16) : null,
|
|
873
|
+
message: messages[command][type]
|
|
874
874
|
}
|
|
875
875
|
} else if (command === 'GTCSQ') {
|
|
876
876
|
return {
|
|
877
877
|
type: command,
|
|
878
878
|
status: 'CONFIG',
|
|
879
|
-
message: messages[command].replace(
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
)
|
|
879
|
+
// message: messages[command].replace(
|
|
880
|
+
// 'data',
|
|
881
|
+
// report !== '' ? 100 * parseInt(parseFloat(report) / 7, 10) : '--'
|
|
882
|
+
// )
|
|
883
883
|
}
|
|
884
884
|
} else if (command === 'GTVER') {
|
|
885
885
|
return {
|
|
886
886
|
type: command,
|
|
887
887
|
status: 'CONFIG',
|
|
888
|
+
firmware: {raw: report[0], value: parseFloat(getVersion(report[0]))},
|
|
889
|
+
hardware: {raw: report[1], value: parseFloat(getVersion(report[1]))},
|
|
888
890
|
message: messages[command]
|
|
889
891
|
.replace('data0', getVersion(report[0]))
|
|
890
892
|
.replace('data1', getVersion(report[1]))
|