queclink-parser 1.9.13 → 1.9.14
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 +19 -0
- package/example.js +29 -32
- package/package.json +1 -1
- package/src/gv310lau.js +94 -211
- package/src/gv57cg.js +4 -4
- package/src/gv58lau.js +94 -257
- package/src/index.js +8 -1
- package/src/messages/es.json +10 -10
- package/src/utils.js +249 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
#### 1.9.14 (2025-01-27)
|
|
2
|
+
|
|
3
|
+
##### New Features
|
|
4
|
+
|
|
5
|
+
* **WID310:** se agrega soporte para WID310 en reporte ERI ([1631319c](https://github.com/jaayesta/queclink-parser/commit/1631319c827f633cbb1ef61298f5f83ac19098b8))
|
|
6
|
+
* **temp:** se agrega alarma de temperatura para dispositivos BLE ([d45f73b9](https://github.com/jaayesta/queclink-parser/commit/d45f73b996e8e861be9e8f10a36b886a03e38d66))
|
|
7
|
+
* **bleData:** se cambia la forma de obtener datos de bluetooth por ERI ([f6ef1f22](https://github.com/jaayesta/queclink-parser/commit/f6ef1f2258b2562dde79974e306b35d1728a9b8c))
|
|
8
|
+
* **bleAlarms:** se agregan alarmas BLE ([abfc04a4](https://github.com/jaayesta/queclink-parser/commit/abfc04a464980a5580b982af252f338b4dde2625))
|
|
9
|
+
|
|
10
|
+
##### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **eri:**
|
|
13
|
+
* se corrigen problemas de indexación pendientes BLE para reporte ERI ([460a53bd](https://github.com/jaayesta/queclink-parser/commit/460a53bd6b2fd3f4439534f5d1620fbeccff9ce7))
|
|
14
|
+
* se corrigen problemas de indexación BLE para reporte ERI ([a2b978f8](https://github.com/jaayesta/queclink-parser/commit/a2b978f8e0de62fbfe5076bf5a2a675e1f2b0412))
|
|
15
|
+
* **BAA:**
|
|
16
|
+
* se corrige error en el indexado de reporte GTBAA para GV310LAU ([344fb52f](https://github.com/jaayesta/queclink-parser/commit/344fb52f90317f2e3f73ecdb59564a2a30d6dc80))
|
|
17
|
+
* se corrige error en el indexado de reporte GTBAA para GV58LAU ([8aac88c1](https://github.com/jaayesta/queclink-parser/commit/8aac88c11e676e6a9c6c3fe7c97f7fc4860f9463))
|
|
18
|
+
* **log:** se elimina console log del código ([3ee79e0a](https://github.com/jaayesta/queclink-parser/commit/3ee79e0a915c59aef42e486c2eff61eba876b608))
|
|
19
|
+
|
|
1
20
|
#### 1.9.13 (2024-11-27)
|
|
2
21
|
|
|
3
22
|
##### New Features
|
package/example.js
CHANGED
|
@@ -60,48 +60,45 @@ var dat = '+RESP:GTDAT,8020040703,135790246811220,GV58LAU,3,,,1645026150,0,0.5,0
|
|
|
60
60
|
var bcs = '+RESP:GTBCS,8020040703,867995030096625,GV58LAU,,0,0.0,0,58.4,117.129522,31.839343,20190426054910,0460,0000,550B,B969,05,1,220100,0D03,BT-1,78054100CE22,0,1,6654B1767842,,,,,20190426054911,0B44$'
|
|
61
61
|
var can = '+RESP:GTCAN,8020040703,866314061482707,,10,0,E03FFFFF,,,H0,,,,,,,,,,,,,,,,,,,,FFFFFF,,,,,,,,,,,,,,,,,,,,,,,,,,,1,0.0,0,1501.0,-99.192304,18.932028,20241122171647,0334,0020,0232,029C3E18,01,12,20241122171648,06CD$'
|
|
62
62
|
var ida = '+RESP:GTIDA,8020040703,862170013895931,GV58LAU,,D2C4FBC5,1,1,1,0.8,0,22.2,117.198630,31.845229,20120802121626,0460,0000,5663,2BB9,01,15,0.0,,,,,20120802121627,008E$'
|
|
63
|
-
var baa = '+RESP:GTBAA,8020040703,867995030131778,GV58LAU,00,6,0,00,001F,TD_100109,FD6D3DE6D704,1,350,17,0,0,0,0,20151210084039,0.00,00,0,0,0,2,0,FFFE0005FF04,5A5A00,00,000A,000B,000A,000A,000B,0,105.6,0,54.8,117.129384,31.839299,20191119013822,0460,0000,550B,B1E2,05,1,220100,20191119013823,03F8$'
|
|
64
63
|
var baaa = '+RESP:GTBAA,8020040703,866314061808901,,00,13,0,15,4007,,FFFFFFFFFFFF,0,1,0,0,,,,,,,0730,0003,EA6F,00070B20,0D,0,220100,0.00,0.00,0.00,20241124061933,4BAF$'
|
|
65
64
|
var caneri = '+RESP:GTERI,6E0802,868589060350066,,00000104,28696,10,1,1,0.0,344,17.6,-71.604231,-33.043113,20241001170305,0730,0001,13F0,004E2212,01,6 ,10496.6,0000273:06:37,,,,98,210500,0,1,203FFFFF,,2,H4168131,5859.88,513,0,71,H2.4,P92.00,,,386.89,308.11,78.78,173.25,,FFFF,0000,,00,0.00,0.00,FFFFFF,62,,,,,,,,226631,181383,,386.89,79.35,,10178,,,,,,0000,0,0,,1,00,13,0,00000000,4007,,78054133C69C,1,0,20241001170312,26B5$'
|
|
66
65
|
var eribad = "+RESP:GTERI,6E0802,868589060669374,,00000002,28594,10,1,1,18.9,210,542.2,-70.693347,-33.537067,20241009121749,0730,0001,3341,008AF201,01,12,6.9,0000004:57:46,,,,100,220100,2,1,28FF05762863EA12,1,00B1,20241009121755,09BE$"
|
|
67
|
-
var
|
|
66
|
+
var high_temp = "+RESP:GTBAA,6E0801,868589060039404,,01,6,2,02,083F,WTH300,7805412AFE28,1,3525,25,49,25.00,0,0.0,35,153.1,-72.668510,-38.256640,20241227153248,0730,0001,23F1,00342902,01,12,20241227153635,A915$"
|
|
67
|
+
var in_range = "+RESP:GTBAA,6E0801,868589060039404,,01,6,2,03,083F,WTH300,7805412AFE28,1,3519,24,47,24.95,0,0.0,35,153.1,-72.668510,-38.256640,20241227151247,0730,0001,23F1,00339F10,01,12,20241227151525,A912$"
|
|
68
|
+
var relay_off = '+RESP:GTBAA,6E0801,868589060039404,,00,13,0,15,4000,0,0,1,0.0,35,153.1,-72.668510,-38.256640,20241227145055,0730,0001,23F1,00342911,01,12,20241227145055,A8F9$'
|
|
69
|
+
var relay_on = '+RESP:GTBAA,6E0801,868589060039404,,00,13,0,15,4000,0,1,1,0.0,35,153.1,-72.668510,-38.256640,20241227144952,0730,0001,23F1,00342911,01,12,20241227144951,A8F5$'
|
|
70
|
+
var eri58 = '+RESP:GTERI,8020040802,864696060004173,GV58LAU,00000100,,10,1,1,0.0,0,115.8,117.129356,31.839248,20230808061540,0460,0001,DF5C,05FE6667,03,15,0,4.0,0000102:34:33,,,,100,210000,,1,0,06,12,0,001A42A2,0617,TMPS,08351B00043C,1,26,65,20231030085704,20231030085704,0017$'
|
|
71
|
+
var eri310 = '+RESP:GTERI,6E1003,864696060004173,GV310LAU,00000100,,10,1,1,0.0,0,115.8,117.129356,31.839248,20230808061540,0460,0001,DF5C,05FE6667,03,15,,4.0,0000102:34:33,0,15259,10680,100,210000,7,1,0,06,12,0,001A42A2,0617,TMPS,08351B00043C,1,26,65,20231030085704,20231030085704,ABCD$'
|
|
72
|
+
var eri = '+RESP:GTERI,8020040802,866314061645121,,00000100,12944,10,1,1,0.0,247,611.9,-70.577108,-33.523989,20250114225655,0730,0001,3330,00A4FC01,01,9,41375.5,0002383:14:12,,,,100,110001,,2,00,13,0,00000000,4007,,78054143F187,1,0,03,6,5,0DE10E6A,083F,,7805413E6A41,1,3543,36,35,36.90,20250114225923,2ACB$'
|
|
73
|
+
var eri2 = '+RESP:GTERI,8020040802,866314061760094,,00000100,12186,10,1,0,0.0,17,-7.0,-71.543345,-32.972461,20250111040734,0730,0003,EA6F,00070B0C,01,0,0.2,0000063:26:41,,,,100,210100,,2,00,13,0,00000001,4007,,78054143F00B,1,1,01,6,4,17BB0821,283F,,78054133CB9F,1,3482,20,60,20.81,100,20250115130224,41C4$'
|
|
74
|
+
var eri3 = '+RESP:GTERI,8020040802,866314061760094,,00000100,12208,10,1,0,0.0,17,-7.0,-71.543345,-32.972461,20250111040734,0730,0003,EA6F,00070B0C,01,0,0.2,0000063:28:25,,,,100,210100,,3,00,13,0,00000001,4007,,78054143F00B,1,1,01,6,4,16B60839,283F,,78054133CB9F,1,3485,21,58,21.05,100,FE,3,4,000A,78054141615E,3030,20250115130409,41CC$'
|
|
68
75
|
|
|
76
|
+
var baa = '+RESP:GTBAA,8020040802,866314061760094,,01,6,4,13,283F,,78054133CB9F,1,3481,21,57,21.05,100,0,0.0,17,-7.0,-71.543345,-32.972461,20250111040734,0730,0003,EA6F,00070B0C,01,0,20250115130318,41C8$'
|
|
77
|
+
var ack = '+ACK:GTBAS,6E0A03,868589060039404,,1,0000,20250120151212,22CC$'
|
|
78
|
+
var test = '+RESP:GTERI,6E0B00,868589060064048,,00000100,12109,10,1,1,0.0,83,3.1,-71.543397,-32.972429,20250121142808,0730,0001,13EE,0032A502,01,12,2.6,0000008:04:49,,,,88,210100,0,2,02,6,4,164808ED,283F,,78054133CB9F,1,3447,22,57,22.85,100,FE,3,4,000A,780541416165,3270,20250121142810,2C1A$'
|
|
79
|
+
var test2 = '+RESP:GTERI,8020040802,866314061760094,,00000100,12217,10,1,0,0.0,114,89.4,-71.542946,-32.972462,20250117083107,0730,0003,EA6F,00070B34,01,0,12.0,0000100:49:34,,,,100,210100,,2,00,13,0,00000000,4007,,78054143F00B,1,0,01,6,4,17C608B8,283F,,78054133CB9F,1,3443,22,60,22.32,100,20250121174252,7B18$'
|
|
80
|
+
var test3 = '+RESP:GTERI,8020040802,866314061760094,,00000100,12217,10,1,0,0.0,114,89.4,-71.542946,-32.972462,20250117083107,0730,0003,EA6F,00070B34,01,0,12.0,0000100:49:34,,,,100,210100,,2,01,6,4,17C608B8,283F,,78054133CB9F,1,3443,22,60,22.32,100,00,13,0,00000000,4007,,78054143F00B,1,0,20250121174252,7B18$'
|
|
81
|
+
var test4 = '+RESP:GTERI,6E0B00,868589060064048,,00000100,12141,10,1,1,0.0,0,2.5,-71.543408,-32.972433,20250121211122,0730,0001,13EE,0032A502,01,12,2.6,0000014:48:01,,,,100,210100,0,3,FE,3,4,000A,780541416165,3260,00,13,0,00000000,4006,78054143F00B,1,0,02,6,4,156A0A3E,283F,,78054133CB9F,1,3449,26,54,26.22,100,20250121211125,340A$'
|
|
69
82
|
|
|
70
83
|
|
|
71
84
|
var data = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"previousToggle": {
|
|
85
|
-
"1": 0,
|
|
86
|
-
"2": 0,
|
|
87
|
-
"3": 0,
|
|
88
|
-
"4": 0,
|
|
89
|
-
"5": 0
|
|
90
|
-
},
|
|
91
|
-
"previousDuration": {
|
|
92
|
-
"1": 0,
|
|
93
|
-
"2": 0,
|
|
94
|
-
"3": 0,
|
|
95
|
-
"4": 0,
|
|
96
|
-
"5": 0
|
|
97
|
-
}
|
|
98
|
-
}
|
|
85
|
+
"imei": 868589060039404,
|
|
86
|
+
"instruction": "temp_alarm_on",
|
|
87
|
+
"sensor_type": 'WTH300',
|
|
88
|
+
"sensor_index": 1,
|
|
89
|
+
"action": "Configurar alarma de temperatura",
|
|
90
|
+
"device": "queclink",
|
|
91
|
+
"password": "gv310lau",
|
|
92
|
+
"alarmId": 0,
|
|
93
|
+
"sensorId": "7805412AFE28",
|
|
94
|
+
"minTemp": 25 || null,
|
|
95
|
+
"maxTemp": 29 || null
|
|
96
|
+
}
|
|
99
97
|
|
|
100
98
|
// console.log(queclink.parseCommand(data))
|
|
101
|
-
const raw = new Buffer(
|
|
99
|
+
const raw = new Buffer.from(test4)
|
|
102
100
|
console.log(JSON.stringify(queclink.parse(raw), null, 2))
|
|
103
|
-
queclink.parse(raw)
|
|
104
|
-
|
|
101
|
+
// queclink.parse(raw)
|
|
105
102
|
|
|
106
103
|
// if (data.can) {
|
|
107
104
|
// const {
|
package/package.json
CHANGED
package/src/gv310lau.js
CHANGED
|
@@ -566,125 +566,8 @@ const parse = raw => {
|
|
|
566
566
|
|
|
567
567
|
// Bluetooth Accessories
|
|
568
568
|
if (bluetoothAccessory) {
|
|
569
|
-
let btDevices = []
|
|
570
569
|
let btIndex = digitFuelSensor ? index + 10 : index + 9
|
|
571
|
-
let
|
|
572
|
-
let btNum = parsedData[btIndex] !== '' ? parseInt(parsedData[btIndex]) : 1
|
|
573
|
-
for (let c = 0; c < btNum; c++) {
|
|
574
|
-
let appendMask = utils.nHexDigit(utils.hex2bin(parsedData[cnt + 4]), 16)
|
|
575
|
-
|
|
576
|
-
let aNameIx = cnt + 4 + parseInt(appendMask[15])
|
|
577
|
-
let aMacIx = aNameIx + parseInt(appendMask[14])
|
|
578
|
-
let aStatIx = aMacIx + parseInt(appendMask[13])
|
|
579
|
-
let aBatIx = aStatIx + parseInt(appendMask[12])
|
|
580
|
-
let aTmpIx = aBatIx + parseInt(appendMask[11])
|
|
581
|
-
let aHumIx = aTmpIx + parseInt(appendMask[10])
|
|
582
|
-
let ioIx = aHumIx + parseInt(appendMask[8])
|
|
583
|
-
let modeIx =
|
|
584
|
-
appendMask[8] === '1' ? ioIx + 2 + parseInt(appendMask[7]) : ioIx
|
|
585
|
-
let aEvIx = appendMask[7] === '1' ? modeIx + 1 : modeIx
|
|
586
|
-
let pressIx = aEvIx + parseInt(appendMask[6])
|
|
587
|
-
let timeIx = pressIx + parseInt(appendMask[5])
|
|
588
|
-
let eTmpIx = timeIx + parseInt(appendMask[4])
|
|
589
|
-
let magIx = eTmpIx + parseInt(appendMask[3])
|
|
590
|
-
let aBatpIx =
|
|
591
|
-
appendMask[3] === '1' ? magIx + 2 + parseInt(appendMask[2]) : eTmpIx
|
|
592
|
-
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
593
|
-
|
|
594
|
-
btDevices.push({
|
|
595
|
-
index: parsedData[cnt],
|
|
596
|
-
type: utils.bluetoothAccessories[parsedData[cnt + 1]],
|
|
597
|
-
model:
|
|
598
|
-
parsedData[cnt + 2] !== ''
|
|
599
|
-
? utils.bluetoothModels[parsedData[cnt + 1]][parsedData[cnt + 2]]
|
|
600
|
-
: utils.bluetoothAccessories[parsedData[cnt + 1]],
|
|
601
|
-
appendMask: parsedData[cnt + 4],
|
|
602
|
-
name:
|
|
603
|
-
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
604
|
-
? parsedData[aNameIx]
|
|
605
|
-
: null,
|
|
606
|
-
mac:
|
|
607
|
-
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
608
|
-
? parsedData[aMacIx]
|
|
609
|
-
: null,
|
|
610
|
-
status:
|
|
611
|
-
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
612
|
-
? parseInt(parsedData[aStatIx])
|
|
613
|
-
: null,
|
|
614
|
-
batteryLevel:
|
|
615
|
-
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
616
|
-
? parseInt(parsedData[aBatIx])
|
|
617
|
-
: null,
|
|
618
|
-
batteryPercentage:
|
|
619
|
-
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
620
|
-
? parseFloat(parsedData[aBatpIx])
|
|
621
|
-
: null,
|
|
622
|
-
accessoryData: {
|
|
623
|
-
rawData: parsedData[cnt + 3] !== '' ? parsedData[cnt + 3] : null,
|
|
624
|
-
temperature:
|
|
625
|
-
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
626
|
-
? parseInt(parsedData[aTmpIx])
|
|
627
|
-
: null,
|
|
628
|
-
humidity:
|
|
629
|
-
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
630
|
-
? parseInt(parsedData[aHumIx])
|
|
631
|
-
: null,
|
|
632
|
-
outputStatus:
|
|
633
|
-
parsedData[ioIx] !== '' && appendMask[8] === '1'
|
|
634
|
-
? parsedData[ioIx]
|
|
635
|
-
: null,
|
|
636
|
-
inputStatus:
|
|
637
|
-
parsedData[ioIx + 1] !== '' && appendMask[8] === '1'
|
|
638
|
-
? parsedData[ioIx + 1]
|
|
639
|
-
: null,
|
|
640
|
-
analogInputStatus:
|
|
641
|
-
parsedData[ioIx + 2] !== '' && appendMask[8] === '1'
|
|
642
|
-
? parsedData[ioIx + 2]
|
|
643
|
-
: null,
|
|
644
|
-
mode:
|
|
645
|
-
parsedData[modeIx] !== '' && appendMask[7] === '1'
|
|
646
|
-
? parseInt(parsedData[modeIx])
|
|
647
|
-
: null,
|
|
648
|
-
event:
|
|
649
|
-
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
650
|
-
? parseInt(parsedData[aEvIx])
|
|
651
|
-
: null,
|
|
652
|
-
tirePresure:
|
|
653
|
-
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
654
|
-
? parseInt(parsedData[pressIx])
|
|
655
|
-
: null,
|
|
656
|
-
timestamp:
|
|
657
|
-
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
658
|
-
? utils.parseDate(parsedData[timeIx])
|
|
659
|
-
: null,
|
|
660
|
-
enhancedTemperature:
|
|
661
|
-
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
662
|
-
? parseFloat(parsedData[eTmpIx])
|
|
663
|
-
: null,
|
|
664
|
-
magDevice: {
|
|
665
|
-
id:
|
|
666
|
-
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
667
|
-
? parsedData[magIx]
|
|
668
|
-
: null,
|
|
669
|
-
eventCounter:
|
|
670
|
-
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
671
|
-
? parseInt(parsedData[magIx + 1])
|
|
672
|
-
: null,
|
|
673
|
-
magnetState:
|
|
674
|
-
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
675
|
-
? parseInt(parsedData[magIx + 2])
|
|
676
|
-
: null
|
|
677
|
-
},
|
|
678
|
-
relay: {
|
|
679
|
-
state:
|
|
680
|
-
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
681
|
-
? parseInt(parsedData[relIx])
|
|
682
|
-
: null
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
})
|
|
686
|
-
cnt = appendMask[1] === '1' ? relIx + 1 : relIx + 2
|
|
687
|
-
}
|
|
570
|
+
let btDevices = utils.getBleData(parsedData, btIndex)
|
|
688
571
|
externalData = Object.assign(externalData, {
|
|
689
572
|
btDevices: btDevices
|
|
690
573
|
})
|
|
@@ -2097,18 +1980,18 @@ const parse = raw => {
|
|
|
2097
1980
|
let aTmpIx = aBatIx + parseInt(appendMask[11])
|
|
2098
1981
|
let aHumIx = aTmpIx + parseInt(appendMask[10])
|
|
2099
1982
|
let ioIx = aHumIx + parseInt(appendMask[8])
|
|
2100
|
-
let
|
|
2101
|
-
|
|
2102
|
-
let
|
|
2103
|
-
|
|
1983
|
+
let aEvIx = appendMask[8] === '1' && appendMask[7] === '1'
|
|
1984
|
+
? ioIx + 3 : ioIx + parseInt(appendMask[7])
|
|
1985
|
+
let pressIx = appendMask[7] === '1' && appendMask[6] === '1'
|
|
1986
|
+
? aEvIx + 2 : aEvIx + parseInt(appendMask[6])
|
|
2104
1987
|
let timeIx = pressIx + parseInt(appendMask[5])
|
|
2105
1988
|
let eTmpIx = timeIx + parseInt(appendMask[4])
|
|
2106
1989
|
let magIx = eTmpIx + parseInt(appendMask[3])
|
|
2107
|
-
let aBatpIx =
|
|
2108
|
-
|
|
1990
|
+
let aBatpIx = appendMask[3] === '1' && appendMask[2] === '1'
|
|
1991
|
+
? magIx + 3 : magIx + parseInt(appendMask[2])
|
|
2109
1992
|
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
2110
1993
|
|
|
2111
|
-
let newIndex =
|
|
1994
|
+
let newIndex = relIx + 1 + parseInt(appendMask[1])
|
|
2112
1995
|
let satIndex = newIndex + 11
|
|
2113
1996
|
|
|
2114
1997
|
// If get satellites is configured
|
|
@@ -2117,8 +2000,87 @@ const parse = raw => {
|
|
|
2117
2000
|
satelliteInfo = true
|
|
2118
2001
|
}
|
|
2119
2002
|
|
|
2003
|
+
let bleInfo = {
|
|
2004
|
+
accesory:
|
|
2005
|
+
btAccessory !== '' ? utils.bluetoothAccessories[btAccessory] : null,
|
|
2006
|
+
model: parsedData[6] !== '' ? parseInt(parsedData[6]) : null,
|
|
2007
|
+
name:
|
|
2008
|
+
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
2009
|
+
? parsedData[aNameIx]
|
|
2010
|
+
: null,
|
|
2011
|
+
role: null,
|
|
2012
|
+
type: null,
|
|
2013
|
+
mac:
|
|
2014
|
+
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
2015
|
+
? parsedData[aMacIx]
|
|
2016
|
+
: null,
|
|
2017
|
+
status:
|
|
2018
|
+
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
2019
|
+
? parseInt(parsedData[aStatIx])
|
|
2020
|
+
: null,
|
|
2021
|
+
batteryLevel:
|
|
2022
|
+
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
2023
|
+
? parseInt(parsedData[aBatIx])
|
|
2024
|
+
: null,
|
|
2025
|
+
batteryPercentage:
|
|
2026
|
+
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
2027
|
+
? parseFloat(parsedData[aBatpIx])
|
|
2028
|
+
: null
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
let bleData = {
|
|
2032
|
+
temperature:
|
|
2033
|
+
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
2034
|
+
? parseInt(parsedData[aTmpIx])
|
|
2035
|
+
: null,
|
|
2036
|
+
humidity:
|
|
2037
|
+
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
2038
|
+
? parseInt(parsedData[aHumIx])
|
|
2039
|
+
: null,
|
|
2040
|
+
event:
|
|
2041
|
+
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
2042
|
+
? parseInt(parsedData[aEvIx])
|
|
2043
|
+
: null,
|
|
2044
|
+
tirePresure:
|
|
2045
|
+
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
2046
|
+
? parseInt(parsedData[pressIx])
|
|
2047
|
+
: null,
|
|
2048
|
+
timestamp:
|
|
2049
|
+
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
2050
|
+
? utils.parseDate(parsedData[timeIx])
|
|
2051
|
+
: null,
|
|
2052
|
+
enhancedTemperature:
|
|
2053
|
+
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
2054
|
+
? parseFloat(parsedData[eTmpIx])
|
|
2055
|
+
: null,
|
|
2056
|
+
magDevice: {
|
|
2057
|
+
id:
|
|
2058
|
+
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
2059
|
+
? parsedData[magIx]
|
|
2060
|
+
: null,
|
|
2061
|
+
eventCounter:
|
|
2062
|
+
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
2063
|
+
? parseInt(parsedData[magIx + 1])
|
|
2064
|
+
: null,
|
|
2065
|
+
magnetState:
|
|
2066
|
+
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
2067
|
+
? parseInt(parsedData[magIx + 2])
|
|
2068
|
+
: null
|
|
2069
|
+
},
|
|
2070
|
+
relay: {
|
|
2071
|
+
configResult:
|
|
2072
|
+
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
2073
|
+
? utils.relayBLEResults[parsedData[relIx]]
|
|
2074
|
+
: null,
|
|
2075
|
+
state:
|
|
2076
|
+
parsedData[relIx + 1] !== '' && appendMask[1] === '1'
|
|
2077
|
+
? parseInt(parsedData[relIx + 1])
|
|
2078
|
+
: null
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2120
2082
|
data = Object.assign(data, {
|
|
2121
|
-
alarm: utils.getAlarm(command[1], parsedData[7],
|
|
2083
|
+
alarm: utils.getAlarm(command[1], parsedData[7], [parsedData[4], bleInfo.mac, bleData]),
|
|
2122
2084
|
loc: {
|
|
2123
2085
|
type: 'Point',
|
|
2124
2086
|
coordinates: [
|
|
@@ -2191,87 +2153,8 @@ const parse = raw => {
|
|
|
2191
2153
|
? parsedData[aMacIx]
|
|
2192
2154
|
: null
|
|
2193
2155
|
},
|
|
2194
|
-
accessoryInfo:
|
|
2195
|
-
|
|
2196
|
-
btAccessory !== '' ? utils.bluetoothAccessories[btAccessory] : null,
|
|
2197
|
-
model: parsedData[6] !== '' ? parseInt(parsedData[6]) : null,
|
|
2198
|
-
name:
|
|
2199
|
-
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
2200
|
-
? parsedData[aNameIx]
|
|
2201
|
-
: null,
|
|
2202
|
-
role: null,
|
|
2203
|
-
type: null,
|
|
2204
|
-
mac:
|
|
2205
|
-
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
2206
|
-
? parsedData[aMacIx]
|
|
2207
|
-
: null,
|
|
2208
|
-
status:
|
|
2209
|
-
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
2210
|
-
? parseInt(parsedData[aStatIx])
|
|
2211
|
-
: null,
|
|
2212
|
-
batteryLevel:
|
|
2213
|
-
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
2214
|
-
? parseInt(parsedData[aBatIx])
|
|
2215
|
-
: null,
|
|
2216
|
-
batteryPercentage:
|
|
2217
|
-
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
2218
|
-
? parseFloat(parsedData[aBatpIx])
|
|
2219
|
-
: null
|
|
2220
|
-
},
|
|
2221
|
-
accessoryData: {
|
|
2222
|
-
temperature:
|
|
2223
|
-
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
2224
|
-
? parseInt(parsedData[aTmpIx])
|
|
2225
|
-
: null,
|
|
2226
|
-
humidity:
|
|
2227
|
-
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
2228
|
-
? parseInt(parsedData[aHumIx])
|
|
2229
|
-
: null,
|
|
2230
|
-
mode:
|
|
2231
|
-
parsedData[modeIx] !== '' && appendMask[7] === '1'
|
|
2232
|
-
? parseInt(parsedData[modeIx])
|
|
2233
|
-
: null,
|
|
2234
|
-
event:
|
|
2235
|
-
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
2236
|
-
? parseInt(parsedData[aEvIx])
|
|
2237
|
-
: null,
|
|
2238
|
-
tirePresure:
|
|
2239
|
-
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
2240
|
-
? parseInt(parsedData[pressIx])
|
|
2241
|
-
: null,
|
|
2242
|
-
timestamp:
|
|
2243
|
-
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
2244
|
-
? utils.parseDate(parsedData[timeIx])
|
|
2245
|
-
: null,
|
|
2246
|
-
enhancedTemperature:
|
|
2247
|
-
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
2248
|
-
? parseFloat(parsedData[eTmpIx])
|
|
2249
|
-
: null,
|
|
2250
|
-
magDevice: {
|
|
2251
|
-
id:
|
|
2252
|
-
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
2253
|
-
? parsedData[magIx]
|
|
2254
|
-
: null,
|
|
2255
|
-
eventCounter:
|
|
2256
|
-
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
2257
|
-
? parseInt(parsedData[magIx + 1])
|
|
2258
|
-
: null,
|
|
2259
|
-
magnetState:
|
|
2260
|
-
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
2261
|
-
? parseInt(parsedData[magIx + 2])
|
|
2262
|
-
: null
|
|
2263
|
-
},
|
|
2264
|
-
relay: {
|
|
2265
|
-
configResult:
|
|
2266
|
-
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
2267
|
-
? parseInt(parsedData[relIx])
|
|
2268
|
-
: null,
|
|
2269
|
-
state:
|
|
2270
|
-
parsedData[relIx + 1] !== '' && appendMask[1] === '1'
|
|
2271
|
-
? parseInt(parsedData[relIx + 1])
|
|
2272
|
-
: null
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2156
|
+
accessoryInfo: bleInfo,
|
|
2157
|
+
accessoryData: bleData
|
|
2275
2158
|
}
|
|
2276
2159
|
})
|
|
2277
2160
|
} else if (command[1] === 'GTBID') {
|
|
@@ -2655,12 +2538,12 @@ const parse = raw => {
|
|
|
2655
2538
|
raw: parsedData[5] !== '' ? parsedData[5] : null,
|
|
2656
2539
|
oilLevelLowIndicator: alarmMask1 ? alarmMask1[28] === '1' : null,
|
|
2657
2540
|
serviceCallIndicator: alarmMask1 ? alarmMask1[27] === '1' : null,
|
|
2658
|
-
|
|
2541
|
+
airbagsIndicator: alarmMask1 ? alarmMask1[26] === '1' : null,
|
|
2659
2542
|
checkEngineIndicator: alarmMask1 ? alarmMask1[25] === '1' : null,
|
|
2660
2543
|
ABSFailureIndicator: alarmMask1 ? alarmMask1[23] === '1' : null,
|
|
2661
2544
|
engineHotIndicator: alarmMask1 ? alarmMask1[22] === '1' : null,
|
|
2662
2545
|
oilPressureIndicator: alarmMask1 ? alarmMask1[21] === '1' : null,
|
|
2663
|
-
|
|
2546
|
+
brakeSystemFailureIndicator: alarmMask1
|
|
2664
2547
|
? alarmMask1[20] === '1'
|
|
2665
2548
|
: null,
|
|
2666
2549
|
batteryIndicator: alarmMask1 ? alarmMask1[19] === '1' : null,
|
|
@@ -2885,14 +2768,14 @@ const parse = raw => {
|
|
|
2885
2768
|
? expansionBin[2] === '1'
|
|
2886
2769
|
: null,
|
|
2887
2770
|
batteryIndicator: expansionBin ? expansionBin[3] === '1' : null,
|
|
2888
|
-
|
|
2771
|
+
brakeSystemFailureIndicator: expansionBin
|
|
2889
2772
|
? expansionBin[4] === '1'
|
|
2890
2773
|
: null,
|
|
2891
2774
|
oilPressureIndicator: expansionBin ? expansionBin[5] === '1' : null,
|
|
2892
2775
|
engineHotIndicator: expansionBin ? expansionBin[6] === '1' : null,
|
|
2893
2776
|
ABSFailureIndicator: expansionBin ? expansionBin[7] === '1' : null,
|
|
2894
2777
|
checkEngineIndicator: expansionBin ? expansionBin[9] === '1' : null,
|
|
2895
|
-
|
|
2778
|
+
airbagsIndicator: expansionBin ? expansionBin[10] === '1' : null,
|
|
2896
2779
|
serviceCallIndicator: expansionBin
|
|
2897
2780
|
? expansionBin[11] === '1'
|
|
2898
2781
|
: null,
|
package/src/gv57cg.js
CHANGED
|
@@ -2025,12 +2025,12 @@ const parse = raw => {
|
|
|
2025
2025
|
raw: parsedData[5] !== '' ? parsedData[5] : null,
|
|
2026
2026
|
oilLevelLowIndicator: alarmMask1 ? alarmMask1[28] === '1' : null,
|
|
2027
2027
|
serviceCallIndicator: alarmMask1 ? alarmMask1[27] === '1' : null,
|
|
2028
|
-
|
|
2028
|
+
airbagsIndicator: alarmMask1 ? alarmMask1[26] === '1' : null,
|
|
2029
2029
|
checkEngineIndicator: alarmMask1 ? alarmMask1[25] === '1' : null,
|
|
2030
2030
|
ABSFailureIndicator: alarmMask1 ? alarmMask1[23] === '1' : null,
|
|
2031
2031
|
engineHotIndicator: alarmMask1 ? alarmMask1[22] === '1' : null,
|
|
2032
2032
|
oilPressureIndicator: alarmMask1 ? alarmMask1[21] === '1' : null,
|
|
2033
|
-
|
|
2033
|
+
brakeSystemFailureIndicator: alarmMask1
|
|
2034
2034
|
? alarmMask1[20] === '1'
|
|
2035
2035
|
: null,
|
|
2036
2036
|
batteryIndicator: alarmMask1 ? alarmMask1[19] === '1' : null,
|
|
@@ -2255,14 +2255,14 @@ const parse = raw => {
|
|
|
2255
2255
|
? expansionBin[2] === '1'
|
|
2256
2256
|
: null,
|
|
2257
2257
|
batteryIndicator: expansionBin ? expansionBin[3] === '1' : null,
|
|
2258
|
-
|
|
2258
|
+
brakeSystemFailureIndicator: expansionBin
|
|
2259
2259
|
? expansionBin[4] === '1'
|
|
2260
2260
|
: null,
|
|
2261
2261
|
oilPressureIndicator: expansionBin ? expansionBin[5] === '1' : null,
|
|
2262
2262
|
engineHotIndicator: expansionBin ? expansionBin[6] === '1' : null,
|
|
2263
2263
|
ABSFailureIndicator: expansionBin ? expansionBin[7] === '1' : null,
|
|
2264
2264
|
checkEngineIndicator: expansionBin ? expansionBin[9] === '1' : null,
|
|
2265
|
-
|
|
2265
|
+
airbagsIndicator: expansionBin ? expansionBin[10] === '1' : null,
|
|
2266
2266
|
serviceCallIndicator: expansionBin
|
|
2267
2267
|
? expansionBin[11] === '1'
|
|
2268
2268
|
: null,
|
package/src/gv58lau.js
CHANGED
|
@@ -322,7 +322,6 @@ const parse = raw => {
|
|
|
322
322
|
|
|
323
323
|
// Bluetooth Accessories
|
|
324
324
|
if (bluetoothAccessory) {
|
|
325
|
-
let btDevices = []
|
|
326
325
|
let btIndex
|
|
327
326
|
|
|
328
327
|
if (canData) {
|
|
@@ -331,170 +330,8 @@ const parse = raw => {
|
|
|
331
330
|
btIndex = index + 9
|
|
332
331
|
}
|
|
333
332
|
|
|
334
|
-
let
|
|
335
|
-
let btNum = parsedData[btIndex] !== '' ? parseInt(parsedData[btIndex]) : 1
|
|
333
|
+
let btDevices = utils.getBleData(parsedData, btIndex)
|
|
336
334
|
|
|
337
|
-
for (let c = 0; c < btNum; c++) {
|
|
338
|
-
let appendMask = utils.nHexDigit(utils.hex2bin(parsedData[cnt + 4]), 16)
|
|
339
|
-
|
|
340
|
-
let aNameIx = cnt + 4 + parseInt(appendMask[15])
|
|
341
|
-
let aMacIx = aNameIx + parseInt(appendMask[14])
|
|
342
|
-
let aStatIx = aMacIx + parseInt(appendMask[13])
|
|
343
|
-
let aBatIx = aStatIx + parseInt(appendMask[12])
|
|
344
|
-
let aTmpIx = aBatIx + parseInt(appendMask[11])
|
|
345
|
-
let aHumIx = aTmpIx + parseInt(appendMask[10])
|
|
346
|
-
let ioIx = aHumIx + parseInt(appendMask[8])
|
|
347
|
-
let modeIx =
|
|
348
|
-
appendMask[8] === '1' ? ioIx + 2 + parseInt(appendMask[7]) : ioIx
|
|
349
|
-
let aEvIx = appendMask[7] === '1' ? modeIx + 1 : modeIx
|
|
350
|
-
let pressIx = aEvIx + parseInt(appendMask[6])
|
|
351
|
-
let timeIx = pressIx + parseInt(appendMask[5])
|
|
352
|
-
let eTmpIx = timeIx + parseInt(appendMask[4])
|
|
353
|
-
let magIx = eTmpIx + parseInt(appendMask[3])
|
|
354
|
-
let aBatpIx =
|
|
355
|
-
appendMask[3] === '1' ? magIx + 2 + parseInt(appendMask[2]) : eTmpIx
|
|
356
|
-
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
357
|
-
|
|
358
|
-
btDevices.push({
|
|
359
|
-
index: parsedData[cnt],
|
|
360
|
-
type: utils.bluetoothAccessories[parsedData[cnt + 1]],
|
|
361
|
-
model:
|
|
362
|
-
parsedData[cnt + 2] !== ''
|
|
363
|
-
? utils.bluetoothModels[parsedData[cnt + 1]][parsedData[cnt + 2]]
|
|
364
|
-
: utils.bluetoothAccessories[parsedData[cnt + 1]],
|
|
365
|
-
appendMask: parsedData[cnt + 4],
|
|
366
|
-
rawData:
|
|
367
|
-
parsedData[cnt + 3] !== ''
|
|
368
|
-
? {
|
|
369
|
-
raw: parsedData[cnt + 3],
|
|
370
|
-
fuelLevel:
|
|
371
|
-
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}` === '10'
|
|
372
|
-
? parsedData[cnt + 3]
|
|
373
|
-
: null,
|
|
374
|
-
temperature:
|
|
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'
|
|
383
|
-
? utils.getBtTempHumData(
|
|
384
|
-
parsedData[cnt + 3].substring(0, 4)
|
|
385
|
-
)
|
|
386
|
-
: ['64', '65'].includes(
|
|
387
|
-
`${parsedData[cnt + 1]}${parsedData[cnt + 2]}`
|
|
388
|
-
)
|
|
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
|
|
409
|
-
}
|
|
410
|
-
: null,
|
|
411
|
-
name:
|
|
412
|
-
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
413
|
-
? parsedData[aNameIx]
|
|
414
|
-
: null,
|
|
415
|
-
mac:
|
|
416
|
-
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
417
|
-
? parsedData[aMacIx]
|
|
418
|
-
: null,
|
|
419
|
-
status:
|
|
420
|
-
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
421
|
-
? parseInt(parsedData[aStatIx])
|
|
422
|
-
: null,
|
|
423
|
-
batteryLevel:
|
|
424
|
-
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
425
|
-
? parseInt(parsedData[aBatIx])
|
|
426
|
-
: null,
|
|
427
|
-
batteryPercentage:
|
|
428
|
-
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
429
|
-
? parseFloat(parsedData[aBatpIx])
|
|
430
|
-
: null,
|
|
431
|
-
accessoryData: {
|
|
432
|
-
rawData: parsedData[cnt + 3] !== '' ? parsedData[cnt + 3] : null,
|
|
433
|
-
temperature:
|
|
434
|
-
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
435
|
-
? parseInt(parsedData[aTmpIx])
|
|
436
|
-
: null,
|
|
437
|
-
humidity:
|
|
438
|
-
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
439
|
-
? parseInt(parsedData[aHumIx])
|
|
440
|
-
: null,
|
|
441
|
-
outputStatus:
|
|
442
|
-
parsedData[ioIx] !== '' && appendMask[8] === '1'
|
|
443
|
-
? parsedData[ioIx]
|
|
444
|
-
: null,
|
|
445
|
-
inputStatus:
|
|
446
|
-
parsedData[ioIx + 1] !== '' && appendMask[8] === '1'
|
|
447
|
-
? parsedData[ioIx + 1]
|
|
448
|
-
: null,
|
|
449
|
-
analogInputStatus:
|
|
450
|
-
parsedData[ioIx + 2] !== '' && appendMask[8] === '1'
|
|
451
|
-
? parsedData[ioIx + 2]
|
|
452
|
-
: null,
|
|
453
|
-
mode:
|
|
454
|
-
parsedData[modeIx] !== '' && appendMask[7] === '1'
|
|
455
|
-
? parseInt(parsedData[modeIx])
|
|
456
|
-
: null,
|
|
457
|
-
event:
|
|
458
|
-
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
459
|
-
? parseInt(parsedData[aEvIx])
|
|
460
|
-
: null,
|
|
461
|
-
tirePresure:
|
|
462
|
-
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
463
|
-
? parseInt(parsedData[pressIx])
|
|
464
|
-
: null,
|
|
465
|
-
timestamp:
|
|
466
|
-
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
467
|
-
? utils.parseDate(parsedData[timeIx])
|
|
468
|
-
: null,
|
|
469
|
-
enhancedTemperature:
|
|
470
|
-
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
471
|
-
? parseFloat(parsedData[eTmpIx])
|
|
472
|
-
: null,
|
|
473
|
-
magDevice: {
|
|
474
|
-
id:
|
|
475
|
-
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
476
|
-
? parsedData[magIx]
|
|
477
|
-
: null,
|
|
478
|
-
eventCounter:
|
|
479
|
-
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
480
|
-
? parseInt(parsedData[magIx + 1])
|
|
481
|
-
: null,
|
|
482
|
-
magnetState:
|
|
483
|
-
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
484
|
-
? parseInt(parsedData[magIx + 2])
|
|
485
|
-
: null
|
|
486
|
-
},
|
|
487
|
-
relay: {
|
|
488
|
-
state:
|
|
489
|
-
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
490
|
-
? parseInt(parsedData[relIx])
|
|
491
|
-
: null
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
})
|
|
495
|
-
cnt = appendMask[1] === '1' ? relIx + 1 : relIx + 2
|
|
496
|
-
cnt = parsedData[cnt + 3] !== '' ? cnt - 1 : cnt
|
|
497
|
-
}
|
|
498
335
|
externalData = Object.assign(externalData, {
|
|
499
336
|
btDevices: btDevices
|
|
500
337
|
})
|
|
@@ -1882,26 +1719,105 @@ const parse = raw => {
|
|
|
1882
1719
|
let aTmpIx = aBatIx + parseInt(appendMask[11])
|
|
1883
1720
|
let aHumIx = aTmpIx + parseInt(appendMask[10])
|
|
1884
1721
|
let ioIx = aHumIx + parseInt(appendMask[8])
|
|
1885
|
-
let
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1722
|
+
let aEvIx = appendMask[8] === '1' && appendMask[7] === '1'
|
|
1723
|
+
? ioIx + 3 : ioIx + parseInt(appendMask[7])
|
|
1724
|
+
let pressIx = appendMask[7] === '1' && appendMask[6] === '1'
|
|
1725
|
+
? aEvIx + 2 : aEvIx + parseInt(appendMask[6])
|
|
1889
1726
|
let timeIx = pressIx + parseInt(appendMask[5])
|
|
1890
1727
|
let eTmpIx = timeIx + parseInt(appendMask[4])
|
|
1891
1728
|
let magIx = eTmpIx + parseInt(appendMask[3])
|
|
1892
|
-
let aBatpIx =
|
|
1893
|
-
|
|
1729
|
+
let aBatpIx = appendMask[3] === '1' && appendMask[2] === '1'
|
|
1730
|
+
? magIx + 3 : magIx + parseInt(appendMask[2])
|
|
1894
1731
|
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
1895
1732
|
|
|
1896
|
-
let newIndex =
|
|
1733
|
+
let newIndex = relIx + 1 + parseInt(appendMask[1])
|
|
1897
1734
|
|
|
1898
1735
|
let satelliteInfo = utils.includeSatellites(parsedData[newIndex + 11])
|
|
1899
1736
|
let includeStatus = utils.includeStatus(parsedData[newIndex + 11])
|
|
1900
1737
|
let accuracyInfo = utils.includeGnnsAccuracy(parsedData[newIndex + 11]) ? 3 : 0
|
|
1901
1738
|
let index = newIndex + 11 + (satelliteInfo + includeStatus + accuracyInfo)
|
|
1902
1739
|
|
|
1740
|
+
let bleInfo = {
|
|
1741
|
+
accesory:
|
|
1742
|
+
btAccessory !== '' ? utils.bluetoothAccessories[btAccessory] : null,
|
|
1743
|
+
model: parsedData[6] !== '' ? parseInt(parsedData[6]) : null,
|
|
1744
|
+
name:
|
|
1745
|
+
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
1746
|
+
? parsedData[aNameIx]
|
|
1747
|
+
: null,
|
|
1748
|
+
role: null,
|
|
1749
|
+
type: null,
|
|
1750
|
+
mac:
|
|
1751
|
+
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
1752
|
+
? parsedData[aMacIx]
|
|
1753
|
+
: null,
|
|
1754
|
+
status:
|
|
1755
|
+
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
1756
|
+
? parseInt(parsedData[aStatIx])
|
|
1757
|
+
: null,
|
|
1758
|
+
batteryLevel:
|
|
1759
|
+
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
1760
|
+
? parseInt(parsedData[aBatIx])
|
|
1761
|
+
: null,
|
|
1762
|
+
batteryPercentage:
|
|
1763
|
+
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
1764
|
+
? parseFloat(parsedData[aBatpIx])
|
|
1765
|
+
: null
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
let bleData = {
|
|
1769
|
+
temperature:
|
|
1770
|
+
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
1771
|
+
? parseInt(parsedData[aTmpIx])
|
|
1772
|
+
: null,
|
|
1773
|
+
humidity:
|
|
1774
|
+
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
1775
|
+
? parseInt(parsedData[aHumIx])
|
|
1776
|
+
: null,
|
|
1777
|
+
event:
|
|
1778
|
+
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
1779
|
+
? parseInt(parsedData[aEvIx])
|
|
1780
|
+
: null,
|
|
1781
|
+
tirePresure:
|
|
1782
|
+
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
1783
|
+
? parseInt(parsedData[pressIx])
|
|
1784
|
+
: null,
|
|
1785
|
+
timestamp:
|
|
1786
|
+
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
1787
|
+
? utils.parseDate(parsedData[timeIx])
|
|
1788
|
+
: null,
|
|
1789
|
+
enhancedTemperature:
|
|
1790
|
+
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
1791
|
+
? parseFloat(parsedData[eTmpIx])
|
|
1792
|
+
: null,
|
|
1793
|
+
magDevice: {
|
|
1794
|
+
id:
|
|
1795
|
+
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
1796
|
+
? parsedData[magIx]
|
|
1797
|
+
: null,
|
|
1798
|
+
eventCounter:
|
|
1799
|
+
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
1800
|
+
? parseInt(parsedData[magIx + 1])
|
|
1801
|
+
: null,
|
|
1802
|
+
magnetState:
|
|
1803
|
+
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
1804
|
+
? parseInt(parsedData[magIx + 2])
|
|
1805
|
+
: null
|
|
1806
|
+
},
|
|
1807
|
+
relay: {
|
|
1808
|
+
configResult:
|
|
1809
|
+
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
1810
|
+
? parseInt(parsedData[relIx])
|
|
1811
|
+
: null,
|
|
1812
|
+
state:
|
|
1813
|
+
parsedData[relIx + 1] !== '' && appendMask[1] === '1'
|
|
1814
|
+
? parseInt(parsedData[relIx + 1])
|
|
1815
|
+
: null
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1903
1819
|
data = Object.assign(data, {
|
|
1904
|
-
alarm: utils.getAlarm(command[1], parsedData[7],
|
|
1820
|
+
alarm: utils.getAlarm(command[1], parsedData[7], [parsedData[4], bleInfo.mac, bleData]),
|
|
1905
1821
|
loc: {
|
|
1906
1822
|
type: 'Point',
|
|
1907
1823
|
coordinates: [
|
|
@@ -2019,87 +1935,8 @@ const parse = raw => {
|
|
|
2019
1935
|
? parsedData[aMacIx]
|
|
2020
1936
|
: null
|
|
2021
1937
|
},
|
|
2022
|
-
accessoryInfo:
|
|
2023
|
-
|
|
2024
|
-
btAccessory !== '' ? utils.bluetoothAccessories[btAccessory] : null,
|
|
2025
|
-
model: parsedData[6] !== '' ? parseInt(parsedData[6]) : null,
|
|
2026
|
-
name:
|
|
2027
|
-
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
2028
|
-
? parsedData[aNameIx]
|
|
2029
|
-
: null,
|
|
2030
|
-
role: null,
|
|
2031
|
-
type: null,
|
|
2032
|
-
mac:
|
|
2033
|
-
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
2034
|
-
? parsedData[aMacIx]
|
|
2035
|
-
: null,
|
|
2036
|
-
status:
|
|
2037
|
-
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
2038
|
-
? parseInt(parsedData[aStatIx])
|
|
2039
|
-
: null,
|
|
2040
|
-
batteryLevel:
|
|
2041
|
-
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
2042
|
-
? parseInt(parsedData[aBatIx])
|
|
2043
|
-
: null,
|
|
2044
|
-
batteryPercentage:
|
|
2045
|
-
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
2046
|
-
? parseFloat(parsedData[aBatpIx])
|
|
2047
|
-
: null
|
|
2048
|
-
},
|
|
2049
|
-
accessoryData: {
|
|
2050
|
-
temperature:
|
|
2051
|
-
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
2052
|
-
? parseInt(parsedData[aTmpIx])
|
|
2053
|
-
: null,
|
|
2054
|
-
humidity:
|
|
2055
|
-
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
2056
|
-
? parseInt(parsedData[aHumIx])
|
|
2057
|
-
: null,
|
|
2058
|
-
mode:
|
|
2059
|
-
parsedData[modeIx] !== '' && appendMask[7] === '1'
|
|
2060
|
-
? parseInt(parsedData[modeIx])
|
|
2061
|
-
: null,
|
|
2062
|
-
event:
|
|
2063
|
-
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
2064
|
-
? parseInt(parsedData[aEvIx])
|
|
2065
|
-
: null,
|
|
2066
|
-
tirePresure:
|
|
2067
|
-
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
2068
|
-
? parseInt(parsedData[pressIx])
|
|
2069
|
-
: null,
|
|
2070
|
-
timestamp:
|
|
2071
|
-
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
2072
|
-
? utils.parseDate(parsedData[timeIx])
|
|
2073
|
-
: null,
|
|
2074
|
-
enhancedTemperature:
|
|
2075
|
-
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
2076
|
-
? parseFloat(parsedData[eTmpIx])
|
|
2077
|
-
: null,
|
|
2078
|
-
magDevice: {
|
|
2079
|
-
id:
|
|
2080
|
-
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
2081
|
-
? parsedData[magIx]
|
|
2082
|
-
: null,
|
|
2083
|
-
eventCounter:
|
|
2084
|
-
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
2085
|
-
? parseInt(parsedData[magIx + 1])
|
|
2086
|
-
: null,
|
|
2087
|
-
magnetState:
|
|
2088
|
-
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
2089
|
-
? parseInt(parsedData[magIx + 2])
|
|
2090
|
-
: null
|
|
2091
|
-
},
|
|
2092
|
-
relay: {
|
|
2093
|
-
configResult:
|
|
2094
|
-
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
2095
|
-
? parseInt(parsedData[relIx])
|
|
2096
|
-
: null,
|
|
2097
|
-
state:
|
|
2098
|
-
parsedData[relIx + 1] !== '' && appendMask[1] === '1'
|
|
2099
|
-
? parseInt(parsedData[relIx + 1])
|
|
2100
|
-
: null
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
1938
|
+
accessoryInfo: bleInfo,
|
|
1939
|
+
accessoryData: bleData
|
|
2103
1940
|
}
|
|
2104
1941
|
})
|
|
2105
1942
|
} else if (command[1] === 'GTBID') {
|
|
@@ -2562,12 +2399,12 @@ const parse = raw => {
|
|
|
2562
2399
|
raw: parsedData[5] !== '' ? parsedData[5] : null,
|
|
2563
2400
|
oilLevelLowIndicator: alarmMask1 ? alarmMask1[28] === '1' : null,
|
|
2564
2401
|
serviceCallIndicator: alarmMask1 ? alarmMask1[27] === '1' : null,
|
|
2565
|
-
|
|
2402
|
+
airbagsIndicator: alarmMask1 ? alarmMask1[26] === '1' : null,
|
|
2566
2403
|
checkEngineIndicator: alarmMask1 ? alarmMask1[25] === '1' : null,
|
|
2567
2404
|
ABSFailureIndicator: alarmMask1 ? alarmMask1[23] === '1' : null,
|
|
2568
2405
|
engineHotIndicator: alarmMask1 ? alarmMask1[22] === '1' : null,
|
|
2569
2406
|
oilPressureIndicator: alarmMask1 ? alarmMask1[21] === '1' : null,
|
|
2570
|
-
|
|
2407
|
+
brakeSystemFailureIndicator: alarmMask1
|
|
2571
2408
|
? alarmMask1[20] === '1'
|
|
2572
2409
|
: null,
|
|
2573
2410
|
batteryIndicator: alarmMask1 ? alarmMask1[19] === '1' : null,
|
|
@@ -2792,14 +2629,14 @@ const parse = raw => {
|
|
|
2792
2629
|
? expansionBin[2] === '1'
|
|
2793
2630
|
: null,
|
|
2794
2631
|
batteryIndicator: expansionBin ? expansionBin[3] === '1' : null,
|
|
2795
|
-
|
|
2632
|
+
brakeSystemFailureIndicator: expansionBin
|
|
2796
2633
|
? expansionBin[4] === '1'
|
|
2797
2634
|
: null,
|
|
2798
2635
|
oilPressureIndicator: expansionBin ? expansionBin[5] === '1' : null,
|
|
2799
2636
|
engineHotIndicator: expansionBin ? expansionBin[6] === '1' : null,
|
|
2800
2637
|
ABSFailureIndicator: expansionBin ? expansionBin[7] === '1' : null,
|
|
2801
2638
|
checkEngineIndicator: expansionBin ? expansionBin[9] === '1' : null,
|
|
2802
|
-
|
|
2639
|
+
airbagsIndicator: expansionBin ? expansionBin[10] === '1' : null,
|
|
2803
2640
|
serviceCallIndicator: expansionBin
|
|
2804
2641
|
? expansionBin[11] === '1'
|
|
2805
2642
|
: null,
|
package/src/index.js
CHANGED
|
@@ -309,9 +309,16 @@ const parseCommand = data => {
|
|
|
309
309
|
mode = /on(E)?/.test(state) ? 3 : 0
|
|
310
310
|
const alarmId = data.alarmId || 0
|
|
311
311
|
const sensorId = data.sensorId || '0000000000000000'
|
|
312
|
+
const index = data.sensor_index || 2
|
|
313
|
+
const sensorType = utils.bleTempHumSensors[data.sensor_type]
|
|
312
314
|
const minTemp = data.minTemp || 0
|
|
313
315
|
const maxTemp = data.maxTemp || 0
|
|
314
|
-
|
|
316
|
+
if (sensorType === '0') {
|
|
317
|
+
command = `AT+GTTMP=${password},${alarmId},${mode},${sensorId},,,${minTemp},${maxTemp},,,2,10,,,0,0,0,0,,,,,${serialId}$`
|
|
318
|
+
} else {
|
|
319
|
+
command = `AT+GTBAS=${password},${index},6,${sensorType},,${sensorId},83F,,2400,,${mode},${minTemp},${maxTemp},2,,,,,,,,0,0,0,0,,,${serialId}$`
|
|
320
|
+
}
|
|
321
|
+
|
|
315
322
|
} else if (/^copiloto_temp_alarm_(on|off)(E)?$/.test(data.instruction)) {
|
|
316
323
|
// AT+GTDAT=gv300w,2,,>CMD3005,60,18,0,5,-3<,0,,,,FFFF$
|
|
317
324
|
// Temperature Alarm
|
package/src/messages/es.json
CHANGED
|
@@ -230,23 +230,23 @@
|
|
|
230
230
|
"GTBDS": "Accesorio bluetooth desconectado",
|
|
231
231
|
"GTBAA": {
|
|
232
232
|
"00": "Accesorio con batería baja",
|
|
233
|
-
"01": "Temperatura
|
|
234
|
-
"02": "Temperatura
|
|
235
|
-
"03": "
|
|
233
|
+
"01": "Temperatura bajo el rango definido ()",
|
|
234
|
+
"02": "Temperatura sobre el rango definido ()",
|
|
235
|
+
"03": "Regreso a temperatura dentro de rango ()",
|
|
236
236
|
"04": "Botón presionado",
|
|
237
|
-
"07": "Bajo nivel de humedad",
|
|
238
|
-
"08": "Alto nivel de humedad",
|
|
239
|
-
"09": "
|
|
237
|
+
"07": "Bajo nivel de humedad ()",
|
|
238
|
+
"08": "Alto nivel de humedad ()",
|
|
239
|
+
"09": "Regreso a humedad dentro de rango ()",
|
|
240
240
|
"0A": "Evento de ángulo",
|
|
241
241
|
"0C": "Evento de magneto",
|
|
242
|
-
"0E": "
|
|
243
|
-
"0F": "
|
|
244
|
-
"10": "
|
|
242
|
+
"0E": "Neumático con presión baja ()",
|
|
243
|
+
"0F": "Neumático con presión alta ()",
|
|
244
|
+
"10": "Regreso a presión de neumáticos dentro de rango ()",
|
|
245
245
|
"11": "No se ha detectado accesorio bluetooth",
|
|
246
246
|
"12": "Se ha detectado un accesorio bluetooth",
|
|
247
247
|
"13": "Puerta abierta",
|
|
248
248
|
"14": "Puerta cerrada",
|
|
249
|
-
"15": "
|
|
249
|
+
"15": "Relay bluetooth __"
|
|
250
250
|
},
|
|
251
251
|
"GTBID": "Se ha detectado baliza bluetooth",
|
|
252
252
|
"GTLBA": {
|
package/src/utils.js
CHANGED
|
@@ -218,6 +218,17 @@ const bluetoothModels = {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
/*
|
|
222
|
+
BLE Temp & Hum sensors
|
|
223
|
+
*/
|
|
224
|
+
const bleTempHumSensors = {
|
|
225
|
+
'AC100': '0',
|
|
226
|
+
'WTH300': '2',
|
|
227
|
+
'RHT ELA': '3',
|
|
228
|
+
'WMS301': '4',
|
|
229
|
+
'WTH301': '5'
|
|
230
|
+
}
|
|
231
|
+
|
|
221
232
|
/*
|
|
222
233
|
Possible Beacon ID Models
|
|
223
234
|
*/
|
|
@@ -234,7 +245,19 @@ const beaconModels = {
|
|
|
234
245
|
const beaconTypes = {
|
|
235
246
|
'0': 'ID',
|
|
236
247
|
'1': 'iBeacon',
|
|
237
|
-
'2': 'Eddystone'
|
|
248
|
+
'2': 'Eddystone',
|
|
249
|
+
'3': 'Queclink'
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/*
|
|
253
|
+
Possible Relay BLE config results
|
|
254
|
+
*/
|
|
255
|
+
const relayBLEResults = {
|
|
256
|
+
0: 'Success',
|
|
257
|
+
1: 'Error connecting',
|
|
258
|
+
2: 'Incorrect BLE password',
|
|
259
|
+
3: 'Error updating BLE password',
|
|
260
|
+
4: 'Error'
|
|
238
261
|
}
|
|
239
262
|
|
|
240
263
|
/*
|
|
@@ -851,14 +874,14 @@ const getCanData = (parsedData, ix) => {
|
|
|
851
874
|
? expansionBin[2] === '1'
|
|
852
875
|
: null,
|
|
853
876
|
batteryIndicator: expansionBin ? expansionBin[3] === '1' : null,
|
|
854
|
-
|
|
877
|
+
brakeSystemFailureIndicator: expansionBin
|
|
855
878
|
? expansionBin[4] === '1'
|
|
856
879
|
: null,
|
|
857
880
|
oilPressureIndicator: expansionBin ? expansionBin[5] === '1' : null,
|
|
858
881
|
engineHotIndicator: expansionBin ? expansionBin[6] === '1' : null,
|
|
859
882
|
ABSFailureIndicator: expansionBin ? expansionBin[7] === '1' : null,
|
|
860
883
|
checkEngineIndicator: expansionBin ? expansionBin[9] === '1' : null,
|
|
861
|
-
|
|
884
|
+
airbagsIndicator: expansionBin ? expansionBin[10] === '1' : null,
|
|
862
885
|
serviceCallIndicator: expansionBin
|
|
863
886
|
? expansionBin[11] === '1'
|
|
864
887
|
: null,
|
|
@@ -871,6 +894,166 @@ const getCanData = (parsedData, ix) => {
|
|
|
871
894
|
}
|
|
872
895
|
}
|
|
873
896
|
|
|
897
|
+
|
|
898
|
+
/*
|
|
899
|
+
Get Bluetooth data
|
|
900
|
+
*/
|
|
901
|
+
const getBleData = (parsedData, btIndex) => {
|
|
902
|
+
let btDevices = []
|
|
903
|
+
let cnt = btIndex + 1
|
|
904
|
+
let btNum = parsedData[btIndex] !== '' ? parseInt(parsedData[btIndex]) : 1
|
|
905
|
+
|
|
906
|
+
for (let c = 0; c < btNum; c++) {
|
|
907
|
+
if (!['FE', 'FF'].includes(parsedData[cnt])) {
|
|
908
|
+
let appendMask = nHexDigit(hex2bin(parsedData[cnt + 4]), 16)
|
|
909
|
+
let aNameIx = cnt + 4 + parseInt(appendMask[15])
|
|
910
|
+
let aMacIx = aNameIx + parseInt(appendMask[14])
|
|
911
|
+
let aStatIx = aMacIx + parseInt(appendMask[13])
|
|
912
|
+
let aBatIx = aStatIx + parseInt(appendMask[12])
|
|
913
|
+
let aTmpIx = aBatIx + parseInt(appendMask[11])
|
|
914
|
+
let aHumIx = aTmpIx + parseInt(appendMask[10])
|
|
915
|
+
let ioIx = aHumIx + parseInt(appendMask[8])
|
|
916
|
+
let aEvIx = appendMask[8] === '1' && appendMask[7] === '1'
|
|
917
|
+
? ioIx + 3 : ioIx + parseInt(appendMask[7])
|
|
918
|
+
let pressIx = appendMask[7] === '1' && appendMask[6] === '1'
|
|
919
|
+
? aEvIx + 2 : aEvIx + parseInt(appendMask[6])
|
|
920
|
+
let timeIx = pressIx + parseInt(appendMask[5])
|
|
921
|
+
let eTmpIx = timeIx + parseInt(appendMask[4])
|
|
922
|
+
let magIx = eTmpIx + parseInt(appendMask[3])
|
|
923
|
+
let aBatpIx = appendMask[3] === '1' && appendMask[2] === '1'
|
|
924
|
+
? magIx + 3 : magIx + parseInt(appendMask[2])
|
|
925
|
+
let relIx = aBatpIx + parseInt(appendMask[1])
|
|
926
|
+
|
|
927
|
+
btDevices.push({
|
|
928
|
+
index: parsedData[cnt],
|
|
929
|
+
type: bluetoothAccessories[parsedData[cnt + 1]],
|
|
930
|
+
model:
|
|
931
|
+
parsedData[cnt + 2] !== ''
|
|
932
|
+
? bluetoothModels[parsedData[cnt + 1]][parsedData[cnt + 2]]
|
|
933
|
+
: null,
|
|
934
|
+
appendMask: parsedData[cnt + 4],
|
|
935
|
+
name:
|
|
936
|
+
parsedData[aNameIx] !== '' && appendMask[15] === '1'
|
|
937
|
+
? parsedData[aNameIx]
|
|
938
|
+
: null,
|
|
939
|
+
mac:
|
|
940
|
+
parsedData[aMacIx] !== '' && appendMask[14] === '1'
|
|
941
|
+
? parsedData[aMacIx]
|
|
942
|
+
: null,
|
|
943
|
+
status:
|
|
944
|
+
parsedData[aStatIx] !== '' && appendMask[13] === '1'
|
|
945
|
+
? parseInt(parsedData[aStatIx])
|
|
946
|
+
: null,
|
|
947
|
+
batteryLevel:
|
|
948
|
+
parsedData[aBatIx] !== '' && appendMask[12] === '1'
|
|
949
|
+
? parseInt(parsedData[aBatIx])
|
|
950
|
+
: null,
|
|
951
|
+
batteryPercentage:
|
|
952
|
+
parsedData[aBatpIx] !== '' && appendMask[2] === '1'
|
|
953
|
+
? parseFloat(parsedData[aBatpIx])
|
|
954
|
+
: null,
|
|
955
|
+
accessoryData: {
|
|
956
|
+
rawData: parsedData[cnt + 3] !== '' ? parsedData[cnt + 3] : null,
|
|
957
|
+
temperature:
|
|
958
|
+
parsedData[aTmpIx] !== '' && appendMask[11] === '1'
|
|
959
|
+
? parseInt(parsedData[aTmpIx])
|
|
960
|
+
: null,
|
|
961
|
+
humidity:
|
|
962
|
+
parsedData[aHumIx] !== '' && appendMask[10] === '1'
|
|
963
|
+
? parseInt(parsedData[aHumIx])
|
|
964
|
+
: null,
|
|
965
|
+
outputStatus:
|
|
966
|
+
parsedData[ioIx] !== '' && appendMask[8] === '1'
|
|
967
|
+
? parsedData[ioIx]
|
|
968
|
+
: null,
|
|
969
|
+
inputStatus:
|
|
970
|
+
parsedData[ioIx + 1] !== '' && appendMask[8] === '1'
|
|
971
|
+
? parsedData[ioIx + 1]
|
|
972
|
+
: null,
|
|
973
|
+
analogInputStatus:
|
|
974
|
+
parsedData[ioIx + 2] !== '' && appendMask[8] === '1'
|
|
975
|
+
? parsedData[ioIx + 2]
|
|
976
|
+
: null,
|
|
977
|
+
event:
|
|
978
|
+
parsedData[aEvIx] !== '' && appendMask[7] === '1'
|
|
979
|
+
? parseInt(parsedData[aEvIx])
|
|
980
|
+
: null,
|
|
981
|
+
tirePresure:
|
|
982
|
+
parsedData[pressIx] !== '' && appendMask[6] === '1'
|
|
983
|
+
? parseInt(parsedData[pressIx])
|
|
984
|
+
: null,
|
|
985
|
+
timestamp:
|
|
986
|
+
parsedData[timeIx] !== '' && appendMask[5] === '1'
|
|
987
|
+
? parseDate(parsedData[timeIx])
|
|
988
|
+
: null,
|
|
989
|
+
enhancedTemperature:
|
|
990
|
+
parsedData[eTmpIx] !== '' && appendMask[4] === '1'
|
|
991
|
+
? parseFloat(parsedData[eTmpIx])
|
|
992
|
+
: null,
|
|
993
|
+
magDevice: {
|
|
994
|
+
id:
|
|
995
|
+
parsedData[magIx] !== '' && appendMask[3] === '1'
|
|
996
|
+
? parsedData[magIx]
|
|
997
|
+
: null,
|
|
998
|
+
eventCounter:
|
|
999
|
+
parsedData[magIx + 1] !== '' && appendMask[3] === '1'
|
|
1000
|
+
? parseInt(parsedData[magIx + 1])
|
|
1001
|
+
: null,
|
|
1002
|
+
magnetState:
|
|
1003
|
+
parsedData[magIx + 2] !== '' && appendMask[3] === '1'
|
|
1004
|
+
? parseInt(parsedData[magIx + 2])
|
|
1005
|
+
: null
|
|
1006
|
+
},
|
|
1007
|
+
relay: {
|
|
1008
|
+
state:
|
|
1009
|
+
parsedData[relIx] !== '' && appendMask[1] === '1'
|
|
1010
|
+
? parseInt(parsedData[relIx])
|
|
1011
|
+
: null
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
})
|
|
1015
|
+
cnt = relIx + 1
|
|
1016
|
+
} else {
|
|
1017
|
+
let appendMask = nHexDigit(hex2bin(parsedData[cnt + 3]), 8)
|
|
1018
|
+
let aMacIx = cnt + 3 + parseInt(appendMask[6])
|
|
1019
|
+
let aBatIx = aMacIx + parseInt(appendMask[4])
|
|
1020
|
+
let aSigIx = aBatIx + parseInt(appendMask[1])
|
|
1021
|
+
let bTypeIx = aSigIx + parseInt(appendMask[0])
|
|
1022
|
+
|
|
1023
|
+
btDevices.push({
|
|
1024
|
+
index: parsedData[cnt],
|
|
1025
|
+
type: beaconTypes[parsedData[cnt + 1]],
|
|
1026
|
+
model: parsedData[cnt + 2] !== ''
|
|
1027
|
+
? beaconModels[parsedData[cnt + 2]]
|
|
1028
|
+
: null,
|
|
1029
|
+
appendMask: parsedData[cnt + 3],
|
|
1030
|
+
mac:
|
|
1031
|
+
parsedData[aMacIx] !== '' && appendMask[6] === '1'
|
|
1032
|
+
? parsedData[aMacIx]
|
|
1033
|
+
: null,
|
|
1034
|
+
batteryLevel:
|
|
1035
|
+
parsedData[aBatIx] !== '' && appendMask[4] === '1'
|
|
1036
|
+
? parseInt(parsedData[aBatIx])
|
|
1037
|
+
: null,
|
|
1038
|
+
SignalStrength:
|
|
1039
|
+
parsedData[aSigIx] !== '' && appendMask[1] === '1'
|
|
1040
|
+
? parseInt(parsedData[aSigIx])
|
|
1041
|
+
: null,
|
|
1042
|
+
beaconType:
|
|
1043
|
+
parsedData[bTypeIx] !== '' && appendMask[0] === '1'
|
|
1044
|
+
? parseInt(parsedData[bTypeIx])
|
|
1045
|
+
: null,
|
|
1046
|
+
beaconData:
|
|
1047
|
+
parsedData[bTypeIx + 1] !== '' && appendMask[0] === '1'
|
|
1048
|
+
? parseInt(parsedData[bTypeIx + 1])
|
|
1049
|
+
: null,
|
|
1050
|
+
})
|
|
1051
|
+
cnt = bTypeIx + 1 + parseInt(appendMask[1])
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return btDevices
|
|
1055
|
+
}
|
|
1056
|
+
|
|
874
1057
|
/*
|
|
875
1058
|
Gets the alarm type
|
|
876
1059
|
*/
|
|
@@ -1375,10 +1558,67 @@ const getAlarm = (command, report, extra = false) => {
|
|
|
1375
1558
|
} else if (command === 'GTBDS') {
|
|
1376
1559
|
return { type: 'Bluetooth_Disonnected', message: messages[command] }
|
|
1377
1560
|
} else if (command === 'GTBAA') {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1561
|
+
if (['01', '02', '03'].includes(report)) {
|
|
1562
|
+
const number = parseInt(extra[0])
|
|
1563
|
+
const mac = extra[1]
|
|
1564
|
+
const temperature = extra[2].enhancedTemperature ? extra[2].enhancedTemperature : extra[2].temperature
|
|
1565
|
+
const status = report !== '03' // 01 & 02 means outside range, 03 means inside range
|
|
1566
|
+
return {
|
|
1567
|
+
type: 'Outside_Temperature',
|
|
1568
|
+
number: number,
|
|
1569
|
+
deviceID: mac,
|
|
1570
|
+
status: status,
|
|
1571
|
+
temperature: temperature,
|
|
1572
|
+
message: messages[command][report].replace('()', `(${temperature}°C)`)
|
|
1573
|
+
}
|
|
1574
|
+
} else if (['07', '08', '09'].includes(report)) {
|
|
1575
|
+
const number = parseInt(extra[0])
|
|
1576
|
+
const mac = extra[1]
|
|
1577
|
+
const humidity = extra[2].humidity ? extra[2].humidity : null
|
|
1578
|
+
const status = report !== '09' // 07 & 08 means outside range, 09 means inside range
|
|
1579
|
+
return {
|
|
1580
|
+
type: 'Outside_Humidity',
|
|
1581
|
+
number: number,
|
|
1582
|
+
deviceID: mac,
|
|
1583
|
+
status: status,
|
|
1584
|
+
humidity: humidity,
|
|
1585
|
+
message: messages[command][report].replace('()', `(${humidity}%)`)
|
|
1586
|
+
}
|
|
1587
|
+
} else if (['0E', '0F', '10'].includes(report)) {
|
|
1588
|
+
const number = parseInt(extra[0])
|
|
1589
|
+
const mac = extra[1]
|
|
1590
|
+
const pressure = extra[2].tirePresure ? extra[2].tirePresure : null
|
|
1591
|
+
const status = report !== '10' // 0E & 0F means outside range, 10 means inside range
|
|
1592
|
+
return {
|
|
1593
|
+
type: 'Outside_Tire_Pressure',
|
|
1594
|
+
number: number,
|
|
1595
|
+
deviceID: mac,
|
|
1596
|
+
status: status,
|
|
1597
|
+
pressure: pressure,
|
|
1598
|
+
message: messages[command][report].replace('()', `(${pressure}kPa)`)
|
|
1599
|
+
}
|
|
1600
|
+
} else if (report === '15') {
|
|
1601
|
+
const number = parseInt(extra[0])
|
|
1602
|
+
const mac = extra[1]
|
|
1603
|
+
const status = extra[2].relay.state === 1
|
|
1604
|
+
const humanStatus = status ? 'activado' : 'desactivado'
|
|
1605
|
+
const configResult = extra[2].relay.configResult ? extra[2].relay.configResult : null
|
|
1606
|
+
return {
|
|
1607
|
+
type: 'Relay_BLE',
|
|
1608
|
+
number: number,
|
|
1609
|
+
deviceID: mac,
|
|
1610
|
+
status: status,
|
|
1611
|
+
configResult: configResult,
|
|
1612
|
+
message: messages[command][report].replace('__', `${humanStatus}`)
|
|
1613
|
+
}
|
|
1614
|
+
} else {
|
|
1615
|
+
return {
|
|
1616
|
+
type: 'Bluetooth_Alarm',
|
|
1617
|
+
message: messages[command][report]
|
|
1618
|
+
}
|
|
1381
1619
|
}
|
|
1620
|
+
|
|
1621
|
+
|
|
1382
1622
|
} else {
|
|
1383
1623
|
return {
|
|
1384
1624
|
type: command,
|
|
@@ -1505,8 +1745,10 @@ module.exports = {
|
|
|
1505
1745
|
disconnectionReasons: disconnectionReasons,
|
|
1506
1746
|
bluetoothAccessories: bluetoothAccessories,
|
|
1507
1747
|
bluetoothModels: bluetoothModels,
|
|
1748
|
+
bleTempHumSensors: bleTempHumSensors,
|
|
1508
1749
|
beaconModels: beaconModels,
|
|
1509
1750
|
beaconTypes: beaconTypes,
|
|
1751
|
+
relayBLEResults: relayBLEResults,
|
|
1510
1752
|
dTimeStates: dTimeStates,
|
|
1511
1753
|
dWorkingStates: dWorkingStates,
|
|
1512
1754
|
gnssTriggerTypes: gnssTriggerTypes,
|
|
@@ -1526,6 +1768,7 @@ module.exports = {
|
|
|
1526
1768
|
getSignalStrength: getSignalStrength,
|
|
1527
1769
|
getSignalPercentage: getSignalPercentage,
|
|
1528
1770
|
getCanData: getCanData,
|
|
1771
|
+
getBleData: getBleData,
|
|
1529
1772
|
getAlarm: getAlarm,
|
|
1530
1773
|
bin2dec: bin2dec,
|
|
1531
1774
|
bin2hex: bin2hex,
|