queclink-parser 1.9.19 → 1.9.23
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 +68 -0
- package/package.json +3 -2
- package/src/gl300.js +56 -14
- package/src/gl50.js +32 -8
- package/src/gl533cg.js +524 -0
- package/src/gmt100.js +88 -22
- package/src/gv200.js +144 -36
- package/src/gv300.js +112 -28
- package/src/gv300w.js +152 -38
- package/src/gv310lau.js +294 -122
- package/src/gv500.js +104 -26
- package/src/gv50p.js +88 -22
- package/src/gv55.js +88 -22
- package/src/gv57cg.js +3 -2
- package/src/gv58lau.js +1226 -687
- package/src/gv600w.js +144 -36
- package/src/gv75w.js +152 -38
- package/src/gv800w.js +144 -36
- package/src/index.js +78 -9
- package/src/messages/es.json +45 -5
- package/src/utils.js +566 -271
- package/example.js +0 -182
package/src/utils.js
CHANGED
|
@@ -11,9 +11,19 @@ const patterns = {
|
|
|
11
11
|
message: /^\+RESP.+\$$/,
|
|
12
12
|
buffer: /^\+BUFF/,
|
|
13
13
|
ack: /^\+ACK.+\$$/,
|
|
14
|
+
nack: /^\+NACK.+\$$/,
|
|
14
15
|
heartbeat: /^\+ACK:GTHBD.+\$$/
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
/*
|
|
19
|
+
Possible NACK Causes
|
|
20
|
+
*/
|
|
21
|
+
const nackCauses = {
|
|
22
|
+
'0': 'Clave o parámetros incorrectos',
|
|
23
|
+
'1': 'Comando no soportado',
|
|
24
|
+
'2': 'Comando no permitido en este momento'
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
/*
|
|
18
28
|
Homologued devices
|
|
19
29
|
*/
|
|
@@ -45,7 +55,8 @@ const devices = {
|
|
|
45
55
|
FC: 'GV600W',
|
|
46
56
|
'6E': 'GV310LAU',
|
|
47
57
|
'802004': 'GV58LAU',
|
|
48
|
-
'802006': 'GV57CG'
|
|
58
|
+
'802006': 'GV57CG',
|
|
59
|
+
C301: 'GL533CG'
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
/*
|
|
@@ -130,6 +141,17 @@ const externalGPSAntennaOptions = {
|
|
|
130
141
|
'': 'Unknow'
|
|
131
142
|
}
|
|
132
143
|
|
|
144
|
+
/*
|
|
145
|
+
Possible GPS Signal Strength
|
|
146
|
+
*/
|
|
147
|
+
const gpsSignalStrength = {
|
|
148
|
+
'0': 'Unknown',
|
|
149
|
+
'1': 'Great',
|
|
150
|
+
'2': 'Good',
|
|
151
|
+
'3': 'Normal',
|
|
152
|
+
'4': 'Weak'
|
|
153
|
+
}
|
|
154
|
+
|
|
133
155
|
/*
|
|
134
156
|
Possible Peer roles in Bluetooth
|
|
135
157
|
*/
|
|
@@ -222,11 +244,11 @@ const bluetoothModels = {
|
|
|
222
244
|
BLE Temp & Hum sensors
|
|
223
245
|
*/
|
|
224
246
|
const bleTempHumSensors = {
|
|
225
|
-
|
|
226
|
-
|
|
247
|
+
AC100: '0',
|
|
248
|
+
WTH300: '2',
|
|
227
249
|
'RHT ELA': '3',
|
|
228
|
-
|
|
229
|
-
|
|
250
|
+
WMS301: '4',
|
|
251
|
+
WTH301: '5'
|
|
230
252
|
}
|
|
231
253
|
|
|
232
254
|
/*
|
|
@@ -236,7 +258,8 @@ const beaconModels = {
|
|
|
236
258
|
'0': 'WKF300',
|
|
237
259
|
'1': 'iBeacon E6',
|
|
238
260
|
'2': 'ID ELA',
|
|
239
|
-
'4': 'WID310'
|
|
261
|
+
'4': 'WID310',
|
|
262
|
+
'10': 'WID330'
|
|
240
263
|
}
|
|
241
264
|
|
|
242
265
|
/*
|
|
@@ -320,7 +343,6 @@ const latamMcc = {
|
|
|
320
343
|
default: 'Desconocido'
|
|
321
344
|
}
|
|
322
345
|
|
|
323
|
-
|
|
324
346
|
/*
|
|
325
347
|
Gets the Queclink Device Type
|
|
326
348
|
*/
|
|
@@ -345,6 +367,11 @@ const getProtocolVersion = protocol => {
|
|
|
345
367
|
protocol.substring(8, 10),
|
|
346
368
|
16
|
|
347
369
|
)}`
|
|
370
|
+
} else if (['C301'].includes(protocol.substring(0, 4))) {
|
|
371
|
+
deviceType = devices.hasOwnProperty(protocol.substring(0, 4))
|
|
372
|
+
? devices[protocol.substring(0, 4)]
|
|
373
|
+
: null
|
|
374
|
+
deviceVersion = parseInt(protocol.substring(4, 8), 16)
|
|
348
375
|
} else {
|
|
349
376
|
deviceType = devices.hasOwnProperty(protocol.substring(0, 2))
|
|
350
377
|
? devices[protocol.substring(0, 2)]
|
|
@@ -528,7 +555,7 @@ const getHoursForHourmeter = hourmeter => {
|
|
|
528
555
|
/*
|
|
529
556
|
Returns the dBm signal strength
|
|
530
557
|
*/
|
|
531
|
-
const getSignalStrength = (networkType, value) => {
|
|
558
|
+
const getSignalStrength = (networkType, value, hexValue = false) => {
|
|
532
559
|
if (value === 99) {
|
|
533
560
|
return null
|
|
534
561
|
}
|
|
@@ -543,10 +570,15 @@ const getSignalStrength = (networkType, value) => {
|
|
|
543
570
|
} else if (networkType === 'GSM') {
|
|
544
571
|
calc = value - 110
|
|
545
572
|
dBm = calc < -110 ? 0 : calc > -47 ? 100 : calc
|
|
573
|
+
} else if (networkType === 'GPS') {
|
|
574
|
+
if (hexValue) {
|
|
575
|
+
return gpsSignalStrength[value.toString()]
|
|
576
|
+
} else {
|
|
577
|
+
return null
|
|
578
|
+
}
|
|
546
579
|
} else {
|
|
547
|
-
|
|
580
|
+
return null
|
|
548
581
|
}
|
|
549
|
-
|
|
550
582
|
return dBm
|
|
551
583
|
}
|
|
552
584
|
|
|
@@ -581,77 +613,104 @@ const getMNC = (countryData, opData) => {
|
|
|
581
613
|
let mnc = parseInt(opData, 10)
|
|
582
614
|
let operator
|
|
583
615
|
if (mcc === 716) {
|
|
584
|
-
operator =
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
616
|
+
operator =
|
|
617
|
+
mnc === 6
|
|
618
|
+
? 'Movistar'
|
|
619
|
+
: mnc === 7
|
|
620
|
+
? 'Nextel'
|
|
621
|
+
: mnc === 10
|
|
622
|
+
? 'Claro'
|
|
623
|
+
: mnc === 15
|
|
624
|
+
? 'Viettel'
|
|
625
|
+
: mnc === 17
|
|
626
|
+
? 'Entel'
|
|
627
|
+
: mnc === 20 ? 'Cuy Mobile (Claro)' : 'Desconocido'
|
|
591
628
|
} else if (mcc === 722) {
|
|
592
|
-
operator =
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
629
|
+
operator =
|
|
630
|
+
mnc === 1
|
|
631
|
+
? 'Tuenti'
|
|
632
|
+
: mnc === 10
|
|
633
|
+
? 'Movicom'
|
|
634
|
+
: mnc === 20
|
|
635
|
+
? 'Nextel'
|
|
636
|
+
: mnc === 34
|
|
637
|
+
? 'Telecom Personal'
|
|
638
|
+
: [310, 320, 330].includes(mnc) ? 'Claro' : 'Desconocido'
|
|
598
639
|
} else if (mcc === 724) {
|
|
599
640
|
// Incomplete
|
|
600
|
-
operator =
|
|
601
|
-
|
|
602
|
-
|
|
641
|
+
operator = [2, 3, 4].includes(mnc)
|
|
642
|
+
? 'TIM'
|
|
643
|
+
: [5, 6, 12].includes(mnc) ? 'Claro' : 'Otra'
|
|
603
644
|
} else if (mcc === 730) {
|
|
604
|
-
operator =
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
645
|
+
operator = [1, 10].includes(mnc)
|
|
646
|
+
? 'Entel'
|
|
647
|
+
: [2, 7].includes(mnc)
|
|
648
|
+
? 'Movistar'
|
|
649
|
+
: [3, 23].includes(mnc)
|
|
650
|
+
? 'Claro'
|
|
651
|
+
: mnc === 8
|
|
652
|
+
? 'VTR (Claro)'
|
|
653
|
+
: mnc === 9
|
|
654
|
+
? 'WOM'
|
|
655
|
+
: [14, 20, 21, 28].includes(mnc) ? 'Otro' : 'Desconocido'
|
|
611
656
|
} else if (mcc === 732) {
|
|
612
|
-
operator =
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
657
|
+
operator =
|
|
658
|
+
mnc === 1
|
|
659
|
+
? 'Telecom'
|
|
660
|
+
: mnc === 2
|
|
661
|
+
? 'Edatel'
|
|
662
|
+
: mnc === 101
|
|
663
|
+
? 'Claro'
|
|
664
|
+
: mnc === 103
|
|
665
|
+
? 'Colombia Móvil'
|
|
666
|
+
: [102, 123].includes(mnc)
|
|
667
|
+
? 'Movistar'
|
|
668
|
+
: mnc === 360 ? 'WOM' : 'Desconocido'
|
|
619
669
|
} else if (mcc === 736) {
|
|
620
|
-
operator =
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
670
|
+
operator =
|
|
671
|
+
mnc === 1
|
|
672
|
+
? 'Viva Bolivia'
|
|
673
|
+
: mnc === 2
|
|
674
|
+
? 'Entel'
|
|
675
|
+
: mnc === 3
|
|
676
|
+
? 'Telecel'
|
|
677
|
+
: mnc === 4 ? 'Cotas' : mnc === 5 ? 'Comteco' : 'Desconocido'
|
|
626
678
|
} else if (mcc === 740) {
|
|
627
|
-
operator =
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
679
|
+
operator =
|
|
680
|
+
mnc === 1
|
|
681
|
+
? 'Otecel (Movistar)'
|
|
682
|
+
: mnc === 2
|
|
683
|
+
? 'Conecel (Claro)'
|
|
684
|
+
: mnc === 0 ? 'Telecsa (CNT' : 'Desconocido'
|
|
631
685
|
} else if (mcc === 744) {
|
|
632
|
-
operator =
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
686
|
+
operator =
|
|
687
|
+
mnc === 1
|
|
688
|
+
? 'Hola Paraguay'
|
|
689
|
+
: mnc === 2
|
|
690
|
+
? 'AMX Paraguay'
|
|
691
|
+
: mnc === 3
|
|
692
|
+
? 'Comunicaciones Privadas'
|
|
693
|
+
: mnc === 4
|
|
694
|
+
? 'Telefónica Celular del Paraguay'
|
|
695
|
+
: mnc === 5 ? 'Núcleo' : 'Desconocido'
|
|
638
696
|
} else if (mcc === 748) {
|
|
639
|
-
operator =
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
'Desconocido'
|
|
697
|
+
operator = [0, 1].includes(mnc)
|
|
698
|
+
? 'Ancel'
|
|
699
|
+
: mnc === 7 ? 'Movistar' : mnc === 0 ? 'AMX Wireless' : 'Desconocido'
|
|
643
700
|
} else {
|
|
644
701
|
operator = 'Desconocido'
|
|
645
702
|
}
|
|
646
703
|
return {
|
|
647
|
-
country: latamMcc[mcc] || latamMcc.default,
|
|
704
|
+
country: latamMcc[mcc] || latamMcc.default,
|
|
705
|
+
mnc: mnc,
|
|
706
|
+
operator: operator
|
|
648
707
|
}
|
|
649
708
|
}
|
|
650
709
|
|
|
651
710
|
/*
|
|
652
711
|
Hectometer to Kilometer
|
|
653
712
|
*/
|
|
654
|
-
const hToKm =
|
|
713
|
+
const hToKm = data => {
|
|
655
714
|
let h = parseFloat(data.slice(1))
|
|
656
715
|
return parseFloat((h * 0.1).toFixed(2))
|
|
657
716
|
}
|
|
@@ -662,7 +721,9 @@ const hToKm = (data) => {
|
|
|
662
721
|
const parseCanData = (data, key) => {
|
|
663
722
|
switch (key) {
|
|
664
723
|
case 'ignitionKey':
|
|
665
|
-
return
|
|
724
|
+
return data === '0'
|
|
725
|
+
? 'ignition_off'
|
|
726
|
+
: data === '1' ? 'ignition_on' : data === '2' ? 'engine_on' : null
|
|
666
727
|
case 'totalDistance':
|
|
667
728
|
if (data.slice(0, 1) === 'H') {
|
|
668
729
|
return hToKm(data)
|
|
@@ -696,9 +757,10 @@ const parseCanData = (data, key) => {
|
|
|
696
757
|
Get CANbus data
|
|
697
758
|
*/
|
|
698
759
|
const getCanData = (parsedData, ix, type) => {
|
|
699
|
-
let canAppendMask =
|
|
700
|
-
|
|
701
|
-
|
|
760
|
+
let canAppendMask =
|
|
761
|
+
parsedData[ix + 1] !== ''
|
|
762
|
+
? nHexDigit(hex2bin(parsedData[ix + 1]), 32)
|
|
763
|
+
: null
|
|
702
764
|
if (canAppendMask === 0) {
|
|
703
765
|
return {}
|
|
704
766
|
}
|
|
@@ -737,33 +799,36 @@ const getCanData = (parsedData, ix, type) => {
|
|
|
737
799
|
.join('')
|
|
738
800
|
: '00000000000000000000000000000000'
|
|
739
801
|
|
|
740
|
-
let repExpMask =
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
802
|
+
let repExpMask =
|
|
803
|
+
canAppendMask[2] === '1'
|
|
804
|
+
? {
|
|
805
|
+
raw: parsedData[canxIx] ? parsedData[canxIx] : null,
|
|
806
|
+
adBlueLevel: canExpansionMask[0] === '1',
|
|
807
|
+
axleWeight1: canExpansionMask[1] === '1',
|
|
808
|
+
axleWeight3: canExpansionMask[2] === '1',
|
|
809
|
+
axleWeight4: canExpansionMask[3] === '1',
|
|
810
|
+
tachographOverspeedSignal: canExpansionMask[4] === '1',
|
|
811
|
+
tachographVehicleMotionSignal: canExpansionMask[5] === '1',
|
|
812
|
+
tachographDrivingDirection: canExpansionMask[6] === '1',
|
|
813
|
+
analogInputValue: canExpansionMask[7] === '1',
|
|
814
|
+
engineBrakingFactor: canExpansionMask[8] === '1',
|
|
815
|
+
pedalBrakingFactor: canExpansionMask[9] === '1',
|
|
816
|
+
totalAcceleratorKickDown: canExpansionMask[10] === '1',
|
|
817
|
+
totalEffectiveEngineSpeedTime: canExpansionMask[11] === '1',
|
|
818
|
+
totalCruiseControlTime: canExpansionMask[12] === '1',
|
|
819
|
+
totalAcceleratorKickDownTime: canExpansionMask[13] === '1',
|
|
820
|
+
totalBrakeApplications: canExpansionMask[14] === '1',
|
|
821
|
+
tachographDriver1Card: canExpansionMask[15] === '1',
|
|
822
|
+
tachographDriver2Card: canExpansionMask[16] === '1',
|
|
823
|
+
tachographDriver1Name: canExpansionMask[17] === '1',
|
|
824
|
+
tachographDriver2Name: canExpansionMask[18] === '1',
|
|
825
|
+
registrationNumber: canExpansionMask[19] === '1',
|
|
826
|
+
expansionInformation: canExpansionMask[20] === '1',
|
|
827
|
+
rapidBrakings: canExpansionMask[21] === '1',
|
|
828
|
+
rapidAccelerations: canExpansionMask[22] === '1',
|
|
829
|
+
engineTorque: canExpansionMask[23] === '1'
|
|
830
|
+
}
|
|
831
|
+
: null
|
|
767
832
|
|
|
768
833
|
let adbIx = canxIx + parseInt(canExpansionMask[0])
|
|
769
834
|
let ax1Ix = adbIx + parseInt(canExpansionMask[1])
|
|
@@ -792,35 +857,67 @@ const getCanData = (parsedData, ix, type) => {
|
|
|
792
857
|
|
|
793
858
|
// Logic for CAN data
|
|
794
859
|
let gnnsIx = etqIx + 2 + parseInt(canAppendMask[1])
|
|
795
|
-
let gsmIx =
|
|
860
|
+
let gsmIx =
|
|
861
|
+
canAppendMask[1] === '1'
|
|
862
|
+
? gnnsIx + parseInt(canAppendMask[0]) + 6
|
|
863
|
+
: gnnsIx + parseInt(canAppendMask[0])
|
|
796
864
|
|
|
797
865
|
let moreIx
|
|
798
866
|
let gnnsData = null
|
|
799
867
|
let gsmData = null
|
|
800
868
|
if (type === 'GTCAN') {
|
|
801
869
|
moreIx = canAppendMask[0] === '1' ? gsmIx + 4 : gsmIx
|
|
802
|
-
gnnsData =
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
870
|
+
gnnsData =
|
|
871
|
+
canAppendMask[1] === '1'
|
|
872
|
+
? {
|
|
873
|
+
hdop: parsedData[gnnsIx] ? parseFloat(parsedData[gnnsIx]) : null,
|
|
874
|
+
speed: parsedData[gnnsIx + 1]
|
|
875
|
+
? parseFloat(parsedData[gnnsIx + 1])
|
|
876
|
+
: null,
|
|
877
|
+
azimuth: parsedData[gnnsIx + 2]
|
|
878
|
+
? parseFloat(parsedData[gnnsIx + 2])
|
|
879
|
+
: null,
|
|
880
|
+
altitude: parsedData[gnnsIx + 3]
|
|
881
|
+
? parseFloat(parsedData[gnnsIx + 3])
|
|
882
|
+
: null,
|
|
883
|
+
loc: {
|
|
884
|
+
type: 'Point',
|
|
885
|
+
coordinates: [
|
|
886
|
+
parseFloat(parsedData[gnnsIx + 4]),
|
|
887
|
+
parseFloat(parsedData[gnnsIx + 5])
|
|
888
|
+
]
|
|
889
|
+
},
|
|
890
|
+
gpsStatus: checkGps(
|
|
891
|
+
parseFloat(parsedData[gnnsIx + 4]),
|
|
892
|
+
parseFloat(parsedData[gnnsIx + 5])
|
|
893
|
+
),
|
|
894
|
+
datetime: parsedData[gnnsIx + 6]
|
|
895
|
+
? parseDate(parsedData[gnnsIx + 6])
|
|
896
|
+
: null
|
|
897
|
+
}
|
|
898
|
+
: null
|
|
899
|
+
|
|
900
|
+
gsmData =
|
|
901
|
+
canAppendMask[0] === '1'
|
|
902
|
+
? {
|
|
903
|
+
mcc:
|
|
904
|
+
parsedData[gsmIx] !== ''
|
|
905
|
+
? latamMcc[parseInt(parsedData[gsmIx], 10)]
|
|
906
|
+
: null,
|
|
907
|
+
mnc:
|
|
908
|
+
parsedData[gsmIx + 1] !== ''
|
|
909
|
+
? getMNC(parsedData[gsmIx], parsedData[gsmIx + 1])
|
|
910
|
+
: null,
|
|
911
|
+
lac:
|
|
912
|
+
parsedData[gsmIx + 2] !== ''
|
|
913
|
+
? parseInt(parsedData[gsmIx + 2], 16)
|
|
914
|
+
: null,
|
|
915
|
+
cid:
|
|
916
|
+
parsedData[gsmIx + 3] !== ''
|
|
917
|
+
? parseInt(parsedData[gsmIx + 3], 16)
|
|
918
|
+
: null
|
|
919
|
+
}
|
|
920
|
+
: null
|
|
824
921
|
} else {
|
|
825
922
|
moreIx = etqIx + 1
|
|
826
923
|
}
|
|
@@ -888,133 +985,280 @@ const getCanData = (parsedData, ix, type) => {
|
|
|
888
985
|
gnssInformation: canAppendMask[1] === '1',
|
|
889
986
|
gsmInformation: canAppendMask[0] === '1'
|
|
890
987
|
},
|
|
891
|
-
vin:
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
988
|
+
vin:
|
|
989
|
+
canAppendMask[31] === '1' && parsedData[vinIx]
|
|
990
|
+
? parsedData[vinIx]
|
|
991
|
+
: null,
|
|
992
|
+
ignitionKey:
|
|
993
|
+
canAppendMask[30] === '1' && parsedData[ignIx]
|
|
994
|
+
? parseCanData(parsedData[ignIx], 'ignitionKey')
|
|
995
|
+
: null,
|
|
996
|
+
totalDistance:
|
|
997
|
+
canAppendMask[29] === '1' && parsedData[disIx]
|
|
998
|
+
? parseCanData(parsedData[disIx], 'totalDistance')
|
|
999
|
+
: null,
|
|
1000
|
+
totalDistanceUnit:
|
|
1001
|
+
canAppendMask[29] === '1' && parsedData[disIx]
|
|
1002
|
+
? parsedData[disIx].slice(0, 1) === 'H' ? 'km' : 'I'
|
|
1003
|
+
: null,
|
|
1004
|
+
fuelUsed:
|
|
1005
|
+
canAppendMask[28] === '1' && parsedData[fuelIx]
|
|
1006
|
+
? parseFloat(parsedData[fuelIx])
|
|
1007
|
+
: null,
|
|
1008
|
+
speed:
|
|
1009
|
+
canAppendMask[27] === '1' && parsedData[spdIx]
|
|
1010
|
+
? parseFloat(parsedData[spdIx])
|
|
1011
|
+
: null,
|
|
1012
|
+
rpm:
|
|
1013
|
+
canAppendMask[26] === '1' && parsedData[rpmIx]
|
|
1014
|
+
? parseInt(parsedData[rpmIx], 10)
|
|
1015
|
+
: null,
|
|
898
1016
|
engineCoolantTemp:
|
|
899
|
-
canAppendMask[25] === '1' && parsedData[engcIx]
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1017
|
+
canAppendMask[25] === '1' && parsedData[engcIx]
|
|
1018
|
+
? parseInt(parsedData[engcIx], 10)
|
|
1019
|
+
: null,
|
|
1020
|
+
fuelConsumption:
|
|
1021
|
+
canAppendMask[24] === '1' && parsedData[fuelcIx]
|
|
1022
|
+
? parseCanData(parsedData[fuelcIx], 'fuelConsumption')
|
|
1023
|
+
: null,
|
|
1024
|
+
fuelLevel:
|
|
1025
|
+
canAppendMask[23] === '1' && parsedData[fuellIx]
|
|
1026
|
+
? parseFloat(parsedData[fuellIx].slice(1))
|
|
1027
|
+
: null,
|
|
1028
|
+
fuelLevelUnit:
|
|
1029
|
+
canAppendMask[23] === '1' && parsedData[fuellIx]
|
|
1030
|
+
? parsedData[fuellIx].slice(0, 1) === 'P' ? '%' : 'L'
|
|
1031
|
+
: null,
|
|
1032
|
+
range:
|
|
1033
|
+
canAppendMask[22] === '1' && parsedData[rngIx]
|
|
1034
|
+
? parseCanData(parsedData[rngIx], 'range')
|
|
1035
|
+
: null,
|
|
904
1036
|
acceleratorPressure:
|
|
905
|
-
canAppendMask[21] === '1' && parsedData[accIx]
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1037
|
+
canAppendMask[21] === '1' && parsedData[accIx]
|
|
1038
|
+
? parseFloat(parsedData[accIx])
|
|
1039
|
+
: null,
|
|
1040
|
+
engineHours:
|
|
1041
|
+
canAppendMask[20] === '1' && parsedData[enghIx]
|
|
1042
|
+
? parseFloat(parsedData[enghIx])
|
|
1043
|
+
: null,
|
|
1044
|
+
drivingTime:
|
|
1045
|
+
canAppendMask[19] === '1' && parsedData[drvIx]
|
|
1046
|
+
? parseFloat(parsedData[drvIx])
|
|
1047
|
+
: null,
|
|
1048
|
+
idleTime:
|
|
1049
|
+
canAppendMask[18] === '1' && parsedData[idltIx]
|
|
1050
|
+
? parseFloat(parsedData[idltIx])
|
|
1051
|
+
: null,
|
|
1052
|
+
idleFuelUsed:
|
|
1053
|
+
canAppendMask[17] === '1' && parsedData[idlfIx]
|
|
1054
|
+
? parseFloat(parsedData[idlfIx])
|
|
1055
|
+
: null,
|
|
1056
|
+
axleWeight2:
|
|
1057
|
+
canAppendMask[16] === '1' && parsedData[axlwIx]
|
|
1058
|
+
? parseFloat(parsedData[axlwIx])
|
|
1059
|
+
: null,
|
|
1060
|
+
tachograph:
|
|
1061
|
+
canAppendMask[15] === '1' && parsedData[tacIx]
|
|
1062
|
+
? {
|
|
1063
|
+
raw: parsedData[tacIx] ? parsedData[tacIx] : null,
|
|
1064
|
+
validDriverData: tachographBin ? tachographBin[7] === '1' : null,
|
|
1065
|
+
insertedDriverCard: tachographBin
|
|
1066
|
+
? tachographBin[5] === '1'
|
|
1067
|
+
: null,
|
|
1068
|
+
driverWorkingState: tachographBin
|
|
1069
|
+
? dWorkingStates[parseInt(tachographBin.substring(3, 5), 2)]
|
|
1070
|
+
: null,
|
|
1071
|
+
drivingTimeState: tachographBin
|
|
1072
|
+
? dTimeStates[parseInt(tachographBin.substring(5, 8), 2)]
|
|
1073
|
+
: null
|
|
1074
|
+
}
|
|
1075
|
+
: null,
|
|
1076
|
+
indicators:
|
|
1077
|
+
canAppendMask[14] === '1' && inicatorsBin
|
|
1078
|
+
? {
|
|
1079
|
+
raw: inicatorsBin ? parsedData[indIx] : null,
|
|
1080
|
+
lowFuel: inicatorsBin ? inicatorsBin[0] === '1' : null,
|
|
1081
|
+
driverSeatbelt: inicatorsBin ? inicatorsBin[1] === '1' : null,
|
|
1082
|
+
airConditioning: inicatorsBin ? inicatorsBin[2] === '1' : null,
|
|
1083
|
+
cruiseControl: inicatorsBin ? inicatorsBin[3] === '1' : null,
|
|
1084
|
+
brakePedal: inicatorsBin ? inicatorsBin[4] === '1' : null,
|
|
1085
|
+
clutchPedal: inicatorsBin ? inicatorsBin[5] === '1' : null,
|
|
1086
|
+
handbrake: inicatorsBin ? inicatorsBin[6] === '1' : null,
|
|
1087
|
+
centralLock: inicatorsBin ? inicatorsBin[7] === '1' : null,
|
|
1088
|
+
reverseGear: inicatorsBin ? inicatorsBin[8] === '1' : null,
|
|
1089
|
+
runningLights: inicatorsBin ? inicatorsBin[9] === '1' : null,
|
|
1090
|
+
lowBeams: inicatorsBin ? inicatorsBin[10] === '1' : null,
|
|
1091
|
+
highBeams: inicatorsBin ? inicatorsBin[11] === '1' : null,
|
|
1092
|
+
rearFogLights: inicatorsBin ? inicatorsBin[12] === '1' : null,
|
|
1093
|
+
frontFogLights: inicatorsBin ? inicatorsBin[13] === '1' : null,
|
|
1094
|
+
doors: inicatorsBin ? inicatorsBin[14] === '1' : null,
|
|
1095
|
+
trunk: inicatorsBin ? inicatorsBin[15] === '1' : null
|
|
1096
|
+
}
|
|
1097
|
+
: null,
|
|
1098
|
+
lights:
|
|
1099
|
+
canAppendMask[13] === '1' && lights
|
|
1100
|
+
? {
|
|
1101
|
+
raw: lights ? parsedData[ligIx] : null,
|
|
1102
|
+
running: lights ? lights[0] === '1' : null,
|
|
1103
|
+
lowBeams: lights ? lights[1] === '1' : null,
|
|
1104
|
+
frontFog: lights ? lights[2] === '1' : null,
|
|
1105
|
+
rearFog: lights ? lights[3] === '1' : null,
|
|
1106
|
+
hazard: lights ? lights[4] === '1' : null
|
|
1107
|
+
}
|
|
1108
|
+
: null,
|
|
1109
|
+
doors:
|
|
1110
|
+
canAppendMask[12] === '1' && doors
|
|
1111
|
+
? {
|
|
1112
|
+
raw: doors ? parsedData[doorIx] : null,
|
|
1113
|
+
driver: doors ? doors[0] === '1' : null,
|
|
1114
|
+
passenger: doors ? doors[1] === '1' : null,
|
|
1115
|
+
rearLeft: doors ? doors[2] === '1' : null,
|
|
1116
|
+
rearRight: doors ? doors[3] === '1' : null,
|
|
1117
|
+
trunk: doors ? doors[4] === '1' : null,
|
|
1118
|
+
hood: doors ? doors[5] === '1' : null
|
|
1119
|
+
}
|
|
1120
|
+
: null,
|
|
1121
|
+
overSpeedTime:
|
|
1122
|
+
canAppendMask[11] === '1' && parsedData[osptIx]
|
|
1123
|
+
? parseFloat(parsedData[osptIx])
|
|
1124
|
+
: null,
|
|
1125
|
+
overSpeedEngineTime:
|
|
1126
|
+
canAppendMask[10] === '1' && parsedData[ospeIx]
|
|
1127
|
+
? parseFloat(parsedData[ospeIx])
|
|
917
1128
|
: null,
|
|
918
|
-
drivingTimeState: tachographBin
|
|
919
|
-
? dTimeStates[parseInt(tachographBin.substring(5, 8), 2)]
|
|
920
|
-
: null
|
|
921
|
-
} : null,
|
|
922
|
-
indicators: canAppendMask[14] === '1' && inicatorsBin ? {
|
|
923
|
-
raw: inicatorsBin ? parsedData[indIx] : null,
|
|
924
|
-
lowFuel: inicatorsBin ? inicatorsBin[0] === '1' : null,
|
|
925
|
-
driverSeatbelt: inicatorsBin ? inicatorsBin[1] === '1' : null,
|
|
926
|
-
airConditioning: inicatorsBin ? inicatorsBin[2] === '1' : null,
|
|
927
|
-
cruiseControl: inicatorsBin ? inicatorsBin[3] === '1' : null,
|
|
928
|
-
brakePedal: inicatorsBin ? inicatorsBin[4] === '1' : null,
|
|
929
|
-
clutchPedal: inicatorsBin ? inicatorsBin[5] === '1' : null,
|
|
930
|
-
handbrake: inicatorsBin ? inicatorsBin[6] === '1' : null,
|
|
931
|
-
centralLock: inicatorsBin ? inicatorsBin[7] === '1' : null,
|
|
932
|
-
reverseGear: inicatorsBin ? inicatorsBin[8] === '1' : null,
|
|
933
|
-
runningLights: inicatorsBin ? inicatorsBin[9] === '1' : null,
|
|
934
|
-
lowBeams: inicatorsBin ? inicatorsBin[10] === '1' : null,
|
|
935
|
-
highBeams: inicatorsBin ? inicatorsBin[11] === '1' : null,
|
|
936
|
-
rearFogLights: inicatorsBin ? inicatorsBin[12] === '1' : null,
|
|
937
|
-
frontFogLights: inicatorsBin ? inicatorsBin[13] === '1' : null,
|
|
938
|
-
doors: inicatorsBin ? inicatorsBin[14] === '1' : null,
|
|
939
|
-
trunk: inicatorsBin ? inicatorsBin[15] === '1' : null
|
|
940
|
-
} : null,
|
|
941
|
-
lights: canAppendMask[13] === '1' && lights ? {
|
|
942
|
-
raw: lights ? parsedData[ligIx] : null,
|
|
943
|
-
running: lights ? lights[0] === '1' : null,
|
|
944
|
-
lowBeams: lights ? lights[1] === '1' : null,
|
|
945
|
-
frontFog: lights ? lights[2] === '1' : null,
|
|
946
|
-
rearFog: lights ? lights[3] === '1' : null,
|
|
947
|
-
hazard: lights ? lights[4] === '1' : null
|
|
948
|
-
} : null,
|
|
949
|
-
doors: canAppendMask[12] === '1' && doors ? {
|
|
950
|
-
raw: doors ? parsedData[doorIx] : null,
|
|
951
|
-
driver: doors ? doors[0] === '1' : null,
|
|
952
|
-
passenger: doors ? doors[1] === '1' : null,
|
|
953
|
-
rearLeft: doors ? doors[2] === '1' : null,
|
|
954
|
-
rearRight: doors ? doors[3] === '1' : null,
|
|
955
|
-
trunk: doors ? doors[4] === '1' : null,
|
|
956
|
-
hood: doors ? doors[5] === '1' : null
|
|
957
|
-
} : null,
|
|
958
|
-
overSpeedTime: canAppendMask[11] === '1' && parsedData[osptIx] ? parseFloat(parsedData[osptIx]) : null,
|
|
959
|
-
overSpeedEngineTime: canAppendMask[10] === '1' && parsedData[ospeIx] ? parseFloat(parsedData[ospeIx]) : null,
|
|
960
1129
|
canExpanded: {
|
|
961
1130
|
canReportExpansionMask: repExpMask,
|
|
962
|
-
adBlueLevel:
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
parsedData[
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1131
|
+
adBlueLevel:
|
|
1132
|
+
repExpMask && repExpMask.adBlueLevel && parsedData[adbIx]
|
|
1133
|
+
? parseCanData(parsedData[adbIx], 'adBlueLevel')
|
|
1134
|
+
: null,
|
|
1135
|
+
adBlueLevelUnit:
|
|
1136
|
+
repExpMask && repExpMask.adBlueLevelUnit && parsedData[adbIx]
|
|
1137
|
+
? parsedData[adbIx].slice(0, 1) === 'P' ? '%' : 'L'
|
|
1138
|
+
: null,
|
|
1139
|
+
axleWeight1:
|
|
1140
|
+
repExpMask && repExpMask.axleWeight1 && parsedData[ax1Ix]
|
|
1141
|
+
? parseInt(parsedData[ax1Ix])
|
|
1142
|
+
: null,
|
|
1143
|
+
axleWeight3:
|
|
1144
|
+
repExpMask && repExpMask.axleWeight3 && parsedData[ax3Ix]
|
|
1145
|
+
? parseInt(parsedData[ax3Ix])
|
|
1146
|
+
: null,
|
|
1147
|
+
axleWeight4:
|
|
1148
|
+
repExpMask && repExpMask.axleWeight4 && parsedData[ax4Ix]
|
|
1149
|
+
? parseInt(parsedData[ax4Ix])
|
|
1150
|
+
: null,
|
|
1151
|
+
tachographOverspeedSignal:
|
|
1152
|
+
repExpMask &&
|
|
1153
|
+
repExpMask.tachographOverspeedSignal &&
|
|
1154
|
+
parsedData[tosIx]
|
|
1155
|
+
? parsedData[tosIx] === '1'
|
|
1156
|
+
: null,
|
|
1157
|
+
tachographVehicleMotionSignal:
|
|
1158
|
+
repExpMask &&
|
|
1159
|
+
repExpMask.tachographVehicleMotionSignal &&
|
|
1160
|
+
parsedData[tvmIx]
|
|
1161
|
+
? parsedData[tvmIx] === '1'
|
|
1162
|
+
: null,
|
|
1163
|
+
tachographDrivingDirection:
|
|
1164
|
+
repExpMask &&
|
|
1165
|
+
repExpMask.tachographDrivingDirection &&
|
|
1166
|
+
parsedData[tddIx]
|
|
1167
|
+
? parseCanData(parsedData[tddIx], 'tachographDrivingDirection')
|
|
1168
|
+
: null,
|
|
1169
|
+
analogInputValue:
|
|
1170
|
+
repExpMask && repExpMask.analogInputValue && parsedData[aivIx]
|
|
1171
|
+
? parseFloat(parsedData[aivIx]) * 1000
|
|
1172
|
+
: null,
|
|
1173
|
+
engineBrakingFactor:
|
|
1174
|
+
repExpMask && repExpMask.engineBrakingFactor && parsedData[ebrIx]
|
|
1175
|
+
? parseInt(parsedData[ebrIx])
|
|
1176
|
+
: null,
|
|
1177
|
+
pedalBrakingFactor:
|
|
1178
|
+
repExpMask && repExpMask.pedalBrakingFactor && parsedData[pbrIx]
|
|
1179
|
+
? parseInt(parsedData[pbrIx])
|
|
1180
|
+
: null,
|
|
1181
|
+
totalAcceleratorKickDown:
|
|
1182
|
+
repExpMask && repExpMask.totalAcceleratorKickDown && parsedData[ackIx]
|
|
1183
|
+
? parseInt(parsedData[ackIx])
|
|
1184
|
+
: null,
|
|
1185
|
+
totalEffectiveEngineSpeedTime:
|
|
1186
|
+
repExpMask &&
|
|
1187
|
+
repExpMask.totalEffectiveEngineSpeedTime &&
|
|
1188
|
+
parsedData[eesIx]
|
|
1189
|
+
? parseFloat(parsedData[eesIx])
|
|
1190
|
+
: null,
|
|
1191
|
+
totalCruiseControlTime:
|
|
1192
|
+
repExpMask && repExpMask.totalCruiseControlTime && parsedData[crcIx]
|
|
1193
|
+
? parseFloat(parsedData[crcIx])
|
|
1194
|
+
: null,
|
|
1195
|
+
totalAcceleratorKickDownTime:
|
|
1196
|
+
repExpMask &&
|
|
1197
|
+
repExpMask.totalAcceleratorKickDownTime &&
|
|
1198
|
+
parsedData[acktIx]
|
|
1199
|
+
? parseFloat(parsedData[acktIx])
|
|
1200
|
+
: null,
|
|
1201
|
+
totalBrakeApplications:
|
|
1202
|
+
repExpMask && repExpMask.totalBrakeApplications && parsedData[braIx]
|
|
1203
|
+
? parseInt(parsedData[braIx])
|
|
1204
|
+
: null,
|
|
1205
|
+
tachographDriver1Card:
|
|
1206
|
+
repExpMask && repExpMask.tachographDriver1Card && parsedData[tdc1Ix]
|
|
1207
|
+
? parsedData[tdc1Ix]
|
|
1208
|
+
: null,
|
|
1209
|
+
tachographDriver2Card:
|
|
1210
|
+
repExpMask && repExpMask.tachographDriver2Card && parsedData[tdc2Ix]
|
|
1211
|
+
? parsedData[tdc2Ix]
|
|
1212
|
+
: null,
|
|
1213
|
+
tachographDriver1Name:
|
|
1214
|
+
repExpMask && repExpMask.tachographDriver1Name && parsedData[tdn1Ix]
|
|
1215
|
+
? parsedData[tdn1Ix]
|
|
1216
|
+
: null,
|
|
1217
|
+
tachographDriver2Name:
|
|
1218
|
+
repExpMask && repExpMask.tachographDriver2Name && parsedData[tdn2Ix]
|
|
1219
|
+
? parsedData[tdn2Ix]
|
|
1220
|
+
: null,
|
|
1221
|
+
registrationNumber:
|
|
1222
|
+
repExpMask && repExpMask.registrationNumber && parsedData[regIx]
|
|
1223
|
+
? parsedData[regIx]
|
|
1224
|
+
: null,
|
|
1225
|
+
expansionInformation:
|
|
1226
|
+
repExpMask &&
|
|
1227
|
+
repExpMask.expansionInformation &&
|
|
1228
|
+
expansionBin !== '0000000000000000'
|
|
1229
|
+
? {
|
|
1230
|
+
raw: parsedData[expbIx] ? parsedData[expbIx] : null,
|
|
1231
|
+
webasto: expansionBin[0] === '1',
|
|
1232
|
+
brakeFluidLowIndicator: expansionBin[1] === '1',
|
|
1233
|
+
coolantLevelLowIndicator: expansionBin[2] === '1',
|
|
1234
|
+
batteryIndicator: expansionBin[3] === '1',
|
|
1235
|
+
brakeSystemFailureIndicator: expansionBin[4] === '1',
|
|
1236
|
+
oilPressureIndicator: expansionBin[5] === '1',
|
|
1237
|
+
engineHotIndicator: expansionBin[6] === '1',
|
|
1238
|
+
ABSFailureIndicator: expansionBin[7] === '1',
|
|
1239
|
+
checkEngineIndicator: expansionBin[9] === '1',
|
|
1240
|
+
airbagsIndicator: expansionBin[10] === '1',
|
|
1241
|
+
serviceCallIndicator: expansionBin[11] === '1',
|
|
1242
|
+
oilLevelLowIndicator: expansionBin[12] === '1'
|
|
1243
|
+
}
|
|
1244
|
+
: null,
|
|
1245
|
+
rapidBrakings:
|
|
1246
|
+
repExpMask && repExpMask.rapidBrakings && parsedData[rbrIx]
|
|
1247
|
+
? parseInt(parsedData[rbrIx])
|
|
1248
|
+
: null,
|
|
1249
|
+
rapidAccelerations:
|
|
1250
|
+
repExpMask && repExpMask.rapidAccelerations && parsedData[racIx]
|
|
1251
|
+
? parseInt(parsedData[racIx])
|
|
1252
|
+
: null,
|
|
1253
|
+
engineTorque:
|
|
1254
|
+
repExpMask && repExpMask.engineTorque && parsedData[etqIx]
|
|
1255
|
+
? parseFloat(parsedData[etqIx])
|
|
1256
|
+
: null
|
|
1013
1257
|
}
|
|
1014
|
-
}
|
|
1258
|
+
}
|
|
1259
|
+
]
|
|
1015
1260
|
}
|
|
1016
1261
|
|
|
1017
|
-
|
|
1018
1262
|
/*
|
|
1019
1263
|
Get Bluetooth data
|
|
1020
1264
|
*/
|
|
@@ -1033,21 +1277,28 @@ const getBleData = (parsedData, btIndex) => {
|
|
|
1033
1277
|
let aTmpIx = aBatIx + parseInt(appendMask[11])
|
|
1034
1278
|
let aHumIx = aTmpIx + parseInt(appendMask[10])
|
|
1035
1279
|
let ioIx = aHumIx + parseInt(appendMask[8])
|
|
1036
|
-
let aEvIx =
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1280
|
+
let aEvIx =
|
|
1281
|
+
appendMask[8] === '1' && appendMask[7] === '1'
|
|
1282
|
+
? ioIx + 3
|
|
1283
|
+
: ioIx + parseInt(appendMask[7])
|
|
1284
|
+
let pressIx =
|
|
1285
|
+
appendMask[7] === '1' && appendMask[6] === '1'
|
|
1286
|
+
? aEvIx + 2
|
|
1287
|
+
: aEvIx + parseInt(appendMask[6])
|
|
1040
1288
|
let timeIx = pressIx + parseInt(appendMask[5])
|
|
1041
1289
|
let eTmpIx = timeIx + parseInt(appendMask[4])
|
|
1042
1290
|
let magIx = eTmpIx + parseInt(appendMask[3])
|
|
1043
|
-
let aBatpIx =
|
|
1044
|
-
|
|
1291
|
+
let aBatpIx =
|
|
1292
|
+
appendMask[3] === '1' && appendMask[2] === '1'
|
|
1293
|
+
? magIx + 3
|
|
1294
|
+
: magIx + parseInt(appendMask[2])
|
|
1045
1295
|
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
1046
1296
|
|
|
1047
1297
|
let bleType = bluetoothAccessories[parsedData[cnt + 1]]
|
|
1048
|
-
let bleModel =
|
|
1049
|
-
|
|
1050
|
-
|
|
1298
|
+
let bleModel =
|
|
1299
|
+
parsedData[cnt + 2] !== ''
|
|
1300
|
+
? bluetoothModels[parsedData[cnt + 1]][parsedData[cnt + 2]]
|
|
1301
|
+
: null
|
|
1051
1302
|
let rawAppendMask = parsedData[cnt + 4]
|
|
1052
1303
|
|
|
1053
1304
|
btDevices.push({
|
|
@@ -1076,15 +1327,32 @@ const getBleData = (parsedData, btIndex) => {
|
|
|
1076
1327
|
? parseFloat(parsedData[aBatpIx])
|
|
1077
1328
|
: null,
|
|
1078
1329
|
accessoryData: {
|
|
1079
|
-
data:
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1330
|
+
data:
|
|
1331
|
+
parsedData[cnt + 3] !== ''
|
|
1332
|
+
? {
|
|
1333
|
+
raw: parsedData[cnt + 3],
|
|
1334
|
+
temperature: getBleTempInCelciousDegrees(
|
|
1335
|
+
bleModel,
|
|
1336
|
+
parsedData[cnt + 3]
|
|
1337
|
+
),
|
|
1338
|
+
humidity: getBleHumidityInRH(bleModel, parsedData[cnt + 3]),
|
|
1339
|
+
relayState:
|
|
1340
|
+
bleModel === 'WRL300'
|
|
1341
|
+
? parseInt(parsedData[cnt + 3]) === 1
|
|
1342
|
+
? 'Connected'
|
|
1343
|
+
: 'Disconnected'
|
|
1344
|
+
: null,
|
|
1345
|
+
tirePresure: getTirePressureInPSI(parsedData[cnt + 3]),
|
|
1346
|
+
productModel:
|
|
1347
|
+
bleModel === 'ATP100/ATP102'
|
|
1348
|
+
? parsedData[cnt + 3].substring(6, 7)
|
|
1349
|
+
: null,
|
|
1350
|
+
fwVersion:
|
|
1351
|
+
bleModel === 'ATP100/ATP102'
|
|
1352
|
+
? parsedData[cnt + 3].substring(7, 8)
|
|
1353
|
+
: null
|
|
1354
|
+
}
|
|
1355
|
+
: null,
|
|
1088
1356
|
temperature:
|
|
1089
1357
|
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
1090
1358
|
? parseInt(parsedData[aTmpIx])
|
|
@@ -1154,9 +1422,8 @@ const getBleData = (parsedData, btIndex) => {
|
|
|
1154
1422
|
btDevices.push({
|
|
1155
1423
|
index: parsedData[cnt],
|
|
1156
1424
|
type: beaconTypes[parsedData[cnt + 1]],
|
|
1157
|
-
model:
|
|
1158
|
-
? beaconModels[parsedData[cnt + 2]]
|
|
1159
|
-
: null,
|
|
1425
|
+
model:
|
|
1426
|
+
parsedData[cnt + 2] !== '' ? beaconModels[parsedData[cnt + 2]] : null,
|
|
1160
1427
|
appendMask: parsedData[cnt + 3],
|
|
1161
1428
|
mac:
|
|
1162
1429
|
parsedData[aMacIx] !== '' && appendMask[6] === '1'
|
|
@@ -1177,7 +1444,7 @@ const getBleData = (parsedData, btIndex) => {
|
|
|
1177
1444
|
beaconData:
|
|
1178
1445
|
parsedData[bTypeIx + 1] !== '' && appendMask[0] === '1'
|
|
1179
1446
|
? parseInt(parsedData[bTypeIx + 1])
|
|
1180
|
-
: null
|
|
1447
|
+
: null
|
|
1181
1448
|
})
|
|
1182
1449
|
cnt = bTypeIx + 1 + parseInt(appendMask[1])
|
|
1183
1450
|
}
|
|
@@ -1249,9 +1516,15 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1249
1516
|
if (extra === true && reportID === 1) {
|
|
1250
1517
|
reportID = 2
|
|
1251
1518
|
} else if (
|
|
1252
|
-
[
|
|
1253
|
-
|
|
1254
|
-
|
|
1519
|
+
[
|
|
1520
|
+
'gv800w',
|
|
1521
|
+
'gv600w',
|
|
1522
|
+
'gv300w',
|
|
1523
|
+
'gv310lau',
|
|
1524
|
+
'gv58lau',
|
|
1525
|
+
'gv75w',
|
|
1526
|
+
'GMT100'
|
|
1527
|
+
].includes(extra)
|
|
1255
1528
|
) {
|
|
1256
1529
|
reportID += 1
|
|
1257
1530
|
}
|
|
@@ -1494,8 +1767,9 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1494
1767
|
message: messages[command].replace('consumption', consumption)
|
|
1495
1768
|
}
|
|
1496
1769
|
} else if (command === 'GTIDA') {
|
|
1497
|
-
const status =
|
|
1498
|
-
|
|
1770
|
+
const status = report.split(',')[1]
|
|
1771
|
+
? parseInt(report.split(',')[1], 10)
|
|
1772
|
+
: null
|
|
1499
1773
|
const driverID = report.split(',')[0] !== null ? report.split(',')[0] : null
|
|
1500
1774
|
return {
|
|
1501
1775
|
type: 'Driver_Identification',
|
|
@@ -1576,16 +1850,23 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1576
1850
|
let x = getAccelerationMagnitude(extra[0].substring(0, 4), 4)
|
|
1577
1851
|
let y = getAccelerationMagnitude(extra[0].substring(4, 8), 4)
|
|
1578
1852
|
let z = getAccelerationMagnitude(extra[0].substring(8, 12), 4)
|
|
1853
|
+
let duration = extra[1]
|
|
1854
|
+
let speed = extra[2]
|
|
1855
|
+
let magnitude = Number(
|
|
1856
|
+
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)).toFixed(2)
|
|
1857
|
+
).toString()
|
|
1579
1858
|
return {
|
|
1580
1859
|
type: 'Harsh_Behavior',
|
|
1581
1860
|
status: parseInt(report[1], 10),
|
|
1582
1861
|
calibration: report[0] === '2',
|
|
1583
|
-
duration:
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
).toString(),
|
|
1862
|
+
duration: duration,
|
|
1863
|
+
speed: speed,
|
|
1864
|
+
magnitude: magnitude,
|
|
1587
1865
|
xyz: { x: x, y: y, z: z },
|
|
1588
1866
|
message: messages[command][report[1]]
|
|
1867
|
+
.replace('X', magnitude)
|
|
1868
|
+
.replace('Y', speed)
|
|
1869
|
+
.replace('Z', duration)
|
|
1589
1870
|
}
|
|
1590
1871
|
} else if (command === 'GTCRA') {
|
|
1591
1872
|
return {
|
|
@@ -1692,7 +1973,9 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1692
1973
|
if (['01', '02', '03'].includes(report)) {
|
|
1693
1974
|
const number = parseInt(extra[0])
|
|
1694
1975
|
const mac = extra[1]
|
|
1695
|
-
const temperature = extra[2].enhancedTemperature
|
|
1976
|
+
const temperature = extra[2].enhancedTemperature
|
|
1977
|
+
? extra[2].enhancedTemperature
|
|
1978
|
+
: extra[2].temperature
|
|
1696
1979
|
const status = report !== '03' // 01 & 02 means outside range, 03 means inside range
|
|
1697
1980
|
return {
|
|
1698
1981
|
type: 'Outside_Temperature',
|
|
@@ -1744,7 +2027,9 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1744
2027
|
const mac = extra[1]
|
|
1745
2028
|
const status = extra[2].relay.state === 1
|
|
1746
2029
|
const humanStatus = status ? 'activado' : 'desactivado'
|
|
1747
|
-
const configResult = extra[2].relay.configResult
|
|
2030
|
+
const configResult = extra[2].relay.configResult
|
|
2031
|
+
? extra[2].relay.configResult
|
|
2032
|
+
: null
|
|
1748
2033
|
return {
|
|
1749
2034
|
type: 'Relay_BLE',
|
|
1750
2035
|
number: number,
|
|
@@ -1759,8 +2044,16 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1759
2044
|
message: messages[command][report]
|
|
1760
2045
|
}
|
|
1761
2046
|
}
|
|
1762
|
-
|
|
1763
|
-
|
|
2047
|
+
} else if (command === 'GSENSOR') {
|
|
2048
|
+
return {
|
|
2049
|
+
type: 'Motion',
|
|
2050
|
+
message: messages[command][report]
|
|
2051
|
+
}
|
|
2052
|
+
} else if (command === 'LIGHT') {
|
|
2053
|
+
return {
|
|
2054
|
+
type: 'Light',
|
|
2055
|
+
message: messages[command]
|
|
2056
|
+
}
|
|
1764
2057
|
} else {
|
|
1765
2058
|
return {
|
|
1766
2059
|
type: command,
|
|
@@ -1775,7 +2068,7 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1775
2068
|
const createDefaultOut = (size, defaultValue) => {
|
|
1776
2069
|
return Object.fromEntries(
|
|
1777
2070
|
Array.from({ length: size }, (_, i) => [i + 1, defaultValue])
|
|
1778
|
-
)
|
|
2071
|
+
)
|
|
1779
2072
|
}
|
|
1780
2073
|
|
|
1781
2074
|
/*
|
|
@@ -1886,10 +2179,12 @@ const parseDate = date => {
|
|
|
1886
2179
|
module.exports = {
|
|
1887
2180
|
langs: langs,
|
|
1888
2181
|
patterns: patterns,
|
|
2182
|
+
nackCauses: nackCauses,
|
|
1889
2183
|
OBDIIProtocols: OBDIIProtocols,
|
|
1890
2184
|
states: states,
|
|
1891
2185
|
uartDeviceTypes: uartDeviceTypes,
|
|
1892
2186
|
networkTypes: networkTypes,
|
|
2187
|
+
gpsSignalStrength: gpsSignalStrength,
|
|
1893
2188
|
externalGPSAntennaOptions: externalGPSAntennaOptions,
|
|
1894
2189
|
peerRoles: peerRoles,
|
|
1895
2190
|
peerAddressesTypes: peerAddressesTypes,
|