tirecheck-device-sdk 0.2.67 → 0.2.69

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 CHANGED
@@ -254,7 +254,7 @@ const bridgeTools = {
254
254
  },
255
255
  convertBarToKpaByte(deviceId, value) {
256
256
  if (!value) return 0;
257
- const bitValue = this.usesKpaPressure(deviceId) ? 1 : 5.0625;
257
+ const bitValue = bridgeUsesKpaPressure(deviceId) ? 1 : 5.0625;
258
258
  return ___default.round((value + 1) * 100 / bitValue);
259
259
  },
260
260
  convertSensorIdForBridge(sensorId) {
@@ -277,7 +277,7 @@ const bridgeTools = {
277
277
  if (!___default.isNumber(value)) {
278
278
  throw new TypeError("Value has to be a number");
279
279
  }
280
- const bitValue = this.usesKpaPressure(deviceId) ? 1 : 5.0625;
280
+ const bitValue = bridgeUsesKpaPressure(deviceId) ? 1 : 5.0625;
281
281
  const rawBar = value * bitValue / 100;
282
282
  return ___default.round(Math.max(rawBar - decrementValue, 0), 1);
283
283
  },
@@ -292,7 +292,7 @@ const bridgeTools = {
292
292
  return false;
293
293
  },
294
294
  usesKpaPressure(deviceId) {
295
- return this.isVersionGreaterThan(deviceId, "1.1.F");
295
+ return bridgeUsesKpaPressure(deviceId);
296
296
  },
297
297
  convertSensorIdFromBridge(sensorId) {
298
298
  if (sensorId.startsWith("B")) {
@@ -374,6 +374,9 @@ function getBridgeFromStore(deviceId) {
374
374
  if (deviceData.type !== "bridge") throw new Error("Device is not bridge");
375
375
  return deviceData;
376
376
  }
377
+ function bridgeUsesKpaPressure(deviceId) {
378
+ return getBridgeFromStore(deviceId).name === "030717";
379
+ }
377
380
  function getDefaultTyreLabels() {
378
381
  const tyreLabelsStr = "_L;_R;_LO;_LI;_RI;_RO;_";
379
382
  const tyreLabelsStrLoc = tyreLabelsStr;
@@ -1274,7 +1277,7 @@ const bridgeCommandStructures = {
1274
1277
  }
1275
1278
  },
1276
1279
  /**
1277
- * kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
1280
+ * kPa per-axle pressure layout used by the 030717 bridge model (same sub-command 0x30 as `pressuresPerAxle`).
1278
1281
  * Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
1279
1282
  * uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
1280
1283
  * `bridgeTools.usesKpaPressure(deviceId)`.
@@ -1718,6 +1721,48 @@ const bridgeCommandStructures = {
1718
1721
  }
1719
1722
  }
1720
1723
  },
1724
+ errorHistoryCounter: {
1725
+ id: [98, 112],
1726
+ name: "errorHistoryCounter",
1727
+ structure: {
1728
+ hwErrorCounter: {
1729
+ size: 1,
1730
+ description: "HW Error Counter",
1731
+ display: "decimal"
1732
+ },
1733
+ powerUpCounter: {
1734
+ size: 1,
1735
+ description: "Power-up Counter",
1736
+ display: "decimal"
1737
+ },
1738
+ configErrorCounter: {
1739
+ size: 1,
1740
+ description: "Config. Error Counter",
1741
+ display: "decimal"
1742
+ },
1743
+ swErrorCounter: {
1744
+ size: 1,
1745
+ description: "SW Error Counter",
1746
+ display: "decimal"
1747
+ }
1748
+ }
1749
+ },
1750
+ eolStatus: {
1751
+ id: [98, 128],
1752
+ name: "eolStatus",
1753
+ structure: {
1754
+ eolStatus: {
1755
+ size: 1,
1756
+ description: "End of Line status code",
1757
+ display: "decimal"
1758
+ },
1759
+ eolCounter: {
1760
+ size: 1,
1761
+ description: "End of Line counter value",
1762
+ display: "decimal"
1763
+ }
1764
+ }
1765
+ },
1721
1766
  firmwareVersion: {
1722
1767
  id: [98, 144],
1723
1768
  name: "firmwareVersion",
@@ -2239,6 +2284,28 @@ const bridgeCommands = {
2239
2284
  deviceData.advertisingData.fwVersion
2240
2285
  );
2241
2286
  },
2287
+ async getErrorHistoryCounter(deviceId) {
2288
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2289
+ const result = await this.readCommand(deviceData, subCommandIds.errorHistoryCounter, {
2290
+ headerLength: 5,
2291
+ footerLength: 0
2292
+ });
2293
+ return bridgeTools.convertBytesToStructure(
2294
+ bridgeCommandStructures.errorHistoryCounter.structure,
2295
+ result.data,
2296
+ deviceData.advertisingData.fwVersion
2297
+ );
2298
+ },
2299
+ async getEolStatus(deviceId) {
2300
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2301
+ const result = await this.readCommand(deviceData, subCommandIds.eolStatus);
2302
+ const structurized = bridgeTools.convertBytesToStructure(
2303
+ bridgeCommandStructures.eolStatus.structure,
2304
+ result.data,
2305
+ deviceData.advertisingData.fwVersion
2306
+ );
2307
+ return { ...structurized, isFactory: result.isFactory };
2308
+ },
2242
2309
  async getSensorMeasurement(deviceId, positionId) {
2243
2310
  const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2244
2311
  const isSpare = String(positionId).endsWith("0");
@@ -2407,9 +2474,15 @@ async function getConfiguration(deviceId, includeVehicleData = false) {
2407
2474
  const customerImbalanceThresholds = await bridgeCommands.getCustomerImbalanceThresholds(deviceId);
2408
2475
  const pressuresPerAxle = await bridgeCommands.getPressuresPerAxle(deviceId);
2409
2476
  let autolearnSettings;
2477
+ let errorHistoryCounter;
2478
+ let eolStatus;
2410
2479
  if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
2411
2480
  autolearnSettings = await bridgeCommands.getAutolearnSettings(deviceId);
2412
2481
  }
2482
+ if (bridgeTools.isVersionGreaterThan(deviceId, "1.1.F")) {
2483
+ errorHistoryCounter = await bridgeCommands.getErrorHistoryCounter(deviceId);
2484
+ eolStatus = await bridgeCommands.getEolStatus(deviceId);
2485
+ }
2413
2486
  const configuration = {
2414
2487
  customerCANSettings,
2415
2488
  workshopCANSettings,
@@ -2417,7 +2490,9 @@ async function getConfiguration(deviceId, includeVehicleData = false) {
2417
2490
  customerTemperatureThresholds,
2418
2491
  customerImbalanceThresholds,
2419
2492
  pressuresPerAxle,
2420
- autolearnSettings
2493
+ autolearnSettings,
2494
+ errorHistoryCounter,
2495
+ eolStatus
2421
2496
  };
2422
2497
  if (includeVehicleData) {
2423
2498
  configuration.vehicleLayout = await bridgeCommands.getVehicleLayout(deviceId);
package/dist/index.d.cts CHANGED
@@ -420,7 +420,7 @@ declare const _default: {
420
420
  };
421
421
  };
422
422
  /**
423
- * kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
423
+ * kPa per-axle pressure layout used by the 030717 bridge model (same sub-command 0x30 as `pressuresPerAxle`).
424
424
  * Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
425
425
  * uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
426
426
  * `bridgeTools.usesKpaPressure(deviceId)`.
@@ -863,6 +863,48 @@ declare const _default: {
863
863
  };
864
864
  };
865
865
  };
866
+ errorHistoryCounter: {
867
+ id: number[];
868
+ name: string;
869
+ structure: {
870
+ hwErrorCounter: {
871
+ size: number;
872
+ description: string;
873
+ display: "decimal";
874
+ };
875
+ powerUpCounter: {
876
+ size: number;
877
+ description: string;
878
+ display: "decimal";
879
+ };
880
+ configErrorCounter: {
881
+ size: number;
882
+ description: string;
883
+ display: "decimal";
884
+ };
885
+ swErrorCounter: {
886
+ size: number;
887
+ description: string;
888
+ display: "decimal";
889
+ };
890
+ };
891
+ };
892
+ eolStatus: {
893
+ id: number[];
894
+ name: string;
895
+ structure: {
896
+ eolStatus: {
897
+ size: number;
898
+ description: string;
899
+ display: "decimal";
900
+ };
901
+ eolCounter: {
902
+ size: number;
903
+ description: string;
904
+ display: "decimal";
905
+ };
906
+ };
907
+ };
866
908
  firmwareVersion: {
867
909
  id: number[];
868
910
  name: string;
@@ -970,6 +1012,10 @@ interface BridgeConfiguration {
970
1012
  customerTemperatureThresholds: BridgeCommandStructurized<typeof _default.axleTemperatureThresholds.structure>;
971
1013
  customerImbalanceThresholds: BridgeCommandStructurized<typeof _default.axleImbalanceThresholds.structure>;
972
1014
  pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
1015
+ /** only available after 1.1.F fw */
1016
+ errorHistoryCounter?: BridgeCommandStructurized<typeof _default.errorHistoryCounter.structure>;
1017
+ /** only available after 1.1.F fw */
1018
+ eolStatus?: BridgeCommandStructurized<typeof _default.eolStatus.structure>;
973
1019
  /** only available after 0.9.8 fw */
974
1020
  autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
975
1021
  vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
package/dist/index.d.mts CHANGED
@@ -420,7 +420,7 @@ declare const _default: {
420
420
  };
421
421
  };
422
422
  /**
423
- * kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
423
+ * kPa per-axle pressure layout used by the 030717 bridge model (same sub-command 0x30 as `pressuresPerAxle`).
424
424
  * Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
425
425
  * uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
426
426
  * `bridgeTools.usesKpaPressure(deviceId)`.
@@ -863,6 +863,48 @@ declare const _default: {
863
863
  };
864
864
  };
865
865
  };
866
+ errorHistoryCounter: {
867
+ id: number[];
868
+ name: string;
869
+ structure: {
870
+ hwErrorCounter: {
871
+ size: number;
872
+ description: string;
873
+ display: "decimal";
874
+ };
875
+ powerUpCounter: {
876
+ size: number;
877
+ description: string;
878
+ display: "decimal";
879
+ };
880
+ configErrorCounter: {
881
+ size: number;
882
+ description: string;
883
+ display: "decimal";
884
+ };
885
+ swErrorCounter: {
886
+ size: number;
887
+ description: string;
888
+ display: "decimal";
889
+ };
890
+ };
891
+ };
892
+ eolStatus: {
893
+ id: number[];
894
+ name: string;
895
+ structure: {
896
+ eolStatus: {
897
+ size: number;
898
+ description: string;
899
+ display: "decimal";
900
+ };
901
+ eolCounter: {
902
+ size: number;
903
+ description: string;
904
+ display: "decimal";
905
+ };
906
+ };
907
+ };
866
908
  firmwareVersion: {
867
909
  id: number[];
868
910
  name: string;
@@ -970,6 +1012,10 @@ interface BridgeConfiguration {
970
1012
  customerTemperatureThresholds: BridgeCommandStructurized<typeof _default.axleTemperatureThresholds.structure>;
971
1013
  customerImbalanceThresholds: BridgeCommandStructurized<typeof _default.axleImbalanceThresholds.structure>;
972
1014
  pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
1015
+ /** only available after 1.1.F fw */
1016
+ errorHistoryCounter?: BridgeCommandStructurized<typeof _default.errorHistoryCounter.structure>;
1017
+ /** only available after 1.1.F fw */
1018
+ eolStatus?: BridgeCommandStructurized<typeof _default.eolStatus.structure>;
973
1019
  /** only available after 0.9.8 fw */
974
1020
  autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
975
1021
  vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
package/dist/index.d.ts CHANGED
@@ -420,7 +420,7 @@ declare const _default: {
420
420
  };
421
421
  };
422
422
  /**
423
- * kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
423
+ * kPa per-axle pressure layout used by the 030717 bridge model (same sub-command 0x30 as `pressuresPerAxle`).
424
424
  * Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
425
425
  * uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
426
426
  * `bridgeTools.usesKpaPressure(deviceId)`.
@@ -863,6 +863,48 @@ declare const _default: {
863
863
  };
864
864
  };
865
865
  };
866
+ errorHistoryCounter: {
867
+ id: number[];
868
+ name: string;
869
+ structure: {
870
+ hwErrorCounter: {
871
+ size: number;
872
+ description: string;
873
+ display: "decimal";
874
+ };
875
+ powerUpCounter: {
876
+ size: number;
877
+ description: string;
878
+ display: "decimal";
879
+ };
880
+ configErrorCounter: {
881
+ size: number;
882
+ description: string;
883
+ display: "decimal";
884
+ };
885
+ swErrorCounter: {
886
+ size: number;
887
+ description: string;
888
+ display: "decimal";
889
+ };
890
+ };
891
+ };
892
+ eolStatus: {
893
+ id: number[];
894
+ name: string;
895
+ structure: {
896
+ eolStatus: {
897
+ size: number;
898
+ description: string;
899
+ display: "decimal";
900
+ };
901
+ eolCounter: {
902
+ size: number;
903
+ description: string;
904
+ display: "decimal";
905
+ };
906
+ };
907
+ };
866
908
  firmwareVersion: {
867
909
  id: number[];
868
910
  name: string;
@@ -970,6 +1012,10 @@ interface BridgeConfiguration {
970
1012
  customerTemperatureThresholds: BridgeCommandStructurized<typeof _default.axleTemperatureThresholds.structure>;
971
1013
  customerImbalanceThresholds: BridgeCommandStructurized<typeof _default.axleImbalanceThresholds.structure>;
972
1014
  pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
1015
+ /** only available after 1.1.F fw */
1016
+ errorHistoryCounter?: BridgeCommandStructurized<typeof _default.errorHistoryCounter.structure>;
1017
+ /** only available after 1.1.F fw */
1018
+ eolStatus?: BridgeCommandStructurized<typeof _default.eolStatus.structure>;
973
1019
  /** only available after 0.9.8 fw */
974
1020
  autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
975
1021
  vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
package/dist/index.mjs CHANGED
@@ -247,7 +247,7 @@ const bridgeTools = {
247
247
  },
248
248
  convertBarToKpaByte(deviceId, value) {
249
249
  if (!value) return 0;
250
- const bitValue = this.usesKpaPressure(deviceId) ? 1 : 5.0625;
250
+ const bitValue = bridgeUsesKpaPressure(deviceId) ? 1 : 5.0625;
251
251
  return _.round((value + 1) * 100 / bitValue);
252
252
  },
253
253
  convertSensorIdForBridge(sensorId) {
@@ -270,7 +270,7 @@ const bridgeTools = {
270
270
  if (!_.isNumber(value)) {
271
271
  throw new TypeError("Value has to be a number");
272
272
  }
273
- const bitValue = this.usesKpaPressure(deviceId) ? 1 : 5.0625;
273
+ const bitValue = bridgeUsesKpaPressure(deviceId) ? 1 : 5.0625;
274
274
  const rawBar = value * bitValue / 100;
275
275
  return _.round(Math.max(rawBar - decrementValue, 0), 1);
276
276
  },
@@ -285,7 +285,7 @@ const bridgeTools = {
285
285
  return false;
286
286
  },
287
287
  usesKpaPressure(deviceId) {
288
- return this.isVersionGreaterThan(deviceId, "1.1.F");
288
+ return bridgeUsesKpaPressure(deviceId);
289
289
  },
290
290
  convertSensorIdFromBridge(sensorId) {
291
291
  if (sensorId.startsWith("B")) {
@@ -367,6 +367,9 @@ function getBridgeFromStore(deviceId) {
367
367
  if (deviceData.type !== "bridge") throw new Error("Device is not bridge");
368
368
  return deviceData;
369
369
  }
370
+ function bridgeUsesKpaPressure(deviceId) {
371
+ return getBridgeFromStore(deviceId).name === "030717";
372
+ }
370
373
  function getDefaultTyreLabels() {
371
374
  const tyreLabelsStr = "_L;_R;_LO;_LI;_RI;_RO;_";
372
375
  const tyreLabelsStrLoc = tyreLabelsStr;
@@ -1267,7 +1270,7 @@ const bridgeCommandStructures = {
1267
1270
  }
1268
1271
  },
1269
1272
  /**
1270
- * kPa per-axle pressure layout used from FW 1.2.0 onwards (same sub-command 0x30 as `pressuresPerAxle`).
1273
+ * kPa per-axle pressure layout used by the 030717 bridge model (same sub-command 0x30 as `pressuresPerAxle`).
1271
1274
  * Each axle packs the same three values (set; min; max) but every value is a 2-byte little-endian raw kPa
1272
1275
  * uint16 (no 5.0625 bit scaling), so each axle is 6 bytes instead of 3. Selected at runtime via
1273
1276
  * `bridgeTools.usesKpaPressure(deviceId)`.
@@ -1711,6 +1714,48 @@ const bridgeCommandStructures = {
1711
1714
  }
1712
1715
  }
1713
1716
  },
1717
+ errorHistoryCounter: {
1718
+ id: [98, 112],
1719
+ name: "errorHistoryCounter",
1720
+ structure: {
1721
+ hwErrorCounter: {
1722
+ size: 1,
1723
+ description: "HW Error Counter",
1724
+ display: "decimal"
1725
+ },
1726
+ powerUpCounter: {
1727
+ size: 1,
1728
+ description: "Power-up Counter",
1729
+ display: "decimal"
1730
+ },
1731
+ configErrorCounter: {
1732
+ size: 1,
1733
+ description: "Config. Error Counter",
1734
+ display: "decimal"
1735
+ },
1736
+ swErrorCounter: {
1737
+ size: 1,
1738
+ description: "SW Error Counter",
1739
+ display: "decimal"
1740
+ }
1741
+ }
1742
+ },
1743
+ eolStatus: {
1744
+ id: [98, 128],
1745
+ name: "eolStatus",
1746
+ structure: {
1747
+ eolStatus: {
1748
+ size: 1,
1749
+ description: "End of Line status code",
1750
+ display: "decimal"
1751
+ },
1752
+ eolCounter: {
1753
+ size: 1,
1754
+ description: "End of Line counter value",
1755
+ display: "decimal"
1756
+ }
1757
+ }
1758
+ },
1714
1759
  firmwareVersion: {
1715
1760
  id: [98, 144],
1716
1761
  name: "firmwareVersion",
@@ -2232,6 +2277,28 @@ const bridgeCommands = {
2232
2277
  deviceData.advertisingData.fwVersion
2233
2278
  );
2234
2279
  },
2280
+ async getErrorHistoryCounter(deviceId) {
2281
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2282
+ const result = await this.readCommand(deviceData, subCommandIds.errorHistoryCounter, {
2283
+ headerLength: 5,
2284
+ footerLength: 0
2285
+ });
2286
+ return bridgeTools.convertBytesToStructure(
2287
+ bridgeCommandStructures.errorHistoryCounter.structure,
2288
+ result.data,
2289
+ deviceData.advertisingData.fwVersion
2290
+ );
2291
+ },
2292
+ async getEolStatus(deviceId) {
2293
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2294
+ const result = await this.readCommand(deviceData, subCommandIds.eolStatus);
2295
+ const structurized = bridgeTools.convertBytesToStructure(
2296
+ bridgeCommandStructures.eolStatus.structure,
2297
+ result.data,
2298
+ deviceData.advertisingData.fwVersion
2299
+ );
2300
+ return { ...structurized, isFactory: result.isFactory };
2301
+ },
2235
2302
  async getSensorMeasurement(deviceId, positionId) {
2236
2303
  const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2237
2304
  const isSpare = String(positionId).endsWith("0");
@@ -2400,9 +2467,15 @@ async function getConfiguration(deviceId, includeVehicleData = false) {
2400
2467
  const customerImbalanceThresholds = await bridgeCommands.getCustomerImbalanceThresholds(deviceId);
2401
2468
  const pressuresPerAxle = await bridgeCommands.getPressuresPerAxle(deviceId);
2402
2469
  let autolearnSettings;
2470
+ let errorHistoryCounter;
2471
+ let eolStatus;
2403
2472
  if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
2404
2473
  autolearnSettings = await bridgeCommands.getAutolearnSettings(deviceId);
2405
2474
  }
2475
+ if (bridgeTools.isVersionGreaterThan(deviceId, "1.1.F")) {
2476
+ errorHistoryCounter = await bridgeCommands.getErrorHistoryCounter(deviceId);
2477
+ eolStatus = await bridgeCommands.getEolStatus(deviceId);
2478
+ }
2406
2479
  const configuration = {
2407
2480
  customerCANSettings,
2408
2481
  workshopCANSettings,
@@ -2410,7 +2483,9 @@ async function getConfiguration(deviceId, includeVehicleData = false) {
2410
2483
  customerTemperatureThresholds,
2411
2484
  customerImbalanceThresholds,
2412
2485
  pressuresPerAxle,
2413
- autolearnSettings
2486
+ autolearnSettings,
2487
+ errorHistoryCounter,
2488
+ eolStatus
2414
2489
  };
2415
2490
  if (includeVehicleData) {
2416
2491
  configuration.vehicleLayout = await bridgeCommands.getVehicleLayout(deviceId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirecheck-device-sdk",
3
- "version": "0.2.67",
3
+ "version": "0.2.69",
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",