tirecheck-device-sdk 0.2.58 → 0.2.59
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 +13 -5
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +13 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2475,15 +2475,23 @@ async function setVehicle(deviceId, tcVehicle) {
|
|
|
2475
2475
|
}
|
|
2476
2476
|
async function getSensorReading(deviceId, positionId) {
|
|
2477
2477
|
const value = await bridgeCommands.getSensorMeasurement(deviceId, positionId);
|
|
2478
|
+
const messageLength = value[2];
|
|
2479
|
+
const payloadStartIndex = 9;
|
|
2480
|
+
const payloadLength = messageLength - 6;
|
|
2481
|
+
const payload = value.slice(payloadStartIndex, payloadStartIndex + payloadLength);
|
|
2482
|
+
if (payload.length < 6) {
|
|
2483
|
+
throw new Error(`Invalid sensor measurement payload length: ${payload.length}`);
|
|
2484
|
+
}
|
|
2478
2485
|
const sensorId = value.slice(5, 9).reverse().map((s) => decimalToHex(s).toUpperCase()).join("");
|
|
2479
2486
|
const correctedSensorId = bridgeTools.convertSensorIdFromBridge(sensorId);
|
|
2480
2487
|
return {
|
|
2481
|
-
date: Date.now() -
|
|
2488
|
+
date: Date.now() - payload[5] * 2e3,
|
|
2482
2489
|
sensorId: correctedSensorId,
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2490
|
+
sensorType: payload[6],
|
|
2491
|
+
sensorStatus: payload[3],
|
|
2492
|
+
eceStatus: payload[4],
|
|
2493
|
+
pressureIssue: getPressureIssue$1(deviceId, payload[4]),
|
|
2494
|
+
...getPressureAndTemperatureReadingObjects(payload[0], payload[1]),
|
|
2487
2495
|
byteReading: value
|
|
2488
2496
|
};
|
|
2489
2497
|
}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -2468,15 +2468,23 @@ async function setVehicle(deviceId, tcVehicle) {
|
|
|
2468
2468
|
}
|
|
2469
2469
|
async function getSensorReading(deviceId, positionId) {
|
|
2470
2470
|
const value = await bridgeCommands.getSensorMeasurement(deviceId, positionId);
|
|
2471
|
+
const messageLength = value[2];
|
|
2472
|
+
const payloadStartIndex = 9;
|
|
2473
|
+
const payloadLength = messageLength - 6;
|
|
2474
|
+
const payload = value.slice(payloadStartIndex, payloadStartIndex + payloadLength);
|
|
2475
|
+
if (payload.length < 6) {
|
|
2476
|
+
throw new Error(`Invalid sensor measurement payload length: ${payload.length}`);
|
|
2477
|
+
}
|
|
2471
2478
|
const sensorId = value.slice(5, 9).reverse().map((s) => decimalToHex(s).toUpperCase()).join("");
|
|
2472
2479
|
const correctedSensorId = bridgeTools.convertSensorIdFromBridge(sensorId);
|
|
2473
2480
|
return {
|
|
2474
|
-
date: Date.now() -
|
|
2481
|
+
date: Date.now() - payload[5] * 2e3,
|
|
2475
2482
|
sensorId: correctedSensorId,
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2483
|
+
sensorType: payload[6],
|
|
2484
|
+
sensorStatus: payload[3],
|
|
2485
|
+
eceStatus: payload[4],
|
|
2486
|
+
pressureIssue: getPressureIssue$1(deviceId, payload[4]),
|
|
2487
|
+
...getPressureAndTemperatureReadingObjects(payload[0], payload[1]),
|
|
2480
2488
|
byteReading: value
|
|
2481
2489
|
};
|
|
2482
2490
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.59",
|
|
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",
|