tirecheck-device-sdk 0.2.57 → 0.2.58
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 +39 -8
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +39 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -245,9 +245,17 @@ const bridgeTools = {
|
|
|
245
245
|
}, []).join(".");
|
|
246
246
|
},
|
|
247
247
|
barToKpaByte(value) {
|
|
248
|
+
console.warn("barToKpaByte is deprecated, please use convertBarToKpaByte instead");
|
|
248
249
|
if (!value) return 0;
|
|
249
250
|
return ___default.round((value + 1) * 100 / 5.0625);
|
|
250
251
|
},
|
|
252
|
+
convertBarToKpaByte(deviceId, value) {
|
|
253
|
+
if (!value) return 0;
|
|
254
|
+
const deviceData = this.getBridgeFromStore(deviceId);
|
|
255
|
+
if (!deviceData) throw new Error(`Cannot convert bar to kpa byte, no device data found: ${deviceId}`);
|
|
256
|
+
const bitValue = deviceData.name.includes("030717") ? 6.7 : 5.0625;
|
|
257
|
+
return ___default.round((value + 1) * 100 / bitValue);
|
|
258
|
+
},
|
|
251
259
|
convertSensorIdForBridge(sensorId) {
|
|
252
260
|
let bridgeSensorId = sensorId;
|
|
253
261
|
if (/\d{10}/.test(sensorId)) {
|
|
@@ -257,12 +265,23 @@ const bridgeTools = {
|
|
|
257
265
|
return bridgeSensorId;
|
|
258
266
|
},
|
|
259
267
|
kpaByteToBar(value, decrementValue = 1) {
|
|
268
|
+
console.warn("kpaByteToBar is deprecated, please use convertKpaByteToBar instead");
|
|
260
269
|
if (!___default.isNumber(value)) {
|
|
261
270
|
throw new TypeError("Value has to be a number");
|
|
262
271
|
}
|
|
263
272
|
const rawBar = value * 5.0625 / 100;
|
|
264
273
|
return ___default.round(Math.max(rawBar - decrementValue, 0), 1);
|
|
265
274
|
},
|
|
275
|
+
convertKpaByteToBar(deviceId, value, decrementValue = 1) {
|
|
276
|
+
if (!___default.isNumber(value)) {
|
|
277
|
+
throw new TypeError("Value has to be a number");
|
|
278
|
+
}
|
|
279
|
+
const deviceData = this.getBridgeFromStore(deviceId);
|
|
280
|
+
if (!deviceData) throw new Error(`Cannot convert kpa byte to bar, no device data found: ${deviceId}`);
|
|
281
|
+
const bitValue = deviceData.name.includes("030717") ? 6.7 : 5.0625;
|
|
282
|
+
const rawBar = value * bitValue / 100;
|
|
283
|
+
return ___default.round(Math.max(rawBar - decrementValue, 0), 1);
|
|
284
|
+
},
|
|
266
285
|
isVersionGreaterThan(deviceId, version) {
|
|
267
286
|
if (version.length !== 5) {
|
|
268
287
|
throw new Error("Invalid version format");
|
|
@@ -2386,12 +2405,12 @@ async function setAxlesPressure(deviceId, axles) {
|
|
|
2386
2405
|
let bridgeAxlesPressureData;
|
|
2387
2406
|
for (let index = 0; index < 15; index++) {
|
|
2388
2407
|
let { targetPressure, maxTargetPressure, minTargetPressure, isSpare } = axles[index] || {};
|
|
2389
|
-
maxTargetPressure = bridgeTools.
|
|
2390
|
-
minTargetPressure = bridgeTools.
|
|
2408
|
+
maxTargetPressure = bridgeTools.convertBarToKpaByte(deviceId, maxTargetPressure);
|
|
2409
|
+
minTargetPressure = bridgeTools.convertBarToKpaByte(deviceId, minTargetPressure);
|
|
2391
2410
|
if (isSpare && axles[0]) {
|
|
2392
|
-
targetPressure = bridgeTools.
|
|
2411
|
+
targetPressure = bridgeTools.convertBarToKpaByte(deviceId, axles[0].targetPressure);
|
|
2393
2412
|
} else {
|
|
2394
|
-
targetPressure = bridgeTools.
|
|
2413
|
+
targetPressure = bridgeTools.convertBarToKpaByte(deviceId, targetPressure);
|
|
2395
2414
|
}
|
|
2396
2415
|
if (!maxTargetPressure) {
|
|
2397
2416
|
if (!bridgeAxlesPressureData) {
|
|
@@ -2743,14 +2762,20 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2743
2762
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2744
2763
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2745
2764
|
if (axlesPressureData[axleIndex * 3]) {
|
|
2746
|
-
tcVehicleAxle.maxTargetPressure = ___default.floor(
|
|
2765
|
+
tcVehicleAxle.maxTargetPressure = ___default.floor(
|
|
2766
|
+
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3]),
|
|
2767
|
+
1
|
|
2768
|
+
);
|
|
2747
2769
|
}
|
|
2748
2770
|
if (axlesPressureData[axleIndex * 3 + 1]) {
|
|
2749
|
-
tcVehicleAxle.minTargetPressure = ___default.ceil(
|
|
2771
|
+
tcVehicleAxle.minTargetPressure = ___default.ceil(
|
|
2772
|
+
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3 + 1]),
|
|
2773
|
+
1
|
|
2774
|
+
);
|
|
2750
2775
|
}
|
|
2751
2776
|
if (axlesPressureData[axleIndex * 3 + 2]) {
|
|
2752
2777
|
tcVehicleAxle.targetPressure = ___default.round(
|
|
2753
|
-
bridgeTools.
|
|
2778
|
+
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3 + 2], void 0),
|
|
2754
2779
|
1
|
|
2755
2780
|
);
|
|
2756
2781
|
}
|
|
@@ -4502,7 +4527,13 @@ function createTirecheckDeviceSdk(platform, bleImplementation, securityKeys) {
|
|
|
4502
4527
|
/** Allows simulating devices without actually using bluetooth */
|
|
4503
4528
|
simulator,
|
|
4504
4529
|
/** Methods for working with Tirecheck Torque Wrench */
|
|
4505
|
-
torqueWrench
|
|
4530
|
+
torqueWrench,
|
|
4531
|
+
utils: {
|
|
4532
|
+
bridge: {
|
|
4533
|
+
convertBarToKpaByte: bridgeTools.convertBarToKpaByte,
|
|
4534
|
+
convertKpaByteToBar: bridgeTools.convertKpaByteToBar
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4506
4537
|
};
|
|
4507
4538
|
}
|
|
4508
4539
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1037,6 +1037,12 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
1037
1037
|
getTime: (deviceId: string) => Promise<Date>;
|
|
1038
1038
|
onReading: (callback: (deviceId: string, value: TorqueWrenchReading) => void) => void;
|
|
1039
1039
|
};
|
|
1040
|
+
utils: {
|
|
1041
|
+
bridge: {
|
|
1042
|
+
convertBarToKpaByte: (deviceId: string, value?: number) => number;
|
|
1043
|
+
convertKpaByteToBar: (deviceId: string, value?: number, decrementValue?: number) => number;
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1040
1046
|
};
|
|
1041
1047
|
|
|
1042
1048
|
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGauge, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BleTorqueWrench, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgConfig, type FgConfigNeedleLength, type FgConfigPressureDisplay, type FgConfigPressureUnit, type FgConfigRegion, type FgConfigTdUnit, type FgConfigTemperatureUnit, type FgSensorReading, type FgTpmsConfig, type FgTpmsConfigProtocol, type FgTpmsConfigProtocolSetting, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type TorqueWrenchProperties, type TorqueWrenchReading, type TorqueWrenchStartJobParams, type Wrapper, createTirecheckDeviceSdk };
|
package/dist/index.d.mts
CHANGED
|
@@ -1037,6 +1037,12 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
1037
1037
|
getTime: (deviceId: string) => Promise<Date>;
|
|
1038
1038
|
onReading: (callback: (deviceId: string, value: TorqueWrenchReading) => void) => void;
|
|
1039
1039
|
};
|
|
1040
|
+
utils: {
|
|
1041
|
+
bridge: {
|
|
1042
|
+
convertBarToKpaByte: (deviceId: string, value?: number) => number;
|
|
1043
|
+
convertKpaByteToBar: (deviceId: string, value?: number, decrementValue?: number) => number;
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1040
1046
|
};
|
|
1041
1047
|
|
|
1042
1048
|
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGauge, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BleTorqueWrench, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgConfig, type FgConfigNeedleLength, type FgConfigPressureDisplay, type FgConfigPressureUnit, type FgConfigRegion, type FgConfigTdUnit, type FgConfigTemperatureUnit, type FgSensorReading, type FgTpmsConfig, type FgTpmsConfigProtocol, type FgTpmsConfigProtocolSetting, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type TorqueWrenchProperties, type TorqueWrenchReading, type TorqueWrenchStartJobParams, type Wrapper, createTirecheckDeviceSdk };
|
package/dist/index.d.ts
CHANGED
|
@@ -1037,6 +1037,12 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
1037
1037
|
getTime: (deviceId: string) => Promise<Date>;
|
|
1038
1038
|
onReading: (callback: (deviceId: string, value: TorqueWrenchReading) => void) => void;
|
|
1039
1039
|
};
|
|
1040
|
+
utils: {
|
|
1041
|
+
bridge: {
|
|
1042
|
+
convertBarToKpaByte: (deviceId: string, value?: number) => number;
|
|
1043
|
+
convertKpaByteToBar: (deviceId: string, value?: number, decrementValue?: number) => number;
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1040
1046
|
};
|
|
1041
1047
|
|
|
1042
1048
|
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGauge, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BleTorqueWrench, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgConfig, type FgConfigNeedleLength, type FgConfigPressureDisplay, type FgConfigPressureUnit, type FgConfigRegion, type FgConfigTdUnit, type FgConfigTemperatureUnit, type FgSensorReading, type FgTpmsConfig, type FgTpmsConfigProtocol, type FgTpmsConfigProtocolSetting, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type TorqueWrenchProperties, type TorqueWrenchReading, type TorqueWrenchStartJobParams, type Wrapper, createTirecheckDeviceSdk };
|
package/dist/index.mjs
CHANGED
|
@@ -238,9 +238,17 @@ const bridgeTools = {
|
|
|
238
238
|
}, []).join(".");
|
|
239
239
|
},
|
|
240
240
|
barToKpaByte(value) {
|
|
241
|
+
console.warn("barToKpaByte is deprecated, please use convertBarToKpaByte instead");
|
|
241
242
|
if (!value) return 0;
|
|
242
243
|
return _.round((value + 1) * 100 / 5.0625);
|
|
243
244
|
},
|
|
245
|
+
convertBarToKpaByte(deviceId, value) {
|
|
246
|
+
if (!value) return 0;
|
|
247
|
+
const deviceData = this.getBridgeFromStore(deviceId);
|
|
248
|
+
if (!deviceData) throw new Error(`Cannot convert bar to kpa byte, no device data found: ${deviceId}`);
|
|
249
|
+
const bitValue = deviceData.name.includes("030717") ? 6.7 : 5.0625;
|
|
250
|
+
return _.round((value + 1) * 100 / bitValue);
|
|
251
|
+
},
|
|
244
252
|
convertSensorIdForBridge(sensorId) {
|
|
245
253
|
let bridgeSensorId = sensorId;
|
|
246
254
|
if (/\d{10}/.test(sensorId)) {
|
|
@@ -250,12 +258,23 @@ const bridgeTools = {
|
|
|
250
258
|
return bridgeSensorId;
|
|
251
259
|
},
|
|
252
260
|
kpaByteToBar(value, decrementValue = 1) {
|
|
261
|
+
console.warn("kpaByteToBar is deprecated, please use convertKpaByteToBar instead");
|
|
253
262
|
if (!_.isNumber(value)) {
|
|
254
263
|
throw new TypeError("Value has to be a number");
|
|
255
264
|
}
|
|
256
265
|
const rawBar = value * 5.0625 / 100;
|
|
257
266
|
return _.round(Math.max(rawBar - decrementValue, 0), 1);
|
|
258
267
|
},
|
|
268
|
+
convertKpaByteToBar(deviceId, value, decrementValue = 1) {
|
|
269
|
+
if (!_.isNumber(value)) {
|
|
270
|
+
throw new TypeError("Value has to be a number");
|
|
271
|
+
}
|
|
272
|
+
const deviceData = this.getBridgeFromStore(deviceId);
|
|
273
|
+
if (!deviceData) throw new Error(`Cannot convert kpa byte to bar, no device data found: ${deviceId}`);
|
|
274
|
+
const bitValue = deviceData.name.includes("030717") ? 6.7 : 5.0625;
|
|
275
|
+
const rawBar = value * bitValue / 100;
|
|
276
|
+
return _.round(Math.max(rawBar - decrementValue, 0), 1);
|
|
277
|
+
},
|
|
259
278
|
isVersionGreaterThan(deviceId, version) {
|
|
260
279
|
if (version.length !== 5) {
|
|
261
280
|
throw new Error("Invalid version format");
|
|
@@ -2379,12 +2398,12 @@ async function setAxlesPressure(deviceId, axles) {
|
|
|
2379
2398
|
let bridgeAxlesPressureData;
|
|
2380
2399
|
for (let index = 0; index < 15; index++) {
|
|
2381
2400
|
let { targetPressure, maxTargetPressure, minTargetPressure, isSpare } = axles[index] || {};
|
|
2382
|
-
maxTargetPressure = bridgeTools.
|
|
2383
|
-
minTargetPressure = bridgeTools.
|
|
2401
|
+
maxTargetPressure = bridgeTools.convertBarToKpaByte(deviceId, maxTargetPressure);
|
|
2402
|
+
minTargetPressure = bridgeTools.convertBarToKpaByte(deviceId, minTargetPressure);
|
|
2384
2403
|
if (isSpare && axles[0]) {
|
|
2385
|
-
targetPressure = bridgeTools.
|
|
2404
|
+
targetPressure = bridgeTools.convertBarToKpaByte(deviceId, axles[0].targetPressure);
|
|
2386
2405
|
} else {
|
|
2387
|
-
targetPressure = bridgeTools.
|
|
2406
|
+
targetPressure = bridgeTools.convertBarToKpaByte(deviceId, targetPressure);
|
|
2388
2407
|
}
|
|
2389
2408
|
if (!maxTargetPressure) {
|
|
2390
2409
|
if (!bridgeAxlesPressureData) {
|
|
@@ -2736,14 +2755,20 @@ async function assignTyres(deviceId, tcVehicle) {
|
|
|
2736
2755
|
async function assignAxlePressureLimits(deviceId, tcVehicle, tcVehicleAxle, axleIndex, bridgeAxlesPressureData) {
|
|
2737
2756
|
const axlesPressureData = bridgeAxlesPressureData ?? (await bridgeCommands.getAxlesPressure(deviceId)).data;
|
|
2738
2757
|
if (axlesPressureData[axleIndex * 3]) {
|
|
2739
|
-
tcVehicleAxle.maxTargetPressure = _.floor(
|
|
2758
|
+
tcVehicleAxle.maxTargetPressure = _.floor(
|
|
2759
|
+
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3]),
|
|
2760
|
+
1
|
|
2761
|
+
);
|
|
2740
2762
|
}
|
|
2741
2763
|
if (axlesPressureData[axleIndex * 3 + 1]) {
|
|
2742
|
-
tcVehicleAxle.minTargetPressure = _.ceil(
|
|
2764
|
+
tcVehicleAxle.minTargetPressure = _.ceil(
|
|
2765
|
+
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3 + 1]),
|
|
2766
|
+
1
|
|
2767
|
+
);
|
|
2743
2768
|
}
|
|
2744
2769
|
if (axlesPressureData[axleIndex * 3 + 2]) {
|
|
2745
2770
|
tcVehicleAxle.targetPressure = _.round(
|
|
2746
|
-
bridgeTools.
|
|
2771
|
+
bridgeTools.convertKpaByteToBar(deviceId, axlesPressureData[axleIndex * 3 + 2], void 0),
|
|
2747
2772
|
1
|
|
2748
2773
|
);
|
|
2749
2774
|
}
|
|
@@ -4495,7 +4520,13 @@ function createTirecheckDeviceSdk(platform, bleImplementation, securityKeys) {
|
|
|
4495
4520
|
/** Allows simulating devices without actually using bluetooth */
|
|
4496
4521
|
simulator,
|
|
4497
4522
|
/** Methods for working with Tirecheck Torque Wrench */
|
|
4498
|
-
torqueWrench
|
|
4523
|
+
torqueWrench,
|
|
4524
|
+
utils: {
|
|
4525
|
+
bridge: {
|
|
4526
|
+
convertBarToKpaByte: bridgeTools.convertBarToKpaByte,
|
|
4527
|
+
convertKpaByteToBar: bridgeTools.convertKpaByteToBar
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4499
4530
|
};
|
|
4500
4531
|
}
|
|
4501
4532
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.58",
|
|
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",
|