queclink-parser 1.3.18 → 1.4.0
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 +24 -0
- package/README.md +29 -32
- package/package.json +1 -1
- package/src/gv55.js +2 -2
- package/src/gv600w.js +53 -92
- package/src/index.js +2 -2
- package/src/utils.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
### 1.4.0 (2022-02-02)
|
|
2
|
+
|
|
3
|
+
##### New Features
|
|
4
|
+
|
|
5
|
+
* **gv55w:** support for gv55w added ([6e6cde95](https://github.com/jaayesta/queclink-parser/commit/6e6cde95be791134f993059883db1184a52bac9a))
|
|
6
|
+
|
|
7
|
+
#### 1.3.21 (2021-11-03)
|
|
8
|
+
|
|
9
|
+
##### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **buff:** buff pattern fixed ([882ebc02](https://github.com/jaayesta/queclink-parser/commit/882ebc02c1a7a483937086cc8f0415cd3a346121))
|
|
12
|
+
|
|
13
|
+
#### 1.3.20 (2021-09-23)
|
|
14
|
+
|
|
15
|
+
##### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **parse:** add end character to all patterns ([44cf0796](https://github.com/jaayesta/queclink-parser/commit/44cf0796f07c5006f12e709a70e02e39b4188c6c))
|
|
18
|
+
|
|
19
|
+
#### 1.3.19 (2021-08-05)
|
|
20
|
+
|
|
21
|
+
##### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **gv600w:** fix parse gv600w GTDAT short format ([bd995505](https://github.com/jaayesta/queclink-parser/commit/bd99550501610c5b9c8843b268e415a3fcb26247))
|
|
24
|
+
|
|
1
25
|
#### 1.3.18 (2021-06-22)
|
|
2
26
|
|
|
3
27
|
##### New Features
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://david-dm.org/jaayesta/queclink-parser#info=dependencies)
|
|
6
6
|
[](https://david-dm.org/jaayesta/queclink-parser#info=devDependencies)
|
|
7
7
|
|
|
8
|
-
> Parses raw data from Queclink devices (TCP). Devices supported: GV55, GV200, GV300, GV75W, GV300W, GV500, GV600W GV800W, GMT100, GL50, GL50B, GL300, GL300W
|
|
8
|
+
> Parses raw data from Queclink devices (TCP). Devices supported: GV55, GV55W, GV200, GV300, GV75W, GV300W, GV500, GV600W, GV800W, GMT100, GL50, GL50B, GL300, GL300W, GV50P
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -24,45 +24,42 @@ const raw = new Buffer('+RESP:GTFRI,350302,867844003012625,,12372,10,1,0,0.0,0,8
|
|
|
24
24
|
const data = queclink.parse(raw);
|
|
25
25
|
|
|
26
26
|
/*
|
|
27
|
-
{
|
|
28
|
-
raw: '+RESP:GTFRI,270100,135790246811220,,,00,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,12345:12:34,,,80,210100,,,,20090214093254,11F0$',
|
|
27
|
+
{ raw: '+RESP:GTFRI,350302,867844003012625,,12372,10,1,0,0.0,0,820.8,-70.514872,-33.361021,20160811154617,0730,0002,7410,C789,00,0.0,00000:15:30,2788,705,164,0D,00,,,20160811154651,061D$',
|
|
29
28
|
manufacturer: 'queclink',
|
|
30
|
-
device: 'Queclink-
|
|
29
|
+
device: 'Queclink-GV200',
|
|
31
30
|
type: 'data',
|
|
32
|
-
imei: '
|
|
33
|
-
protocolVersion: { raw: '
|
|
31
|
+
imei: '867844003012625',
|
|
32
|
+
protocolVersion: { raw: '350302', deviceType: 'GV200', version: '3.2' },
|
|
34
33
|
temperature: null,
|
|
35
34
|
history: false,
|
|
36
|
-
sentTime:
|
|
37
|
-
serialId:
|
|
35
|
+
sentTime: 2016-08-11T15:46:51.000Z,
|
|
36
|
+
serialId: 1565,
|
|
38
37
|
alarm: { type: 'Gps' },
|
|
39
|
-
loc: { type: 'Point', coordinates: [
|
|
40
|
-
speed:
|
|
38
|
+
loc: { type: 'Point', coordinates: [ -70.514872, -33.361021 ] },
|
|
39
|
+
speed: 0,
|
|
41
40
|
gpsStatus: true,
|
|
42
|
-
hdop:
|
|
41
|
+
hdop: 0,
|
|
43
42
|
status:
|
|
44
|
-
{ raw: '
|
|
43
|
+
{ raw: '0D00',
|
|
45
44
|
sos: false,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
odometer: 2000,
|
|
65
|
-
hourmeter: '12345:12:34'
|
|
45
|
+
input: { '1': true, '2': false, '3': true, '4': true },
|
|
46
|
+
output: { '1': false, '2': false, '3': false, '4': false },
|
|
47
|
+
charge: true },
|
|
48
|
+
azimuth: 0,
|
|
49
|
+
altitude: 820.8,
|
|
50
|
+
datetime: 2016-08-11T15:46:17.000Z,
|
|
51
|
+
voltage:
|
|
52
|
+
{ battery: null,
|
|
53
|
+
inputCharge: 12.372,
|
|
54
|
+
ada: 2.788,
|
|
55
|
+
adb: 0.705,
|
|
56
|
+
adc: 0.164 },
|
|
57
|
+
mcc: 730,
|
|
58
|
+
mnc: 2,
|
|
59
|
+
lac: 29712,
|
|
60
|
+
cid: 51081,
|
|
61
|
+
odometer: 0,
|
|
62
|
+
hourmeter: 0.25833333333333336
|
|
66
63
|
}
|
|
67
64
|
*/
|
|
68
65
|
|
package/package.json
CHANGED
package/src/gv55.js
CHANGED
|
@@ -4,7 +4,7 @@ const utils = require('./utils.js')
|
|
|
4
4
|
/*
|
|
5
5
|
Parses messages data from GV55 devices
|
|
6
6
|
*/
|
|
7
|
-
const parse = raw => {
|
|
7
|
+
const parse = (raw, d) => {
|
|
8
8
|
raw = raw.substr(0, raw.length - 1)
|
|
9
9
|
|
|
10
10
|
const parsedData = raw.split(',')
|
|
@@ -18,7 +18,7 @@ const parse = raw => {
|
|
|
18
18
|
let data = {
|
|
19
19
|
raw: `${raw.toString()}$`,
|
|
20
20
|
manufacturer: 'queclink',
|
|
21
|
-
device: 'Queclink-GV55',
|
|
21
|
+
device: d === 'GV55W' ? 'Queclink-GV55W' : 'Queclink-GV55',
|
|
22
22
|
type: 'data',
|
|
23
23
|
imei: parsedData[2],
|
|
24
24
|
protocolVersion: utils.getProtocolVersion(parsedData[1]),
|
package/src/gv600w.js
CHANGED
|
@@ -882,104 +882,65 @@ const parse = raw => {
|
|
|
882
882
|
}
|
|
883
883
|
})
|
|
884
884
|
} else if (command[1] === 'GTDAT') {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
type: 'Point',
|
|
888
|
-
coordinates: [parseFloat(parsedData[12]), parseFloat(parsedData[13])]
|
|
889
|
-
},
|
|
890
|
-
speed: parsedData[9] !== '' ? parseFloat(parsedData[9]) : null,
|
|
891
|
-
gpsStatus: utils.checkGps(
|
|
892
|
-
parseFloat(parsedData[12]),
|
|
893
|
-
parseFloat(parsedData[13])
|
|
894
|
-
),
|
|
895
|
-
hdop: parsedData[8] !== '' ? parseFloat(parsedData[8]) : null,
|
|
896
|
-
status: null,
|
|
897
|
-
azimuth: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null,
|
|
898
|
-
altitude: parsedData[11] !== '' ? parseFloat(parsedData[11]) : null,
|
|
899
|
-
datetime: parsedData[14] !== '' ? utils.parseDate(parsedData[14]) : null,
|
|
900
|
-
voltage: {
|
|
901
|
-
battery: null,
|
|
902
|
-
inputCharge: null,
|
|
903
|
-
ada: null,
|
|
904
|
-
adb: null,
|
|
905
|
-
adc: null,
|
|
906
|
-
add: null
|
|
907
|
-
},
|
|
908
|
-
mcc: parsedData[15] !== '' ? parseInt(parsedData[15], 10) : null,
|
|
909
|
-
mnc: parsedData[16] !== '' ? parseInt(parsedData[16], 10) : null,
|
|
910
|
-
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
911
|
-
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
912
|
-
odometer: null,
|
|
913
|
-
hourmeter: null,
|
|
914
|
-
serialData: parsedData[7] !== '' ? parsedData[7] : null
|
|
915
|
-
})
|
|
916
|
-
|
|
917
|
-
// Checks if its a temperature GTDAT -> DT
|
|
918
|
-
if (/^>DT/.test(parsedData[7])) {
|
|
919
|
-
const parsedSerialData =
|
|
920
|
-
parsedData[7] !== '' ? parsedData[7].split('|') : ''
|
|
921
|
-
let externalData = {
|
|
922
|
-
eriMask: {
|
|
923
|
-
raw: '00000000',
|
|
924
|
-
digitFuelSensor: false,
|
|
925
|
-
AC100: false,
|
|
926
|
-
reserved: false,
|
|
927
|
-
fuelLevelPercentage: false,
|
|
928
|
-
fuelVolume: false
|
|
929
|
-
},
|
|
930
|
-
uartDeviceType: 'Camaleon',
|
|
931
|
-
fuelSensorData: null
|
|
932
|
-
}
|
|
933
|
-
let AC100Devices = [
|
|
934
|
-
{
|
|
935
|
-
deviceNumber: `${parsedData[2]}|1`,
|
|
936
|
-
deviceType: '1',
|
|
937
|
-
deviceData:
|
|
938
|
-
parsedSerialData[3] !== '' ? parseFloat(parsedSerialData[3]) : null
|
|
939
|
-
}
|
|
940
|
-
]
|
|
941
|
-
if (parsedSerialData[4] !== '') {
|
|
942
|
-
AC100Devices.push({
|
|
943
|
-
deviceNumber: `${parsedData[2]}|2`,
|
|
944
|
-
deviceType: '1',
|
|
945
|
-
deviceData:
|
|
946
|
-
parsedSerialData[4] !== '' ? parseFloat(parsedSerialData[4]) : null
|
|
947
|
-
})
|
|
948
|
-
}
|
|
949
|
-
externalData = Object.assign(externalData, {
|
|
950
|
-
AC100Devices: AC100Devices
|
|
951
|
-
})
|
|
952
|
-
data = Object.assign(data, {
|
|
953
|
-
alarm: utils.getAlarm('GTERI', null),
|
|
954
|
-
externalData: externalData
|
|
955
|
-
})
|
|
956
|
-
} else if (/^>ET/.test(parsedData[7])) {
|
|
957
|
-
// Temp Alarms
|
|
958
|
-
// GTTMP
|
|
959
|
-
const parsedSerialData =
|
|
960
|
-
parsedData[7] !== '' ? parsedData[7].split('|') : ''
|
|
961
|
-
const alarm = utils.getAlarm('GTTMP', `${parsedSerialData[2]}0`, [
|
|
962
|
-
`${parsedData[2]}|${parsedSerialData[2]}`,
|
|
963
|
-
parsedSerialData[4]
|
|
964
|
-
])
|
|
885
|
+
if (parsedData.length > 8) {
|
|
886
|
+
// Long format
|
|
965
887
|
data = Object.assign(data, {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
888
|
+
loc: {
|
|
889
|
+
type: 'Point',
|
|
890
|
+
coordinates: [parseFloat(parsedData[12]), parseFloat(parsedData[13])]
|
|
891
|
+
},
|
|
892
|
+
speed: parsedData[9] !== '' ? parseFloat(parsedData[9]) : null,
|
|
893
|
+
gpsStatus: utils.checkGps(
|
|
894
|
+
parseFloat(parsedData[12]),
|
|
895
|
+
parseFloat(parsedData[13])
|
|
896
|
+
),
|
|
897
|
+
hdop: parsedData[8] !== '' ? parseFloat(parsedData[8]) : null,
|
|
898
|
+
status: null,
|
|
899
|
+
azimuth: parsedData[10] !== '' ? parseFloat(parsedData[10]) : null,
|
|
900
|
+
altitude: parsedData[11] !== '' ? parseFloat(parsedData[11]) : null,
|
|
901
|
+
datetime:
|
|
902
|
+
parsedData[14] !== '' ? utils.parseDate(parsedData[14]) : null,
|
|
903
|
+
voltage: {
|
|
904
|
+
battery: null,
|
|
905
|
+
inputCharge: null,
|
|
906
|
+
ada: null,
|
|
907
|
+
adb: null,
|
|
908
|
+
adc: null,
|
|
909
|
+
add: null
|
|
910
|
+
},
|
|
911
|
+
mcc: parsedData[15] !== '' ? parseInt(parsedData[15], 10) : null,
|
|
912
|
+
mnc: parsedData[16] !== '' ? parseInt(parsedData[16], 10) : null,
|
|
913
|
+
lac: parsedData[17] !== '' ? parseInt(parsedData[17], 16) : null,
|
|
914
|
+
cid: parsedData[18] !== '' ? parseInt(parsedData[18], 16) : null,
|
|
915
|
+
odometer: null,
|
|
916
|
+
hourmeter: null,
|
|
917
|
+
serialData: parsedData[7] !== '' ? parsedData[7] : null
|
|
976
918
|
})
|
|
977
919
|
} else {
|
|
978
|
-
//
|
|
920
|
+
// Short format
|
|
979
921
|
data = Object.assign(data, {
|
|
980
|
-
|
|
922
|
+
loc: null,
|
|
923
|
+
speed: null,
|
|
924
|
+
gpsStatus: null,
|
|
925
|
+
hdop: null,
|
|
926
|
+
status: null,
|
|
927
|
+
azimuth: null,
|
|
928
|
+
altitude: null,
|
|
929
|
+
datetime: null,
|
|
930
|
+
voltage: null,
|
|
931
|
+
mcc: null,
|
|
932
|
+
mnc: null,
|
|
933
|
+
lac: null,
|
|
934
|
+
cid: null,
|
|
935
|
+
odometer: null,
|
|
936
|
+
hourmeter: null,
|
|
937
|
+
serialData: parsedData[4] !== '' ? parsedData[4] : null
|
|
981
938
|
})
|
|
982
939
|
}
|
|
940
|
+
|
|
941
|
+
data = Object.assign(data, {
|
|
942
|
+
alarm: utils.getAlarm(command[1], null)
|
|
943
|
+
})
|
|
983
944
|
} else if (command[1] === 'GTDOS') {
|
|
984
945
|
data = Object.assign(data, {
|
|
985
946
|
alarm: utils.getAlarm(command[1], `${parsedData[4]},${parsedData[5]}`),
|
package/src/index.js
CHANGED
|
@@ -106,8 +106,8 @@ const parse = (raw, options) => {
|
|
|
106
106
|
result = gv200.parse(raw.toString())
|
|
107
107
|
} else if (device === 'GV500') {
|
|
108
108
|
result = gv500.parse(raw.toString())
|
|
109
|
-
} else if (device === 'GV55') {
|
|
110
|
-
result = gv55.parse(raw.toString())
|
|
109
|
+
} else if (device === 'GV55' || device === 'GV55W') {
|
|
110
|
+
result = gv55.parse(raw.toString(), device)
|
|
111
111
|
} else if (device === 'GMT100') {
|
|
112
112
|
result = gmt100.parse(raw.toString())
|
|
113
113
|
} else if (device === 'GL300' || device === 'GL300W') {
|
package/src/utils.js
CHANGED
|
@@ -8,10 +8,10 @@ const langs = { es: langEs, en: langEn }
|
|
|
8
8
|
Data patterns
|
|
9
9
|
*/
|
|
10
10
|
const patterns = {
|
|
11
|
-
message: /^\+RESP
|
|
12
|
-
ack: /^\+ACK
|
|
11
|
+
message: /^\+RESP.+\$$/,
|
|
12
|
+
ack: /^\+ACK.+\$$/,
|
|
13
13
|
buffer: /^\+BUFF/,
|
|
14
|
-
heartbeat: /^\+ACK:GTHBD
|
|
14
|
+
heartbeat: /^\+ACK:GTHBD.+\$$/
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/*
|
|
@@ -26,6 +26,7 @@ const devices = {
|
|
|
26
26
|
'08': 'GMT100',
|
|
27
27
|
'09': 'GV50P', // GV50 Plus
|
|
28
28
|
'0F': 'GV55',
|
|
29
|
+
'50': 'GV55W',
|
|
29
30
|
'10': 'GV55 LITE',
|
|
30
31
|
'11': 'GL500',
|
|
31
32
|
'1A': 'GL300',
|