tirecheck-device-sdk 0.1.997 → 0.1.998
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 +20 -12
- package/dist/index.mjs +20 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -235,7 +235,7 @@ const bridgeTools = {
|
|
|
235
235
|
},
|
|
236
236
|
barToKpaByte(value) {
|
|
237
237
|
if (!value) return 0;
|
|
238
|
-
return ___default.round(
|
|
238
|
+
return ___default.round(value * 100 / 5.0625);
|
|
239
239
|
},
|
|
240
240
|
convertSensorIdForBridge(sensorId) {
|
|
241
241
|
if (sensorId.startsWith("2") && sensorId.length === 10) {
|
|
@@ -243,12 +243,12 @@ const bridgeTools = {
|
|
|
243
243
|
}
|
|
244
244
|
return sensorId;
|
|
245
245
|
},
|
|
246
|
-
kpaByteToBar(value
|
|
246
|
+
kpaByteToBar(value) {
|
|
247
247
|
if (!___default.isNumber(value)) {
|
|
248
248
|
throw new TypeError("Value has to be a number");
|
|
249
249
|
}
|
|
250
250
|
const rawBar = value * 5.0625 / 100;
|
|
251
|
-
return ___default.round(Math.max(rawBar
|
|
251
|
+
return ___default.round(Math.max(rawBar, 0), 1);
|
|
252
252
|
},
|
|
253
253
|
isVersionGreaterThan(deviceId, version) {
|
|
254
254
|
if (version.length !== 5) {
|
|
@@ -2436,8 +2436,8 @@ function getPressureAndTemperatureReadingObjects(rawPressure, rawTemperature) {
|
|
|
2436
2436
|
return {
|
|
2437
2437
|
pressure: {
|
|
2438
2438
|
raw: rawPressure,
|
|
2439
|
-
meas: Math.max(0, measuredPressureAbsolute
|
|
2440
|
-
bar: Math.max(0, compensatedPressureAbsolute
|
|
2439
|
+
meas: Math.max(0, measuredPressureAbsolute),
|
|
2440
|
+
bar: Math.max(0, compensatedPressureAbsolute)
|
|
2441
2441
|
},
|
|
2442
2442
|
temperature: { raw: rawTemperature, amb: ambientTemperature, celsius: measuredTemperature }
|
|
2443
2443
|
};
|
|
@@ -2615,16 +2615,13 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2615
2615
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2616
2616
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2617
2617
|
if (axlesPressureData[axleIndex * 3]) {
|
|
2618
|
-
tcVehicleAxle.maxTargetPressure = ___default.floor(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3])
|
|
2618
|
+
tcVehicleAxle.maxTargetPressure = ___default.floor(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3]));
|
|
2619
2619
|
}
|
|
2620
2620
|
if (axlesPressureData[axleIndex * 3 + 1]) {
|
|
2621
|
-
tcVehicleAxle.minTargetPressure = ___default.ceil(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1])
|
|
2621
|
+
tcVehicleAxle.minTargetPressure = ___default.ceil(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1]));
|
|
2622
2622
|
}
|
|
2623
2623
|
if (axlesPressureData[axleIndex * 3 + 2]) {
|
|
2624
|
-
tcVehicleAxle.targetPressure = ___default.round(
|
|
2625
|
-
bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 2], void 0),
|
|
2626
|
-
1
|
|
2627
|
-
);
|
|
2624
|
+
tcVehicleAxle.targetPressure = ___default.round(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 2]), 1);
|
|
2628
2625
|
}
|
|
2629
2626
|
return tcVehicleAxle;
|
|
2630
2627
|
}
|
|
@@ -2906,6 +2903,7 @@ const bridgeSimulator = {
|
|
|
2906
2903
|
},
|
|
2907
2904
|
async setVehicle(deviceId, vehicle) {
|
|
2908
2905
|
const bridge = getSimulatedBridge(deviceId);
|
|
2906
|
+
bridge.vin = vehicle.vin ?? bridge.vin;
|
|
2909
2907
|
bridge.simulatorData.vehicle = vehicle;
|
|
2910
2908
|
},
|
|
2911
2909
|
async getConfiguration(deviceId) {
|
|
@@ -2924,6 +2922,7 @@ const bridgeSimulator = {
|
|
|
2924
2922
|
const bridge = getSimulatedBridge(deviceId);
|
|
2925
2923
|
const readings = ___default.values(bridge.simulatorData.sensors);
|
|
2926
2924
|
for (const reading of readings) {
|
|
2925
|
+
reading.date = (/* @__PURE__ */ new Date()).getTime();
|
|
2927
2926
|
reading.pressureIssue = getPressureIssue(deviceId, reading.eceStatus);
|
|
2928
2927
|
}
|
|
2929
2928
|
return readings;
|
|
@@ -2963,7 +2962,16 @@ const bridgeSimulator = {
|
|
|
2963
2962
|
store.setState(deviceId, void 0, "manualDisconnection");
|
|
2964
2963
|
},
|
|
2965
2964
|
createSimulatedDevice(initialData) {
|
|
2966
|
-
|
|
2965
|
+
const mergedData = simulatorSvc.merge(getSimulatedBridgeTemplate(), initialData);
|
|
2966
|
+
mergedData.advertisingData.macAddress = initialData.id?.split(":").map((x) => Number.parseInt(x, 16)) ?? [
|
|
2967
|
+
1,
|
|
2968
|
+
2,
|
|
2969
|
+
3,
|
|
2970
|
+
4,
|
|
2971
|
+
5,
|
|
2972
|
+
6
|
|
2973
|
+
];
|
|
2974
|
+
return mergedData;
|
|
2967
2975
|
}
|
|
2968
2976
|
};
|
|
2969
2977
|
function getPressureIssue(deviceId, eceStatus) {
|
package/dist/index.mjs
CHANGED
|
@@ -228,7 +228,7 @@ const bridgeTools = {
|
|
|
228
228
|
},
|
|
229
229
|
barToKpaByte(value) {
|
|
230
230
|
if (!value) return 0;
|
|
231
|
-
return _.round(
|
|
231
|
+
return _.round(value * 100 / 5.0625);
|
|
232
232
|
},
|
|
233
233
|
convertSensorIdForBridge(sensorId) {
|
|
234
234
|
if (sensorId.startsWith("2") && sensorId.length === 10) {
|
|
@@ -236,12 +236,12 @@ const bridgeTools = {
|
|
|
236
236
|
}
|
|
237
237
|
return sensorId;
|
|
238
238
|
},
|
|
239
|
-
kpaByteToBar(value
|
|
239
|
+
kpaByteToBar(value) {
|
|
240
240
|
if (!_.isNumber(value)) {
|
|
241
241
|
throw new TypeError("Value has to be a number");
|
|
242
242
|
}
|
|
243
243
|
const rawBar = value * 5.0625 / 100;
|
|
244
|
-
return _.round(Math.max(rawBar
|
|
244
|
+
return _.round(Math.max(rawBar, 0), 1);
|
|
245
245
|
},
|
|
246
246
|
isVersionGreaterThan(deviceId, version) {
|
|
247
247
|
if (version.length !== 5) {
|
|
@@ -2429,8 +2429,8 @@ function getPressureAndTemperatureReadingObjects(rawPressure, rawTemperature) {
|
|
|
2429
2429
|
return {
|
|
2430
2430
|
pressure: {
|
|
2431
2431
|
raw: rawPressure,
|
|
2432
|
-
meas: Math.max(0, measuredPressureAbsolute
|
|
2433
|
-
bar: Math.max(0, compensatedPressureAbsolute
|
|
2432
|
+
meas: Math.max(0, measuredPressureAbsolute),
|
|
2433
|
+
bar: Math.max(0, compensatedPressureAbsolute)
|
|
2434
2434
|
},
|
|
2435
2435
|
temperature: { raw: rawTemperature, amb: ambientTemperature, celsius: measuredTemperature }
|
|
2436
2436
|
};
|
|
@@ -2608,16 +2608,13 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2608
2608
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2609
2609
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2610
2610
|
if (axlesPressureData[axleIndex * 3]) {
|
|
2611
|
-
tcVehicleAxle.maxTargetPressure = _.floor(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3])
|
|
2611
|
+
tcVehicleAxle.maxTargetPressure = _.floor(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3]));
|
|
2612
2612
|
}
|
|
2613
2613
|
if (axlesPressureData[axleIndex * 3 + 1]) {
|
|
2614
|
-
tcVehicleAxle.minTargetPressure = _.ceil(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1])
|
|
2614
|
+
tcVehicleAxle.minTargetPressure = _.ceil(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 1]));
|
|
2615
2615
|
}
|
|
2616
2616
|
if (axlesPressureData[axleIndex * 3 + 2]) {
|
|
2617
|
-
tcVehicleAxle.targetPressure = _.round(
|
|
2618
|
-
bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 2], void 0),
|
|
2619
|
-
1
|
|
2620
|
-
);
|
|
2617
|
+
tcVehicleAxle.targetPressure = _.round(bridgeTools.kpaByteToBar(axlesPressureData[axleIndex * 3 + 2]), 1);
|
|
2621
2618
|
}
|
|
2622
2619
|
return tcVehicleAxle;
|
|
2623
2620
|
}
|
|
@@ -2899,6 +2896,7 @@ const bridgeSimulator = {
|
|
|
2899
2896
|
},
|
|
2900
2897
|
async setVehicle(deviceId, vehicle) {
|
|
2901
2898
|
const bridge = getSimulatedBridge(deviceId);
|
|
2899
|
+
bridge.vin = vehicle.vin ?? bridge.vin;
|
|
2902
2900
|
bridge.simulatorData.vehicle = vehicle;
|
|
2903
2901
|
},
|
|
2904
2902
|
async getConfiguration(deviceId) {
|
|
@@ -2917,6 +2915,7 @@ const bridgeSimulator = {
|
|
|
2917
2915
|
const bridge = getSimulatedBridge(deviceId);
|
|
2918
2916
|
const readings = _.values(bridge.simulatorData.sensors);
|
|
2919
2917
|
for (const reading of readings) {
|
|
2918
|
+
reading.date = (/* @__PURE__ */ new Date()).getTime();
|
|
2920
2919
|
reading.pressureIssue = getPressureIssue(deviceId, reading.eceStatus);
|
|
2921
2920
|
}
|
|
2922
2921
|
return readings;
|
|
@@ -2956,7 +2955,16 @@ const bridgeSimulator = {
|
|
|
2956
2955
|
store.setState(deviceId, void 0, "manualDisconnection");
|
|
2957
2956
|
},
|
|
2958
2957
|
createSimulatedDevice(initialData) {
|
|
2959
|
-
|
|
2958
|
+
const mergedData = simulatorSvc.merge(getSimulatedBridgeTemplate(), initialData);
|
|
2959
|
+
mergedData.advertisingData.macAddress = initialData.id?.split(":").map((x) => Number.parseInt(x, 16)) ?? [
|
|
2960
|
+
1,
|
|
2961
|
+
2,
|
|
2962
|
+
3,
|
|
2963
|
+
4,
|
|
2964
|
+
5,
|
|
2965
|
+
6
|
|
2966
|
+
];
|
|
2967
|
+
return mergedData;
|
|
2960
2968
|
}
|
|
2961
2969
|
};
|
|
2962
2970
|
function getPressureIssue(deviceId, eceStatus) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.998",
|
|
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",
|