tirecheck-device-sdk 0.1.9 → 0.1.92
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/dist/index.cjs +143 -28
- package/dist/index.d.cts +51 -33
- package/dist/index.d.mts +51 -33
- package/dist/index.d.ts +51 -33
- package/dist/index.mjs +143 -28
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22,7 +22,8 @@ const store = {
|
|
|
22
22
|
/** undefined - no information but since we get advertisings it is most likely disconnected, connecting - trying to connect via bluetooth, connected - connected via bluetooth (can send write and read), paired - all additional connection steps completed (setMtu, sendPin, etc) */
|
|
23
23
|
deviceState: {},
|
|
24
24
|
// undefined => connecting => connected => paired => disconnecting => undefined
|
|
25
|
-
|
|
25
|
+
/** some bridge commands require bridge reboot to be completed */
|
|
26
|
+
bridgeRebootRequired: {},
|
|
26
27
|
//** Ios uses generated device Id, bridges send mac address in advertising so internaly we always use mac address but when real device id is needed we check mapping table for it */
|
|
27
28
|
deviceIdMapingTable: {},
|
|
28
29
|
/** Used to change device state in store, also notifies app via calback. Every undefined state should have its reason so that app can handle it accordingly */
|
|
@@ -149,6 +150,9 @@ const bridgeTools = {
|
|
|
149
150
|
if (displayUnits === "decimal") {
|
|
150
151
|
return Number(`0x${_reversedData.map((dec) => this.decimalToHex(dec)).join("")}`.replace(/\r\n/g, ""));
|
|
151
152
|
}
|
|
153
|
+
if (displayUnits === "reverseHex") {
|
|
154
|
+
return _reversedData.map((dec) => this.decimalToHex(dec).split("").reverse().join("")).join("");
|
|
155
|
+
}
|
|
152
156
|
return _reversedData.map((dec) => this.decimalToHex(dec)).join("");
|
|
153
157
|
},
|
|
154
158
|
encodeData(data, displayUnits) {
|
|
@@ -159,6 +163,11 @@ const bridgeTools = {
|
|
|
159
163
|
if (displayUnits === "decimal") {
|
|
160
164
|
return this.hexToDecimalArray(this.decimalToHex(_data)).reverse();
|
|
161
165
|
}
|
|
166
|
+
if (displayUnits === "reverseHex") {
|
|
167
|
+
const byteArray = _data.match(/.{1,2}/g) || [];
|
|
168
|
+
const reversedBytes = byteArray.map((b) => b.split("").reverse().join(""));
|
|
169
|
+
return this.hexToDecimalArray(reversedBytes.join("")).reverse();
|
|
170
|
+
}
|
|
162
171
|
return this.hexToDecimalArray(_data).reverse();
|
|
163
172
|
},
|
|
164
173
|
// getBridgeId(device: BluetoothDeviceBridge) {
|
|
@@ -463,7 +472,7 @@ const deviceMeta = {
|
|
|
463
472
|
},
|
|
464
473
|
bridgeOta: {
|
|
465
474
|
nameRegex: /(CAN BLE BRDG OTA.*|0303.{2}_B)/,
|
|
466
|
-
mtu:
|
|
475
|
+
mtu: 180,
|
|
467
476
|
characteristic: {
|
|
468
477
|
serviceId: "4880c12c-fdcb-4077-8920-a450d7f9b907",
|
|
469
478
|
characteristicId: "fec26ec4-6d71-4442-9f81-55bc21d658d7"
|
|
@@ -1171,63 +1180,78 @@ const bridgeCommandStructures = {
|
|
|
1171
1180
|
structure: {
|
|
1172
1181
|
axle01: {
|
|
1173
1182
|
size: 8,
|
|
1174
|
-
description: "Axle 01 autolearn statuses, each nibble signifies a single wheel."
|
|
1183
|
+
description: "Axle 01 autolearn statuses, each nibble signifies a single wheel.",
|
|
1184
|
+
display: "reverseHex"
|
|
1175
1185
|
},
|
|
1176
1186
|
axle02: {
|
|
1177
1187
|
size: 8,
|
|
1178
|
-
description: "Axle 02 autolearn statuses, each nibble signifies a single wheel"
|
|
1188
|
+
description: "Axle 02 autolearn statuses, each nibble signifies a single wheel",
|
|
1189
|
+
display: "reverseHex"
|
|
1179
1190
|
},
|
|
1180
1191
|
axle03: {
|
|
1181
1192
|
size: 8,
|
|
1182
|
-
description: "Axle 03 autolearn statuses, each nibble signifies a single wheel"
|
|
1193
|
+
description: "Axle 03 autolearn statuses, each nibble signifies a single wheel",
|
|
1194
|
+
display: "reverseHex"
|
|
1183
1195
|
},
|
|
1184
1196
|
axle04: {
|
|
1185
1197
|
size: 8,
|
|
1186
|
-
description: "Axle 04 autolearn statuses, each nibble signifies a single wheel"
|
|
1198
|
+
description: "Axle 04 autolearn statuses, each nibble signifies a single wheel",
|
|
1199
|
+
display: "reverseHex"
|
|
1187
1200
|
},
|
|
1188
1201
|
axle05: {
|
|
1189
1202
|
size: 8,
|
|
1190
|
-
description: "Axle 05 autolearn statuses, each nibble signifies a single wheel"
|
|
1203
|
+
description: "Axle 05 autolearn statuses, each nibble signifies a single wheel",
|
|
1204
|
+
display: "reverseHex"
|
|
1191
1205
|
},
|
|
1192
1206
|
axle06: {
|
|
1193
1207
|
size: 8,
|
|
1194
|
-
description: "Axle 06 autolearn statuses, each nibble signifies a single wheel"
|
|
1208
|
+
description: "Axle 06 autolearn statuses, each nibble signifies a single wheel",
|
|
1209
|
+
display: "reverseHex"
|
|
1195
1210
|
},
|
|
1196
1211
|
axle07: {
|
|
1197
1212
|
size: 8,
|
|
1198
|
-
description: "Axle 07 autolearn statuses, each nibble signifies a single wheel"
|
|
1213
|
+
description: "Axle 07 autolearn statuses, each nibble signifies a single wheel",
|
|
1214
|
+
display: "reverseHex"
|
|
1199
1215
|
},
|
|
1200
1216
|
axle08: {
|
|
1201
1217
|
size: 8,
|
|
1202
|
-
description: "Axle 08 autolearn statuses, each nibble signifies a single wheel"
|
|
1218
|
+
description: "Axle 08 autolearn statuses, each nibble signifies a single wheel",
|
|
1219
|
+
display: "reverseHex"
|
|
1203
1220
|
},
|
|
1204
1221
|
axle09: {
|
|
1205
1222
|
size: 8,
|
|
1206
|
-
description: "Axle 09 autolearn statuses, each nibble signifies a single wheel"
|
|
1223
|
+
description: "Axle 09 autolearn statuses, each nibble signifies a single wheel",
|
|
1224
|
+
display: "reverseHex"
|
|
1207
1225
|
},
|
|
1208
1226
|
axle10: {
|
|
1209
1227
|
size: 8,
|
|
1210
|
-
description: "Axle 10 autolearn statuses, each nibble signifies a single wheel"
|
|
1228
|
+
description: "Axle 10 autolearn statuses, each nibble signifies a single wheel",
|
|
1229
|
+
display: "reverseHex"
|
|
1211
1230
|
},
|
|
1212
1231
|
axle11: {
|
|
1213
1232
|
size: 8,
|
|
1214
|
-
description: "Axle 11 autolearn statuses, each nibble signifies a single wheel"
|
|
1233
|
+
description: "Axle 11 autolearn statuses, each nibble signifies a single wheel",
|
|
1234
|
+
display: "reverseHex"
|
|
1215
1235
|
},
|
|
1216
1236
|
axle12: {
|
|
1217
1237
|
size: 8,
|
|
1218
|
-
description: "Axle 12 autolearn statuses, each nibble signifies a single wheel"
|
|
1238
|
+
description: "Axle 12 autolearn statuses, each nibble signifies a single wheel",
|
|
1239
|
+
display: "reverseHex"
|
|
1219
1240
|
},
|
|
1220
1241
|
axle13: {
|
|
1221
1242
|
size: 8,
|
|
1222
|
-
description: "Axle 13 autolearn statuses, each nibble signifies a single wheel"
|
|
1243
|
+
description: "Axle 13 autolearn statuses, each nibble signifies a single wheel",
|
|
1244
|
+
display: "reverseHex"
|
|
1223
1245
|
},
|
|
1224
1246
|
axle14: {
|
|
1225
1247
|
size: 8,
|
|
1226
|
-
description: "Axle 14 autolearn statuses, each nibble signifies a single wheel"
|
|
1248
|
+
description: "Axle 14 autolearn statuses, each nibble signifies a single wheel",
|
|
1249
|
+
display: "reverseHex"
|
|
1227
1250
|
},
|
|
1228
1251
|
axle15: {
|
|
1229
1252
|
size: 8,
|
|
1230
|
-
description: "Axle 15 autolearn statuses, each nibble signifies a single wheel"
|
|
1253
|
+
description: "Axle 15 autolearn statuses, each nibble signifies a single wheel",
|
|
1254
|
+
display: "reverseHex"
|
|
1231
1255
|
}
|
|
1232
1256
|
}
|
|
1233
1257
|
},
|
|
@@ -1296,6 +1320,88 @@ const bridgeCommandStructures = {
|
|
|
1296
1320
|
description: "Unknown sensor data"
|
|
1297
1321
|
}
|
|
1298
1322
|
}
|
|
1323
|
+
},
|
|
1324
|
+
vehicleLayout: {
|
|
1325
|
+
id: [98, 1],
|
|
1326
|
+
name: "vehicleLayout",
|
|
1327
|
+
structure: {
|
|
1328
|
+
axle01: {
|
|
1329
|
+
size: 2,
|
|
1330
|
+
description: "Axle 01 each bit represents present tyre."
|
|
1331
|
+
},
|
|
1332
|
+
axle02: {
|
|
1333
|
+
size: 2,
|
|
1334
|
+
description: "Axle 02 each bit represents present tyre"
|
|
1335
|
+
},
|
|
1336
|
+
axle03: {
|
|
1337
|
+
size: 2,
|
|
1338
|
+
description: "Axle 03 each bit represents present tyre"
|
|
1339
|
+
},
|
|
1340
|
+
axle04: {
|
|
1341
|
+
size: 2,
|
|
1342
|
+
description: "Axle 04 each bit represents present tyre"
|
|
1343
|
+
},
|
|
1344
|
+
axle05: {
|
|
1345
|
+
size: 2,
|
|
1346
|
+
description: "Axle 05 each bit represents present tyre"
|
|
1347
|
+
},
|
|
1348
|
+
axle06: {
|
|
1349
|
+
size: 2,
|
|
1350
|
+
description: "Axle 06 each bit represents present tyre"
|
|
1351
|
+
},
|
|
1352
|
+
axle07: {
|
|
1353
|
+
size: 2,
|
|
1354
|
+
description: "Axle 07 each bit represents present tyre"
|
|
1355
|
+
},
|
|
1356
|
+
axle08: {
|
|
1357
|
+
size: 2,
|
|
1358
|
+
description: "Axle 08 each bit represents present tyre"
|
|
1359
|
+
},
|
|
1360
|
+
axle09: {
|
|
1361
|
+
size: 2,
|
|
1362
|
+
description: "Axle 09 each bit represents present tyre"
|
|
1363
|
+
},
|
|
1364
|
+
axle10: {
|
|
1365
|
+
size: 2,
|
|
1366
|
+
description: "Axle 10 each bit represents present tyre"
|
|
1367
|
+
},
|
|
1368
|
+
axle11: {
|
|
1369
|
+
size: 2,
|
|
1370
|
+
description: "Axle 11 each bit represents present tyre"
|
|
1371
|
+
},
|
|
1372
|
+
axle12: {
|
|
1373
|
+
size: 2,
|
|
1374
|
+
description: "Axle 12 each bit represents present tyre"
|
|
1375
|
+
},
|
|
1376
|
+
axle13: {
|
|
1377
|
+
size: 2,
|
|
1378
|
+
description: "Axle 13 each bit represents present tyre"
|
|
1379
|
+
},
|
|
1380
|
+
axle14: {
|
|
1381
|
+
size: 2,
|
|
1382
|
+
description: "Axle 14 each bit represents present tyre"
|
|
1383
|
+
},
|
|
1384
|
+
axle15: {
|
|
1385
|
+
size: 2,
|
|
1386
|
+
description: "Axle 15 each bit represents present tyre"
|
|
1387
|
+
},
|
|
1388
|
+
vin: {
|
|
1389
|
+
size: 17,
|
|
1390
|
+
description: "Vehicle Identification Number",
|
|
1391
|
+
display: "ascii"
|
|
1392
|
+
},
|
|
1393
|
+
vinExtension: {
|
|
1394
|
+
size: 1,
|
|
1395
|
+
description: "VIN extension",
|
|
1396
|
+
display: "ascii",
|
|
1397
|
+
optional: true
|
|
1398
|
+
},
|
|
1399
|
+
test: {
|
|
1400
|
+
size: 3,
|
|
1401
|
+
description: "Test",
|
|
1402
|
+
optional: true
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1299
1405
|
}
|
|
1300
1406
|
};
|
|
1301
1407
|
|
|
@@ -1564,7 +1670,7 @@ const promiseQueue$1 = {
|
|
|
1564
1670
|
return currentReject(new Error(`Command not succesful: ${numberArray[4]}`));
|
|
1565
1671
|
}
|
|
1566
1672
|
if ([226, 81].includes(numberArray[3]) && numberArray[4] && toolsSvc.canCommunicateWith(deviceId)) {
|
|
1567
|
-
store.
|
|
1673
|
+
store.bridgeRebootRequired[deviceId] = true;
|
|
1568
1674
|
}
|
|
1569
1675
|
if ((!responseIdentifier[0] || numberArray[3] === responseIdentifier[0]) && (!responseIdentifier[1] || numberArray[4] === responseIdentifier[1])) {
|
|
1570
1676
|
return currentResolve(numberArray);
|
|
@@ -1963,7 +2069,7 @@ const bridgeCommands = {
|
|
|
1963
2069
|
if (!canCommunicateWith(device.id)) throw new Error("Bridge not connected");
|
|
1964
2070
|
clearTimeout(keepAliveTimer);
|
|
1965
2071
|
keepAliveTimer = setTimeout(() => {
|
|
1966
|
-
if (
|
|
2072
|
+
if (store.deviceState[device.id] !== "paired" || store.devices[device.id]?.type !== "bridge") {
|
|
1967
2073
|
return;
|
|
1968
2074
|
}
|
|
1969
2075
|
this.sendKeepAliveCommand(device);
|
|
@@ -2008,6 +2114,7 @@ const bridgeOtaService = {
|
|
|
2008
2114
|
async function uploadOta(deviceId, firmwareBinary, reportStatus) {
|
|
2009
2115
|
let uploadedBytes = 0;
|
|
2010
2116
|
let chunkIndex = 0;
|
|
2117
|
+
const mtu = store.platform === "android" ? 512 : deviceMeta.bridgeOta.mtu;
|
|
2011
2118
|
while (uploadedBytes < firmwareBinary.byteLength) {
|
|
2012
2119
|
if (chunkIndex % 100 === 0)
|
|
2013
2120
|
reportStatus(
|
|
@@ -2016,7 +2123,7 @@ async function uploadOta(deviceId, firmwareBinary, reportStatus) {
|
|
|
2016
2123
|
)} KB)`,
|
|
2017
2124
|
uploadedBytes / firmwareBinary.byteLength
|
|
2018
2125
|
);
|
|
2019
|
-
const chunkSize = Math.min(
|
|
2126
|
+
const chunkSize = Math.min(mtu - 3, firmwareBinary.byteLength - uploadedBytes);
|
|
2020
2127
|
const chunk = firmwareBinary.slice(uploadedBytes, uploadedBytes + chunkSize);
|
|
2021
2128
|
await bridgeOtaCommands.uploadOtaChunk(deviceId, chunk);
|
|
2022
2129
|
uploadedBytes += chunkSize;
|
|
@@ -2028,7 +2135,9 @@ const bridgeOta = {
|
|
|
2028
2135
|
async connect(deviceId) {
|
|
2029
2136
|
await bluetooth.connect(deviceId, this.disconnect);
|
|
2030
2137
|
const _deviceId = store.deviceIdMapingTable[deviceId] ?? deviceId;
|
|
2031
|
-
|
|
2138
|
+
if (store.platform !== "ios") {
|
|
2139
|
+
await ble.requestMtu(_deviceId, 512);
|
|
2140
|
+
}
|
|
2032
2141
|
store.setState(deviceId, "paired");
|
|
2033
2142
|
},
|
|
2034
2143
|
async disconnect(deviceId, reason) {
|
|
@@ -2058,7 +2167,8 @@ const bridgeService = {
|
|
|
2058
2167
|
getSensorReading,
|
|
2059
2168
|
getVehicleReadings,
|
|
2060
2169
|
resetAutolearnStatuses,
|
|
2061
|
-
getAutolearnStatuses
|
|
2170
|
+
getAutolearnStatuses,
|
|
2171
|
+
isRebootRequired
|
|
2062
2172
|
};
|
|
2063
2173
|
async function updateFirmware(deviceId, bootloader, firmware, reportStatus) {
|
|
2064
2174
|
reportStatus("Sending OTA Request...", 0.02);
|
|
@@ -2656,15 +2766,15 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2656
2766
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2657
2767
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2658
2768
|
if (axlesPressureData[axleIndex * 3]) {
|
|
2659
|
-
tcVehicleAxle.maxTargetPressure = bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3]);
|
|
2769
|
+
tcVehicleAxle.maxTargetPressure = ___default.round(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3]), 1);
|
|
2660
2770
|
}
|
|
2661
2771
|
if (axlesPressureData[axleIndex * 3 + 1]) {
|
|
2662
|
-
tcVehicleAxle.minTargetPressure = bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1]);
|
|
2772
|
+
tcVehicleAxle.minTargetPressure = ___default.round(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1]), 1);
|
|
2663
2773
|
}
|
|
2664
2774
|
if (axlesPressureData[axleIndex * 3 + 2]) {
|
|
2665
|
-
tcVehicleAxle.targetPressure =
|
|
2666
|
-
axlesPressureData[axleIndex * 3 + 2],
|
|
2667
|
-
|
|
2775
|
+
tcVehicleAxle.targetPressure = ___default.round(
|
|
2776
|
+
bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 2], void 0),
|
|
2777
|
+
1
|
|
2668
2778
|
);
|
|
2669
2779
|
}
|
|
2670
2780
|
return tcVehicleAxle;
|
|
@@ -2675,6 +2785,9 @@ function createNewTyre(positionId) {
|
|
|
2675
2785
|
serialNumber: `TYRE-${positionId}`
|
|
2676
2786
|
};
|
|
2677
2787
|
}
|
|
2788
|
+
function isRebootRequired(deviceId) {
|
|
2789
|
+
return store.bridgeRebootRequired[deviceId];
|
|
2790
|
+
}
|
|
2678
2791
|
|
|
2679
2792
|
const bridge = {
|
|
2680
2793
|
async connect(deviceId, accessLevel) {
|
|
@@ -2694,6 +2807,7 @@ const bridge = {
|
|
|
2694
2807
|
(error) => console.error("startNotification Error", error)
|
|
2695
2808
|
);
|
|
2696
2809
|
store.deviceAccessLevel[deviceId] = accessLevel ?? "driver";
|
|
2810
|
+
store.bridgeRebootRequired[deviceId] = false;
|
|
2697
2811
|
await bridgeCommands.sendPinCommand(deviceId);
|
|
2698
2812
|
store.setState(deviceId, "paired");
|
|
2699
2813
|
},
|
|
@@ -2713,7 +2827,8 @@ const bridge = {
|
|
|
2713
2827
|
getVehicleReadings: bridgeService.getVehicleReadings,
|
|
2714
2828
|
getAutolearnStatuses: bridgeService.getAutolearnStatuses,
|
|
2715
2829
|
resetAutolearnStatuses: bridgeService.resetAutolearnStatuses,
|
|
2716
|
-
updateFirmware: bridgeService.updateFirmware
|
|
2830
|
+
updateFirmware: bridgeService.updateFirmware,
|
|
2831
|
+
isRebootRequired: bridgeService.isRebootRequired
|
|
2717
2832
|
};
|
|
2718
2833
|
|
|
2719
2834
|
const flexiGaugeTpmsMeta = deviceMeta.flexiGaugeTpms;
|
package/dist/index.d.cts
CHANGED
|
@@ -563,135 +563,152 @@ declare const _default: {
|
|
|
563
563
|
};
|
|
564
564
|
};
|
|
565
565
|
};
|
|
566
|
-
autolearnIdStatus:
|
|
566
|
+
autolearnIdStatus: BridgeCommandStructure;
|
|
567
|
+
autolearnUnknownSensors: {
|
|
567
568
|
id: number[];
|
|
568
569
|
name: string;
|
|
569
570
|
structure: {
|
|
570
|
-
|
|
571
|
+
sensor01: {
|
|
571
572
|
size: number;
|
|
572
573
|
description: string;
|
|
573
574
|
};
|
|
574
|
-
|
|
575
|
+
sensor02: {
|
|
575
576
|
size: number;
|
|
576
577
|
description: string;
|
|
577
578
|
};
|
|
578
|
-
|
|
579
|
+
sensor03: {
|
|
579
580
|
size: number;
|
|
580
581
|
description: string;
|
|
581
582
|
};
|
|
582
|
-
|
|
583
|
+
sensor04: {
|
|
583
584
|
size: number;
|
|
584
585
|
description: string;
|
|
585
586
|
};
|
|
586
|
-
|
|
587
|
+
sensor05: {
|
|
587
588
|
size: number;
|
|
588
589
|
description: string;
|
|
589
590
|
};
|
|
590
|
-
|
|
591
|
+
sensor06: {
|
|
591
592
|
size: number;
|
|
592
593
|
description: string;
|
|
593
594
|
};
|
|
594
|
-
|
|
595
|
+
sensor07: {
|
|
595
596
|
size: number;
|
|
596
597
|
description: string;
|
|
597
598
|
};
|
|
598
|
-
|
|
599
|
+
sensor08: {
|
|
599
600
|
size: number;
|
|
600
601
|
description: string;
|
|
601
602
|
};
|
|
602
|
-
|
|
603
|
+
sensor09: {
|
|
603
604
|
size: number;
|
|
604
605
|
description: string;
|
|
605
606
|
};
|
|
606
|
-
|
|
607
|
+
sensor10: {
|
|
607
608
|
size: number;
|
|
608
609
|
description: string;
|
|
609
610
|
};
|
|
610
|
-
|
|
611
|
+
sensor11: {
|
|
611
612
|
size: number;
|
|
612
613
|
description: string;
|
|
613
614
|
};
|
|
614
|
-
|
|
615
|
+
sensor12: {
|
|
615
616
|
size: number;
|
|
616
617
|
description: string;
|
|
617
618
|
};
|
|
618
|
-
|
|
619
|
+
sensor13: {
|
|
619
620
|
size: number;
|
|
620
621
|
description: string;
|
|
621
622
|
};
|
|
622
|
-
|
|
623
|
+
sensor14: {
|
|
623
624
|
size: number;
|
|
624
625
|
description: string;
|
|
625
626
|
};
|
|
626
|
-
|
|
627
|
+
sensor15: {
|
|
627
628
|
size: number;
|
|
628
629
|
description: string;
|
|
629
630
|
};
|
|
630
631
|
};
|
|
631
632
|
};
|
|
632
|
-
|
|
633
|
+
vehicleLayout: {
|
|
633
634
|
id: number[];
|
|
634
635
|
name: string;
|
|
635
636
|
structure: {
|
|
636
|
-
|
|
637
|
+
axle01: {
|
|
637
638
|
size: number;
|
|
638
639
|
description: string;
|
|
639
640
|
};
|
|
640
|
-
|
|
641
|
+
axle02: {
|
|
641
642
|
size: number;
|
|
642
643
|
description: string;
|
|
643
644
|
};
|
|
644
|
-
|
|
645
|
+
axle03: {
|
|
645
646
|
size: number;
|
|
646
647
|
description: string;
|
|
647
648
|
};
|
|
648
|
-
|
|
649
|
+
axle04: {
|
|
649
650
|
size: number;
|
|
650
651
|
description: string;
|
|
651
652
|
};
|
|
652
|
-
|
|
653
|
+
axle05: {
|
|
653
654
|
size: number;
|
|
654
655
|
description: string;
|
|
655
656
|
};
|
|
656
|
-
|
|
657
|
+
axle06: {
|
|
657
658
|
size: number;
|
|
658
659
|
description: string;
|
|
659
660
|
};
|
|
660
|
-
|
|
661
|
+
axle07: {
|
|
661
662
|
size: number;
|
|
662
663
|
description: string;
|
|
663
664
|
};
|
|
664
|
-
|
|
665
|
+
axle08: {
|
|
665
666
|
size: number;
|
|
666
667
|
description: string;
|
|
667
668
|
};
|
|
668
|
-
|
|
669
|
+
axle09: {
|
|
669
670
|
size: number;
|
|
670
671
|
description: string;
|
|
671
672
|
};
|
|
672
|
-
|
|
673
|
+
axle10: {
|
|
673
674
|
size: number;
|
|
674
675
|
description: string;
|
|
675
676
|
};
|
|
676
|
-
|
|
677
|
+
axle11: {
|
|
677
678
|
size: number;
|
|
678
679
|
description: string;
|
|
679
680
|
};
|
|
680
|
-
|
|
681
|
+
axle12: {
|
|
681
682
|
size: number;
|
|
682
683
|
description: string;
|
|
683
684
|
};
|
|
684
|
-
|
|
685
|
+
axle13: {
|
|
685
686
|
size: number;
|
|
686
687
|
description: string;
|
|
687
688
|
};
|
|
688
|
-
|
|
689
|
+
axle14: {
|
|
689
690
|
size: number;
|
|
690
691
|
description: string;
|
|
691
692
|
};
|
|
692
|
-
|
|
693
|
+
axle15: {
|
|
694
|
+
size: number;
|
|
695
|
+
description: string;
|
|
696
|
+
};
|
|
697
|
+
vin: {
|
|
698
|
+
size: number;
|
|
699
|
+
description: string;
|
|
700
|
+
display: "ascii";
|
|
701
|
+
};
|
|
702
|
+
vinExtension: {
|
|
703
|
+
size: number;
|
|
704
|
+
description: string;
|
|
705
|
+
display: "ascii";
|
|
706
|
+
optional: true;
|
|
707
|
+
};
|
|
708
|
+
test: {
|
|
693
709
|
size: number;
|
|
694
710
|
description: string;
|
|
711
|
+
optional: true;
|
|
695
712
|
};
|
|
696
713
|
};
|
|
697
714
|
};
|
|
@@ -807,7 +824,7 @@ interface BridgeCommandStructure {
|
|
|
807
824
|
interface BridgeCommandStructureProperties {
|
|
808
825
|
[propName: string]: {
|
|
809
826
|
size: number;
|
|
810
|
-
display?: 'decimal' | 'ascii';
|
|
827
|
+
display?: 'decimal' | 'ascii' | 'reverseHex';
|
|
811
828
|
description: string;
|
|
812
829
|
optional?: boolean;
|
|
813
830
|
};
|
|
@@ -902,6 +919,7 @@ declare function createTirecheckDeviceSdk(bleImplementation: BleImplementation,
|
|
|
902
919
|
getAutolearnStatuses: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeAutolearnStatus[]>;
|
|
903
920
|
resetAutolearnStatuses: (deviceId: string, positionIds: number[]) => Promise<void>;
|
|
904
921
|
updateFirmware: (deviceId: string, bootloader: ArrayBuffer, firmware: ArrayBuffer, reportStatus: ReportStatusFn) => Promise<void>;
|
|
922
|
+
isRebootRequired: (deviceId: string) => boolean;
|
|
905
923
|
};
|
|
906
924
|
/** Methods for working with Tirecheck CAN Bridge in OTA mode */
|
|
907
925
|
bridgeOta: {
|
package/dist/index.d.mts
CHANGED
|
@@ -563,135 +563,152 @@ declare const _default: {
|
|
|
563
563
|
};
|
|
564
564
|
};
|
|
565
565
|
};
|
|
566
|
-
autolearnIdStatus:
|
|
566
|
+
autolearnIdStatus: BridgeCommandStructure;
|
|
567
|
+
autolearnUnknownSensors: {
|
|
567
568
|
id: number[];
|
|
568
569
|
name: string;
|
|
569
570
|
structure: {
|
|
570
|
-
|
|
571
|
+
sensor01: {
|
|
571
572
|
size: number;
|
|
572
573
|
description: string;
|
|
573
574
|
};
|
|
574
|
-
|
|
575
|
+
sensor02: {
|
|
575
576
|
size: number;
|
|
576
577
|
description: string;
|
|
577
578
|
};
|
|
578
|
-
|
|
579
|
+
sensor03: {
|
|
579
580
|
size: number;
|
|
580
581
|
description: string;
|
|
581
582
|
};
|
|
582
|
-
|
|
583
|
+
sensor04: {
|
|
583
584
|
size: number;
|
|
584
585
|
description: string;
|
|
585
586
|
};
|
|
586
|
-
|
|
587
|
+
sensor05: {
|
|
587
588
|
size: number;
|
|
588
589
|
description: string;
|
|
589
590
|
};
|
|
590
|
-
|
|
591
|
+
sensor06: {
|
|
591
592
|
size: number;
|
|
592
593
|
description: string;
|
|
593
594
|
};
|
|
594
|
-
|
|
595
|
+
sensor07: {
|
|
595
596
|
size: number;
|
|
596
597
|
description: string;
|
|
597
598
|
};
|
|
598
|
-
|
|
599
|
+
sensor08: {
|
|
599
600
|
size: number;
|
|
600
601
|
description: string;
|
|
601
602
|
};
|
|
602
|
-
|
|
603
|
+
sensor09: {
|
|
603
604
|
size: number;
|
|
604
605
|
description: string;
|
|
605
606
|
};
|
|
606
|
-
|
|
607
|
+
sensor10: {
|
|
607
608
|
size: number;
|
|
608
609
|
description: string;
|
|
609
610
|
};
|
|
610
|
-
|
|
611
|
+
sensor11: {
|
|
611
612
|
size: number;
|
|
612
613
|
description: string;
|
|
613
614
|
};
|
|
614
|
-
|
|
615
|
+
sensor12: {
|
|
615
616
|
size: number;
|
|
616
617
|
description: string;
|
|
617
618
|
};
|
|
618
|
-
|
|
619
|
+
sensor13: {
|
|
619
620
|
size: number;
|
|
620
621
|
description: string;
|
|
621
622
|
};
|
|
622
|
-
|
|
623
|
+
sensor14: {
|
|
623
624
|
size: number;
|
|
624
625
|
description: string;
|
|
625
626
|
};
|
|
626
|
-
|
|
627
|
+
sensor15: {
|
|
627
628
|
size: number;
|
|
628
629
|
description: string;
|
|
629
630
|
};
|
|
630
631
|
};
|
|
631
632
|
};
|
|
632
|
-
|
|
633
|
+
vehicleLayout: {
|
|
633
634
|
id: number[];
|
|
634
635
|
name: string;
|
|
635
636
|
structure: {
|
|
636
|
-
|
|
637
|
+
axle01: {
|
|
637
638
|
size: number;
|
|
638
639
|
description: string;
|
|
639
640
|
};
|
|
640
|
-
|
|
641
|
+
axle02: {
|
|
641
642
|
size: number;
|
|
642
643
|
description: string;
|
|
643
644
|
};
|
|
644
|
-
|
|
645
|
+
axle03: {
|
|
645
646
|
size: number;
|
|
646
647
|
description: string;
|
|
647
648
|
};
|
|
648
|
-
|
|
649
|
+
axle04: {
|
|
649
650
|
size: number;
|
|
650
651
|
description: string;
|
|
651
652
|
};
|
|
652
|
-
|
|
653
|
+
axle05: {
|
|
653
654
|
size: number;
|
|
654
655
|
description: string;
|
|
655
656
|
};
|
|
656
|
-
|
|
657
|
+
axle06: {
|
|
657
658
|
size: number;
|
|
658
659
|
description: string;
|
|
659
660
|
};
|
|
660
|
-
|
|
661
|
+
axle07: {
|
|
661
662
|
size: number;
|
|
662
663
|
description: string;
|
|
663
664
|
};
|
|
664
|
-
|
|
665
|
+
axle08: {
|
|
665
666
|
size: number;
|
|
666
667
|
description: string;
|
|
667
668
|
};
|
|
668
|
-
|
|
669
|
+
axle09: {
|
|
669
670
|
size: number;
|
|
670
671
|
description: string;
|
|
671
672
|
};
|
|
672
|
-
|
|
673
|
+
axle10: {
|
|
673
674
|
size: number;
|
|
674
675
|
description: string;
|
|
675
676
|
};
|
|
676
|
-
|
|
677
|
+
axle11: {
|
|
677
678
|
size: number;
|
|
678
679
|
description: string;
|
|
679
680
|
};
|
|
680
|
-
|
|
681
|
+
axle12: {
|
|
681
682
|
size: number;
|
|
682
683
|
description: string;
|
|
683
684
|
};
|
|
684
|
-
|
|
685
|
+
axle13: {
|
|
685
686
|
size: number;
|
|
686
687
|
description: string;
|
|
687
688
|
};
|
|
688
|
-
|
|
689
|
+
axle14: {
|
|
689
690
|
size: number;
|
|
690
691
|
description: string;
|
|
691
692
|
};
|
|
692
|
-
|
|
693
|
+
axle15: {
|
|
694
|
+
size: number;
|
|
695
|
+
description: string;
|
|
696
|
+
};
|
|
697
|
+
vin: {
|
|
698
|
+
size: number;
|
|
699
|
+
description: string;
|
|
700
|
+
display: "ascii";
|
|
701
|
+
};
|
|
702
|
+
vinExtension: {
|
|
703
|
+
size: number;
|
|
704
|
+
description: string;
|
|
705
|
+
display: "ascii";
|
|
706
|
+
optional: true;
|
|
707
|
+
};
|
|
708
|
+
test: {
|
|
693
709
|
size: number;
|
|
694
710
|
description: string;
|
|
711
|
+
optional: true;
|
|
695
712
|
};
|
|
696
713
|
};
|
|
697
714
|
};
|
|
@@ -807,7 +824,7 @@ interface BridgeCommandStructure {
|
|
|
807
824
|
interface BridgeCommandStructureProperties {
|
|
808
825
|
[propName: string]: {
|
|
809
826
|
size: number;
|
|
810
|
-
display?: 'decimal' | 'ascii';
|
|
827
|
+
display?: 'decimal' | 'ascii' | 'reverseHex';
|
|
811
828
|
description: string;
|
|
812
829
|
optional?: boolean;
|
|
813
830
|
};
|
|
@@ -902,6 +919,7 @@ declare function createTirecheckDeviceSdk(bleImplementation: BleImplementation,
|
|
|
902
919
|
getAutolearnStatuses: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeAutolearnStatus[]>;
|
|
903
920
|
resetAutolearnStatuses: (deviceId: string, positionIds: number[]) => Promise<void>;
|
|
904
921
|
updateFirmware: (deviceId: string, bootloader: ArrayBuffer, firmware: ArrayBuffer, reportStatus: ReportStatusFn) => Promise<void>;
|
|
922
|
+
isRebootRequired: (deviceId: string) => boolean;
|
|
905
923
|
};
|
|
906
924
|
/** Methods for working with Tirecheck CAN Bridge in OTA mode */
|
|
907
925
|
bridgeOta: {
|
package/dist/index.d.ts
CHANGED
|
@@ -563,135 +563,152 @@ declare const _default: {
|
|
|
563
563
|
};
|
|
564
564
|
};
|
|
565
565
|
};
|
|
566
|
-
autolearnIdStatus:
|
|
566
|
+
autolearnIdStatus: BridgeCommandStructure;
|
|
567
|
+
autolearnUnknownSensors: {
|
|
567
568
|
id: number[];
|
|
568
569
|
name: string;
|
|
569
570
|
structure: {
|
|
570
|
-
|
|
571
|
+
sensor01: {
|
|
571
572
|
size: number;
|
|
572
573
|
description: string;
|
|
573
574
|
};
|
|
574
|
-
|
|
575
|
+
sensor02: {
|
|
575
576
|
size: number;
|
|
576
577
|
description: string;
|
|
577
578
|
};
|
|
578
|
-
|
|
579
|
+
sensor03: {
|
|
579
580
|
size: number;
|
|
580
581
|
description: string;
|
|
581
582
|
};
|
|
582
|
-
|
|
583
|
+
sensor04: {
|
|
583
584
|
size: number;
|
|
584
585
|
description: string;
|
|
585
586
|
};
|
|
586
|
-
|
|
587
|
+
sensor05: {
|
|
587
588
|
size: number;
|
|
588
589
|
description: string;
|
|
589
590
|
};
|
|
590
|
-
|
|
591
|
+
sensor06: {
|
|
591
592
|
size: number;
|
|
592
593
|
description: string;
|
|
593
594
|
};
|
|
594
|
-
|
|
595
|
+
sensor07: {
|
|
595
596
|
size: number;
|
|
596
597
|
description: string;
|
|
597
598
|
};
|
|
598
|
-
|
|
599
|
+
sensor08: {
|
|
599
600
|
size: number;
|
|
600
601
|
description: string;
|
|
601
602
|
};
|
|
602
|
-
|
|
603
|
+
sensor09: {
|
|
603
604
|
size: number;
|
|
604
605
|
description: string;
|
|
605
606
|
};
|
|
606
|
-
|
|
607
|
+
sensor10: {
|
|
607
608
|
size: number;
|
|
608
609
|
description: string;
|
|
609
610
|
};
|
|
610
|
-
|
|
611
|
+
sensor11: {
|
|
611
612
|
size: number;
|
|
612
613
|
description: string;
|
|
613
614
|
};
|
|
614
|
-
|
|
615
|
+
sensor12: {
|
|
615
616
|
size: number;
|
|
616
617
|
description: string;
|
|
617
618
|
};
|
|
618
|
-
|
|
619
|
+
sensor13: {
|
|
619
620
|
size: number;
|
|
620
621
|
description: string;
|
|
621
622
|
};
|
|
622
|
-
|
|
623
|
+
sensor14: {
|
|
623
624
|
size: number;
|
|
624
625
|
description: string;
|
|
625
626
|
};
|
|
626
|
-
|
|
627
|
+
sensor15: {
|
|
627
628
|
size: number;
|
|
628
629
|
description: string;
|
|
629
630
|
};
|
|
630
631
|
};
|
|
631
632
|
};
|
|
632
|
-
|
|
633
|
+
vehicleLayout: {
|
|
633
634
|
id: number[];
|
|
634
635
|
name: string;
|
|
635
636
|
structure: {
|
|
636
|
-
|
|
637
|
+
axle01: {
|
|
637
638
|
size: number;
|
|
638
639
|
description: string;
|
|
639
640
|
};
|
|
640
|
-
|
|
641
|
+
axle02: {
|
|
641
642
|
size: number;
|
|
642
643
|
description: string;
|
|
643
644
|
};
|
|
644
|
-
|
|
645
|
+
axle03: {
|
|
645
646
|
size: number;
|
|
646
647
|
description: string;
|
|
647
648
|
};
|
|
648
|
-
|
|
649
|
+
axle04: {
|
|
649
650
|
size: number;
|
|
650
651
|
description: string;
|
|
651
652
|
};
|
|
652
|
-
|
|
653
|
+
axle05: {
|
|
653
654
|
size: number;
|
|
654
655
|
description: string;
|
|
655
656
|
};
|
|
656
|
-
|
|
657
|
+
axle06: {
|
|
657
658
|
size: number;
|
|
658
659
|
description: string;
|
|
659
660
|
};
|
|
660
|
-
|
|
661
|
+
axle07: {
|
|
661
662
|
size: number;
|
|
662
663
|
description: string;
|
|
663
664
|
};
|
|
664
|
-
|
|
665
|
+
axle08: {
|
|
665
666
|
size: number;
|
|
666
667
|
description: string;
|
|
667
668
|
};
|
|
668
|
-
|
|
669
|
+
axle09: {
|
|
669
670
|
size: number;
|
|
670
671
|
description: string;
|
|
671
672
|
};
|
|
672
|
-
|
|
673
|
+
axle10: {
|
|
673
674
|
size: number;
|
|
674
675
|
description: string;
|
|
675
676
|
};
|
|
676
|
-
|
|
677
|
+
axle11: {
|
|
677
678
|
size: number;
|
|
678
679
|
description: string;
|
|
679
680
|
};
|
|
680
|
-
|
|
681
|
+
axle12: {
|
|
681
682
|
size: number;
|
|
682
683
|
description: string;
|
|
683
684
|
};
|
|
684
|
-
|
|
685
|
+
axle13: {
|
|
685
686
|
size: number;
|
|
686
687
|
description: string;
|
|
687
688
|
};
|
|
688
|
-
|
|
689
|
+
axle14: {
|
|
689
690
|
size: number;
|
|
690
691
|
description: string;
|
|
691
692
|
};
|
|
692
|
-
|
|
693
|
+
axle15: {
|
|
694
|
+
size: number;
|
|
695
|
+
description: string;
|
|
696
|
+
};
|
|
697
|
+
vin: {
|
|
698
|
+
size: number;
|
|
699
|
+
description: string;
|
|
700
|
+
display: "ascii";
|
|
701
|
+
};
|
|
702
|
+
vinExtension: {
|
|
703
|
+
size: number;
|
|
704
|
+
description: string;
|
|
705
|
+
display: "ascii";
|
|
706
|
+
optional: true;
|
|
707
|
+
};
|
|
708
|
+
test: {
|
|
693
709
|
size: number;
|
|
694
710
|
description: string;
|
|
711
|
+
optional: true;
|
|
695
712
|
};
|
|
696
713
|
};
|
|
697
714
|
};
|
|
@@ -807,7 +824,7 @@ interface BridgeCommandStructure {
|
|
|
807
824
|
interface BridgeCommandStructureProperties {
|
|
808
825
|
[propName: string]: {
|
|
809
826
|
size: number;
|
|
810
|
-
display?: 'decimal' | 'ascii';
|
|
827
|
+
display?: 'decimal' | 'ascii' | 'reverseHex';
|
|
811
828
|
description: string;
|
|
812
829
|
optional?: boolean;
|
|
813
830
|
};
|
|
@@ -902,6 +919,7 @@ declare function createTirecheckDeviceSdk(bleImplementation: BleImplementation,
|
|
|
902
919
|
getAutolearnStatuses: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeAutolearnStatus[]>;
|
|
903
920
|
resetAutolearnStatuses: (deviceId: string, positionIds: number[]) => Promise<void>;
|
|
904
921
|
updateFirmware: (deviceId: string, bootloader: ArrayBuffer, firmware: ArrayBuffer, reportStatus: ReportStatusFn) => Promise<void>;
|
|
922
|
+
isRebootRequired: (deviceId: string) => boolean;
|
|
905
923
|
};
|
|
906
924
|
/** Methods for working with Tirecheck CAN Bridge in OTA mode */
|
|
907
925
|
bridgeOta: {
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,8 @@ const store = {
|
|
|
15
15
|
/** undefined - no information but since we get advertisings it is most likely disconnected, connecting - trying to connect via bluetooth, connected - connected via bluetooth (can send write and read), paired - all additional connection steps completed (setMtu, sendPin, etc) */
|
|
16
16
|
deviceState: {},
|
|
17
17
|
// undefined => connecting => connected => paired => disconnecting => undefined
|
|
18
|
-
|
|
18
|
+
/** some bridge commands require bridge reboot to be completed */
|
|
19
|
+
bridgeRebootRequired: {},
|
|
19
20
|
//** Ios uses generated device Id, bridges send mac address in advertising so internaly we always use mac address but when real device id is needed we check mapping table for it */
|
|
20
21
|
deviceIdMapingTable: {},
|
|
21
22
|
/** Used to change device state in store, also notifies app via calback. Every undefined state should have its reason so that app can handle it accordingly */
|
|
@@ -142,6 +143,9 @@ const bridgeTools = {
|
|
|
142
143
|
if (displayUnits === "decimal") {
|
|
143
144
|
return Number(`0x${_reversedData.map((dec) => this.decimalToHex(dec)).join("")}`.replace(/\r\n/g, ""));
|
|
144
145
|
}
|
|
146
|
+
if (displayUnits === "reverseHex") {
|
|
147
|
+
return _reversedData.map((dec) => this.decimalToHex(dec).split("").reverse().join("")).join("");
|
|
148
|
+
}
|
|
145
149
|
return _reversedData.map((dec) => this.decimalToHex(dec)).join("");
|
|
146
150
|
},
|
|
147
151
|
encodeData(data, displayUnits) {
|
|
@@ -152,6 +156,11 @@ const bridgeTools = {
|
|
|
152
156
|
if (displayUnits === "decimal") {
|
|
153
157
|
return this.hexToDecimalArray(this.decimalToHex(_data)).reverse();
|
|
154
158
|
}
|
|
159
|
+
if (displayUnits === "reverseHex") {
|
|
160
|
+
const byteArray = _data.match(/.{1,2}/g) || [];
|
|
161
|
+
const reversedBytes = byteArray.map((b) => b.split("").reverse().join(""));
|
|
162
|
+
return this.hexToDecimalArray(reversedBytes.join("")).reverse();
|
|
163
|
+
}
|
|
155
164
|
return this.hexToDecimalArray(_data).reverse();
|
|
156
165
|
},
|
|
157
166
|
// getBridgeId(device: BluetoothDeviceBridge) {
|
|
@@ -456,7 +465,7 @@ const deviceMeta = {
|
|
|
456
465
|
},
|
|
457
466
|
bridgeOta: {
|
|
458
467
|
nameRegex: /(CAN BLE BRDG OTA.*|0303.{2}_B)/,
|
|
459
|
-
mtu:
|
|
468
|
+
mtu: 180,
|
|
460
469
|
characteristic: {
|
|
461
470
|
serviceId: "4880c12c-fdcb-4077-8920-a450d7f9b907",
|
|
462
471
|
characteristicId: "fec26ec4-6d71-4442-9f81-55bc21d658d7"
|
|
@@ -1164,63 +1173,78 @@ const bridgeCommandStructures = {
|
|
|
1164
1173
|
structure: {
|
|
1165
1174
|
axle01: {
|
|
1166
1175
|
size: 8,
|
|
1167
|
-
description: "Axle 01 autolearn statuses, each nibble signifies a single wheel."
|
|
1176
|
+
description: "Axle 01 autolearn statuses, each nibble signifies a single wheel.",
|
|
1177
|
+
display: "reverseHex"
|
|
1168
1178
|
},
|
|
1169
1179
|
axle02: {
|
|
1170
1180
|
size: 8,
|
|
1171
|
-
description: "Axle 02 autolearn statuses, each nibble signifies a single wheel"
|
|
1181
|
+
description: "Axle 02 autolearn statuses, each nibble signifies a single wheel",
|
|
1182
|
+
display: "reverseHex"
|
|
1172
1183
|
},
|
|
1173
1184
|
axle03: {
|
|
1174
1185
|
size: 8,
|
|
1175
|
-
description: "Axle 03 autolearn statuses, each nibble signifies a single wheel"
|
|
1186
|
+
description: "Axle 03 autolearn statuses, each nibble signifies a single wheel",
|
|
1187
|
+
display: "reverseHex"
|
|
1176
1188
|
},
|
|
1177
1189
|
axle04: {
|
|
1178
1190
|
size: 8,
|
|
1179
|
-
description: "Axle 04 autolearn statuses, each nibble signifies a single wheel"
|
|
1191
|
+
description: "Axle 04 autolearn statuses, each nibble signifies a single wheel",
|
|
1192
|
+
display: "reverseHex"
|
|
1180
1193
|
},
|
|
1181
1194
|
axle05: {
|
|
1182
1195
|
size: 8,
|
|
1183
|
-
description: "Axle 05 autolearn statuses, each nibble signifies a single wheel"
|
|
1196
|
+
description: "Axle 05 autolearn statuses, each nibble signifies a single wheel",
|
|
1197
|
+
display: "reverseHex"
|
|
1184
1198
|
},
|
|
1185
1199
|
axle06: {
|
|
1186
1200
|
size: 8,
|
|
1187
|
-
description: "Axle 06 autolearn statuses, each nibble signifies a single wheel"
|
|
1201
|
+
description: "Axle 06 autolearn statuses, each nibble signifies a single wheel",
|
|
1202
|
+
display: "reverseHex"
|
|
1188
1203
|
},
|
|
1189
1204
|
axle07: {
|
|
1190
1205
|
size: 8,
|
|
1191
|
-
description: "Axle 07 autolearn statuses, each nibble signifies a single wheel"
|
|
1206
|
+
description: "Axle 07 autolearn statuses, each nibble signifies a single wheel",
|
|
1207
|
+
display: "reverseHex"
|
|
1192
1208
|
},
|
|
1193
1209
|
axle08: {
|
|
1194
1210
|
size: 8,
|
|
1195
|
-
description: "Axle 08 autolearn statuses, each nibble signifies a single wheel"
|
|
1211
|
+
description: "Axle 08 autolearn statuses, each nibble signifies a single wheel",
|
|
1212
|
+
display: "reverseHex"
|
|
1196
1213
|
},
|
|
1197
1214
|
axle09: {
|
|
1198
1215
|
size: 8,
|
|
1199
|
-
description: "Axle 09 autolearn statuses, each nibble signifies a single wheel"
|
|
1216
|
+
description: "Axle 09 autolearn statuses, each nibble signifies a single wheel",
|
|
1217
|
+
display: "reverseHex"
|
|
1200
1218
|
},
|
|
1201
1219
|
axle10: {
|
|
1202
1220
|
size: 8,
|
|
1203
|
-
description: "Axle 10 autolearn statuses, each nibble signifies a single wheel"
|
|
1221
|
+
description: "Axle 10 autolearn statuses, each nibble signifies a single wheel",
|
|
1222
|
+
display: "reverseHex"
|
|
1204
1223
|
},
|
|
1205
1224
|
axle11: {
|
|
1206
1225
|
size: 8,
|
|
1207
|
-
description: "Axle 11 autolearn statuses, each nibble signifies a single wheel"
|
|
1226
|
+
description: "Axle 11 autolearn statuses, each nibble signifies a single wheel",
|
|
1227
|
+
display: "reverseHex"
|
|
1208
1228
|
},
|
|
1209
1229
|
axle12: {
|
|
1210
1230
|
size: 8,
|
|
1211
|
-
description: "Axle 12 autolearn statuses, each nibble signifies a single wheel"
|
|
1231
|
+
description: "Axle 12 autolearn statuses, each nibble signifies a single wheel",
|
|
1232
|
+
display: "reverseHex"
|
|
1212
1233
|
},
|
|
1213
1234
|
axle13: {
|
|
1214
1235
|
size: 8,
|
|
1215
|
-
description: "Axle 13 autolearn statuses, each nibble signifies a single wheel"
|
|
1236
|
+
description: "Axle 13 autolearn statuses, each nibble signifies a single wheel",
|
|
1237
|
+
display: "reverseHex"
|
|
1216
1238
|
},
|
|
1217
1239
|
axle14: {
|
|
1218
1240
|
size: 8,
|
|
1219
|
-
description: "Axle 14 autolearn statuses, each nibble signifies a single wheel"
|
|
1241
|
+
description: "Axle 14 autolearn statuses, each nibble signifies a single wheel",
|
|
1242
|
+
display: "reverseHex"
|
|
1220
1243
|
},
|
|
1221
1244
|
axle15: {
|
|
1222
1245
|
size: 8,
|
|
1223
|
-
description: "Axle 15 autolearn statuses, each nibble signifies a single wheel"
|
|
1246
|
+
description: "Axle 15 autolearn statuses, each nibble signifies a single wheel",
|
|
1247
|
+
display: "reverseHex"
|
|
1224
1248
|
}
|
|
1225
1249
|
}
|
|
1226
1250
|
},
|
|
@@ -1289,6 +1313,88 @@ const bridgeCommandStructures = {
|
|
|
1289
1313
|
description: "Unknown sensor data"
|
|
1290
1314
|
}
|
|
1291
1315
|
}
|
|
1316
|
+
},
|
|
1317
|
+
vehicleLayout: {
|
|
1318
|
+
id: [98, 1],
|
|
1319
|
+
name: "vehicleLayout",
|
|
1320
|
+
structure: {
|
|
1321
|
+
axle01: {
|
|
1322
|
+
size: 2,
|
|
1323
|
+
description: "Axle 01 each bit represents present tyre."
|
|
1324
|
+
},
|
|
1325
|
+
axle02: {
|
|
1326
|
+
size: 2,
|
|
1327
|
+
description: "Axle 02 each bit represents present tyre"
|
|
1328
|
+
},
|
|
1329
|
+
axle03: {
|
|
1330
|
+
size: 2,
|
|
1331
|
+
description: "Axle 03 each bit represents present tyre"
|
|
1332
|
+
},
|
|
1333
|
+
axle04: {
|
|
1334
|
+
size: 2,
|
|
1335
|
+
description: "Axle 04 each bit represents present tyre"
|
|
1336
|
+
},
|
|
1337
|
+
axle05: {
|
|
1338
|
+
size: 2,
|
|
1339
|
+
description: "Axle 05 each bit represents present tyre"
|
|
1340
|
+
},
|
|
1341
|
+
axle06: {
|
|
1342
|
+
size: 2,
|
|
1343
|
+
description: "Axle 06 each bit represents present tyre"
|
|
1344
|
+
},
|
|
1345
|
+
axle07: {
|
|
1346
|
+
size: 2,
|
|
1347
|
+
description: "Axle 07 each bit represents present tyre"
|
|
1348
|
+
},
|
|
1349
|
+
axle08: {
|
|
1350
|
+
size: 2,
|
|
1351
|
+
description: "Axle 08 each bit represents present tyre"
|
|
1352
|
+
},
|
|
1353
|
+
axle09: {
|
|
1354
|
+
size: 2,
|
|
1355
|
+
description: "Axle 09 each bit represents present tyre"
|
|
1356
|
+
},
|
|
1357
|
+
axle10: {
|
|
1358
|
+
size: 2,
|
|
1359
|
+
description: "Axle 10 each bit represents present tyre"
|
|
1360
|
+
},
|
|
1361
|
+
axle11: {
|
|
1362
|
+
size: 2,
|
|
1363
|
+
description: "Axle 11 each bit represents present tyre"
|
|
1364
|
+
},
|
|
1365
|
+
axle12: {
|
|
1366
|
+
size: 2,
|
|
1367
|
+
description: "Axle 12 each bit represents present tyre"
|
|
1368
|
+
},
|
|
1369
|
+
axle13: {
|
|
1370
|
+
size: 2,
|
|
1371
|
+
description: "Axle 13 each bit represents present tyre"
|
|
1372
|
+
},
|
|
1373
|
+
axle14: {
|
|
1374
|
+
size: 2,
|
|
1375
|
+
description: "Axle 14 each bit represents present tyre"
|
|
1376
|
+
},
|
|
1377
|
+
axle15: {
|
|
1378
|
+
size: 2,
|
|
1379
|
+
description: "Axle 15 each bit represents present tyre"
|
|
1380
|
+
},
|
|
1381
|
+
vin: {
|
|
1382
|
+
size: 17,
|
|
1383
|
+
description: "Vehicle Identification Number",
|
|
1384
|
+
display: "ascii"
|
|
1385
|
+
},
|
|
1386
|
+
vinExtension: {
|
|
1387
|
+
size: 1,
|
|
1388
|
+
description: "VIN extension",
|
|
1389
|
+
display: "ascii",
|
|
1390
|
+
optional: true
|
|
1391
|
+
},
|
|
1392
|
+
test: {
|
|
1393
|
+
size: 3,
|
|
1394
|
+
description: "Test",
|
|
1395
|
+
optional: true
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1292
1398
|
}
|
|
1293
1399
|
};
|
|
1294
1400
|
|
|
@@ -1557,7 +1663,7 @@ const promiseQueue$1 = {
|
|
|
1557
1663
|
return currentReject(new Error(`Command not succesful: ${numberArray[4]}`));
|
|
1558
1664
|
}
|
|
1559
1665
|
if ([226, 81].includes(numberArray[3]) && numberArray[4] && toolsSvc.canCommunicateWith(deviceId)) {
|
|
1560
|
-
store.
|
|
1666
|
+
store.bridgeRebootRequired[deviceId] = true;
|
|
1561
1667
|
}
|
|
1562
1668
|
if ((!responseIdentifier[0] || numberArray[3] === responseIdentifier[0]) && (!responseIdentifier[1] || numberArray[4] === responseIdentifier[1])) {
|
|
1563
1669
|
return currentResolve(numberArray);
|
|
@@ -1956,7 +2062,7 @@ const bridgeCommands = {
|
|
|
1956
2062
|
if (!canCommunicateWith(device.id)) throw new Error("Bridge not connected");
|
|
1957
2063
|
clearTimeout(keepAliveTimer);
|
|
1958
2064
|
keepAliveTimer = setTimeout(() => {
|
|
1959
|
-
if (
|
|
2065
|
+
if (store.deviceState[device.id] !== "paired" || store.devices[device.id]?.type !== "bridge") {
|
|
1960
2066
|
return;
|
|
1961
2067
|
}
|
|
1962
2068
|
this.sendKeepAliveCommand(device);
|
|
@@ -2001,6 +2107,7 @@ const bridgeOtaService = {
|
|
|
2001
2107
|
async function uploadOta(deviceId, firmwareBinary, reportStatus) {
|
|
2002
2108
|
let uploadedBytes = 0;
|
|
2003
2109
|
let chunkIndex = 0;
|
|
2110
|
+
const mtu = store.platform === "android" ? 512 : deviceMeta.bridgeOta.mtu;
|
|
2004
2111
|
while (uploadedBytes < firmwareBinary.byteLength) {
|
|
2005
2112
|
if (chunkIndex % 100 === 0)
|
|
2006
2113
|
reportStatus(
|
|
@@ -2009,7 +2116,7 @@ async function uploadOta(deviceId, firmwareBinary, reportStatus) {
|
|
|
2009
2116
|
)} KB)`,
|
|
2010
2117
|
uploadedBytes / firmwareBinary.byteLength
|
|
2011
2118
|
);
|
|
2012
|
-
const chunkSize = Math.min(
|
|
2119
|
+
const chunkSize = Math.min(mtu - 3, firmwareBinary.byteLength - uploadedBytes);
|
|
2013
2120
|
const chunk = firmwareBinary.slice(uploadedBytes, uploadedBytes + chunkSize);
|
|
2014
2121
|
await bridgeOtaCommands.uploadOtaChunk(deviceId, chunk);
|
|
2015
2122
|
uploadedBytes += chunkSize;
|
|
@@ -2021,7 +2128,9 @@ const bridgeOta = {
|
|
|
2021
2128
|
async connect(deviceId) {
|
|
2022
2129
|
await bluetooth.connect(deviceId, this.disconnect);
|
|
2023
2130
|
const _deviceId = store.deviceIdMapingTable[deviceId] ?? deviceId;
|
|
2024
|
-
|
|
2131
|
+
if (store.platform !== "ios") {
|
|
2132
|
+
await ble.requestMtu(_deviceId, 512);
|
|
2133
|
+
}
|
|
2025
2134
|
store.setState(deviceId, "paired");
|
|
2026
2135
|
},
|
|
2027
2136
|
async disconnect(deviceId, reason) {
|
|
@@ -2051,7 +2160,8 @@ const bridgeService = {
|
|
|
2051
2160
|
getSensorReading,
|
|
2052
2161
|
getVehicleReadings,
|
|
2053
2162
|
resetAutolearnStatuses,
|
|
2054
|
-
getAutolearnStatuses
|
|
2163
|
+
getAutolearnStatuses,
|
|
2164
|
+
isRebootRequired
|
|
2055
2165
|
};
|
|
2056
2166
|
async function updateFirmware(deviceId, bootloader, firmware, reportStatus) {
|
|
2057
2167
|
reportStatus("Sending OTA Request...", 0.02);
|
|
@@ -2649,15 +2759,15 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2649
2759
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2650
2760
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2651
2761
|
if (axlesPressureData[axleIndex * 3]) {
|
|
2652
|
-
tcVehicleAxle.maxTargetPressure = bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3]);
|
|
2762
|
+
tcVehicleAxle.maxTargetPressure = _.round(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3]), 1);
|
|
2653
2763
|
}
|
|
2654
2764
|
if (axlesPressureData[axleIndex * 3 + 1]) {
|
|
2655
|
-
tcVehicleAxle.minTargetPressure = bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1]);
|
|
2765
|
+
tcVehicleAxle.minTargetPressure = _.round(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1]), 1);
|
|
2656
2766
|
}
|
|
2657
2767
|
if (axlesPressureData[axleIndex * 3 + 2]) {
|
|
2658
|
-
tcVehicleAxle.targetPressure =
|
|
2659
|
-
axlesPressureData[axleIndex * 3 + 2],
|
|
2660
|
-
|
|
2768
|
+
tcVehicleAxle.targetPressure = _.round(
|
|
2769
|
+
bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 2], void 0),
|
|
2770
|
+
1
|
|
2661
2771
|
);
|
|
2662
2772
|
}
|
|
2663
2773
|
return tcVehicleAxle;
|
|
@@ -2668,6 +2778,9 @@ function createNewTyre(positionId) {
|
|
|
2668
2778
|
serialNumber: `TYRE-${positionId}`
|
|
2669
2779
|
};
|
|
2670
2780
|
}
|
|
2781
|
+
function isRebootRequired(deviceId) {
|
|
2782
|
+
return store.bridgeRebootRequired[deviceId];
|
|
2783
|
+
}
|
|
2671
2784
|
|
|
2672
2785
|
const bridge = {
|
|
2673
2786
|
async connect(deviceId, accessLevel) {
|
|
@@ -2687,6 +2800,7 @@ const bridge = {
|
|
|
2687
2800
|
(error) => console.error("startNotification Error", error)
|
|
2688
2801
|
);
|
|
2689
2802
|
store.deviceAccessLevel[deviceId] = accessLevel ?? "driver";
|
|
2803
|
+
store.bridgeRebootRequired[deviceId] = false;
|
|
2690
2804
|
await bridgeCommands.sendPinCommand(deviceId);
|
|
2691
2805
|
store.setState(deviceId, "paired");
|
|
2692
2806
|
},
|
|
@@ -2706,7 +2820,8 @@ const bridge = {
|
|
|
2706
2820
|
getVehicleReadings: bridgeService.getVehicleReadings,
|
|
2707
2821
|
getAutolearnStatuses: bridgeService.getAutolearnStatuses,
|
|
2708
2822
|
resetAutolearnStatuses: bridgeService.resetAutolearnStatuses,
|
|
2709
|
-
updateFirmware: bridgeService.updateFirmware
|
|
2823
|
+
updateFirmware: bridgeService.updateFirmware,
|
|
2824
|
+
isRebootRequired: bridgeService.isRebootRequired
|
|
2710
2825
|
};
|
|
2711
2826
|
|
|
2712
2827
|
const flexiGaugeTpmsMeta = deviceMeta.flexiGaugeTpms;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.92",
|
|
4
4
|
"description": "SDK for working with various devices produced by Tirecheck via Bluetooth (CAN Bridge, Routers, Sensors, FlexiGauge, PressureStick, etc)",
|
|
5
5
|
"author": "Leonid Buneev <leonid.buneev@tirecheck.com>",
|
|
6
6
|
"license": "ISC",
|