tirecheck-device-sdk 0.2.65 → 0.2.66

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
@@ -1571,6 +1571,95 @@ const bridgeCommandStructures = {
1571
1571
  version: "1.0.3"
1572
1572
  }
1573
1573
  }
1574
+ },
1575
+ idsPerWheel: {
1576
+ // base sub-command id, the actual axle is addressed via `0x20 + axleIndex` (0x20 - 0x2F)
1577
+ id: [98, 32],
1578
+ name: "idsPerWheel",
1579
+ structure: {
1580
+ wheel01: {
1581
+ size: 4,
1582
+ description: "Wheel 01 sensor ID (4-byte, little-endian)"
1583
+ },
1584
+ wheel02: {
1585
+ size: 4,
1586
+ description: "Wheel 02 sensor ID (4-byte, little-endian)"
1587
+ },
1588
+ wheel03: {
1589
+ size: 4,
1590
+ description: "Wheel 03 sensor ID (4-byte, little-endian)"
1591
+ },
1592
+ wheel04: {
1593
+ size: 4,
1594
+ description: "Wheel 04 sensor ID (4-byte, little-endian)"
1595
+ },
1596
+ wheel05: {
1597
+ size: 4,
1598
+ description: "Wheel 05 sensor ID (4-byte, little-endian)"
1599
+ },
1600
+ wheel06: {
1601
+ size: 4,
1602
+ description: "Wheel 06 sensor ID (4-byte, little-endian), left-outer position"
1603
+ },
1604
+ wheel07: {
1605
+ size: 4,
1606
+ description: "Wheel 07 sensor ID (4-byte, little-endian), left-inner position"
1607
+ },
1608
+ wheel08: {
1609
+ size: 4,
1610
+ description: "Wheel 08 sensor ID (4-byte, little-endian), center / spare position"
1611
+ },
1612
+ wheel09: {
1613
+ size: 4,
1614
+ description: "Wheel 09 sensor ID (4-byte, little-endian), right-inner position"
1615
+ },
1616
+ wheel10: {
1617
+ size: 4,
1618
+ description: "Wheel 10 sensor ID (4-byte, little-endian), right-outer position"
1619
+ },
1620
+ wheel11: {
1621
+ size: 4,
1622
+ description: "Wheel 11 sensor ID (4-byte, little-endian)"
1623
+ },
1624
+ wheel12: {
1625
+ size: 4,
1626
+ description: "Wheel 12 sensor ID (4-byte, little-endian)"
1627
+ },
1628
+ wheel13: {
1629
+ size: 4,
1630
+ description: "Wheel 13 sensor ID (4-byte, little-endian)"
1631
+ },
1632
+ wheel14: {
1633
+ size: 4,
1634
+ description: "Wheel 14 sensor ID (4-byte, little-endian)"
1635
+ },
1636
+ wheel15: {
1637
+ size: 4,
1638
+ description: "Wheel 15 sensor ID (4-byte, little-endian)"
1639
+ }
1640
+ }
1641
+ },
1642
+ firmwareVersion: {
1643
+ id: [98, 144],
1644
+ name: "firmwareVersion",
1645
+ structure: {
1646
+ bluetoothStackVersion: {
1647
+ size: 20,
1648
+ description: "Bluetooth stack version + bootloader (e.g. BT stack 4.0.0.191)"
1649
+ },
1650
+ configurationDataVersion: {
1651
+ size: 4,
1652
+ description: "Configuration data version"
1653
+ },
1654
+ bleChipFwCompilationDate: {
1655
+ size: 7,
1656
+ description: "BLE chip FW compilation date: second, minute, hour, day, month, year (2-byte, big-endian)"
1657
+ },
1658
+ bluetoothChipFwVersion: {
1659
+ size: 4,
1660
+ description: "Bluetooth chip FW version: major.minor.patch + release type (e.g. 1.2.0 Release)"
1661
+ }
1662
+ }
1574
1663
  }
1575
1664
  };
1576
1665
 
@@ -1980,12 +2069,13 @@ const bridgeCommands = {
1980
2069
  );
1981
2070
  return await this.writeCommand(deviceData, commandIds$1.writeData, subCommandIds.autolearnIdStatus, payload);
1982
2071
  },
1983
- async getAutolearnUnknownSensors(device) {
1984
- const result = await this.readCommand(device, subCommandIds.autolearnUnknownSensors);
2072
+ async getAutolearnUnknownSensors(deviceId) {
2073
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2074
+ const result = await this.readCommand(deviceData, subCommandIds.autolearnUnknownSensors);
1985
2075
  const structurized = bridgeTools.convertBytesToStructure(
1986
2076
  bridgeCommandStructures.autolearnUnknownSensors.structure,
1987
2077
  result.data,
1988
- device.advertisingData.fwVersion
2078
+ deviceData.advertisingData.fwVersion
1989
2079
  );
1990
2080
  return { ...structurized, isFactory: result.isFactory };
1991
2081
  },
@@ -2056,6 +2146,18 @@ const bridgeCommands = {
2056
2146
  );
2057
2147
  return structurizedData;
2058
2148
  },
2149
+ async getFirmwareVersion(deviceId) {
2150
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2151
+ const result = await this.readCommand(deviceData, subCommandIds.firmwareVersion, {
2152
+ headerLength: 5,
2153
+ footerLength: 0
2154
+ });
2155
+ return bridgeTools.convertBytesToStructure(
2156
+ bridgeCommandStructures.firmwareVersion.structure,
2157
+ result.data,
2158
+ deviceData.advertisingData.fwVersion
2159
+ );
2160
+ },
2059
2161
  async getSensorMeasurement(deviceId, positionId) {
2060
2162
  const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2061
2163
  const isSpare = String(positionId).endsWith("0");
@@ -2069,7 +2171,7 @@ const bridgeCommands = {
2069
2171
  const result = await this.writeCommand(deviceData, commandIds$1.sensorMeasurement, subCommandId, []);
2070
2172
  return result;
2071
2173
  },
2072
- async readCommand(device, subCommandId) {
2174
+ async readCommand(device, subCommandId, { headerLength = 19, footerLength = 8 } = {}) {
2073
2175
  const commandLength = 2;
2074
2176
  const result = await this.promisify(device, [
2075
2177
  ...this.getCommandHeader(device),
@@ -2077,9 +2179,9 @@ const bridgeCommands = {
2077
2179
  commandIds$1.readData,
2078
2180
  subCommandId
2079
2181
  ]);
2080
- const data = result.slice(19, result.length - 8);
2081
- const crc = result.slice(result.length - 8, result.length - 4);
2082
- const isFactory = crc.every((n) => n === 0);
2182
+ const data = result.slice(headerLength, result.length - footerLength);
2183
+ const crc = result.slice(result.length - footerLength, result.length - footerLength + 4);
2184
+ const isFactory = crc.length === 4 && crc.every((n) => n === 0);
2083
2185
  return { data, isFactory };
2084
2186
  },
2085
2187
  async writeCommand(device, commandId, subCommandId, payload) {
@@ -2216,7 +2318,7 @@ async function setVehicleLayout(deviceId, tcVehicle) {
2216
2318
  }
2217
2319
  await bridgeCommands.setVehicleLayout(deviceId, result);
2218
2320
  }
2219
- async function getConfiguration(deviceId) {
2321
+ async function getConfiguration(deviceId, includeVehicleData = false) {
2220
2322
  const customerCANSettings = await bridgeCommands.getCustomerCANSettings(deviceId);
2221
2323
  const workshopCANSettings = await bridgeCommands.getWorkshopCANSettings(deviceId);
2222
2324
  const customerPressureThresholds = await bridgeCommands.getCustomerPressureThresholds(deviceId);
@@ -2227,7 +2329,7 @@ async function getConfiguration(deviceId) {
2227
2329
  if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
2228
2330
  autolearnSettings = await bridgeCommands.getAutolearnSettings(deviceId);
2229
2331
  }
2230
- return {
2332
+ const configuration = {
2231
2333
  customerCANSettings,
2232
2334
  workshopCANSettings,
2233
2335
  customerPressureThresholds,
@@ -2236,6 +2338,24 @@ async function getConfiguration(deviceId) {
2236
2338
  pressuresPerAxle,
2237
2339
  autolearnSettings
2238
2340
  };
2341
+ if (includeVehicleData) {
2342
+ configuration.vehicleLayout = await bridgeCommands.getVehicleLayout(deviceId);
2343
+ configuration.axleInfo = [];
2344
+ for (let axleIndex = 0; axleIndex < 15; axleIndex++) {
2345
+ const axleBytes = await bridgeCommands.getAxleInfo(deviceId, axleIndex);
2346
+ configuration.axleInfo.push(
2347
+ bridgeTools.convertBytesToStructure(bridgeCommandStructures.idsPerWheel.structure, axleBytes)
2348
+ );
2349
+ }
2350
+ if (bridgeTools.isVersionGreaterThan(deviceId, "1.1.F")) {
2351
+ configuration.firmwareVersion = await bridgeCommands.getFirmwareVersion(deviceId);
2352
+ }
2353
+ if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
2354
+ configuration.autolearnIdStatus = await bridgeCommands.getAutolearnIdStatus(deviceId);
2355
+ configuration.autolearnUnknownSensors = await bridgeCommands.getAutolearnUnknownSensors(deviceId);
2356
+ }
2357
+ }
2358
+ return configuration;
2239
2359
  }
2240
2360
  function bridgeVehiclesDifference(original, change) {
2241
2361
  const differences = [];
package/dist/index.d.cts CHANGED
@@ -501,7 +501,87 @@ declare const _default: {
501
501
  };
502
502
  };
503
503
  };
504
- autolearnIdStatus: BridgeCommandStructure;
504
+ autolearnIdStatus: {
505
+ id: number[];
506
+ name: string;
507
+ structure: {
508
+ axle01: {
509
+ size: number;
510
+ description: string;
511
+ display: "reverseHex";
512
+ };
513
+ axle02: {
514
+ size: number;
515
+ description: string;
516
+ display: "reverseHex";
517
+ };
518
+ axle03: {
519
+ size: number;
520
+ description: string;
521
+ display: "reverseHex";
522
+ };
523
+ axle04: {
524
+ size: number;
525
+ description: string;
526
+ display: "reverseHex";
527
+ };
528
+ axle05: {
529
+ size: number;
530
+ description: string;
531
+ display: "reverseHex";
532
+ };
533
+ axle06: {
534
+ size: number;
535
+ description: string;
536
+ display: "reverseHex";
537
+ };
538
+ axle07: {
539
+ size: number;
540
+ description: string;
541
+ display: "reverseHex";
542
+ };
543
+ axle08: {
544
+ size: number;
545
+ description: string;
546
+ display: "reverseHex";
547
+ };
548
+ axle09: {
549
+ size: number;
550
+ description: string;
551
+ display: "reverseHex";
552
+ };
553
+ axle10: {
554
+ size: number;
555
+ description: string;
556
+ display: "reverseHex";
557
+ };
558
+ axle11: {
559
+ size: number;
560
+ description: string;
561
+ display: "reverseHex";
562
+ };
563
+ axle12: {
564
+ size: number;
565
+ description: string;
566
+ display: "reverseHex";
567
+ };
568
+ axle13: {
569
+ size: number;
570
+ description: string;
571
+ display: "reverseHex";
572
+ };
573
+ axle14: {
574
+ size: number;
575
+ description: string;
576
+ display: "reverseHex";
577
+ };
578
+ axle15: {
579
+ size: number;
580
+ description: string;
581
+ display: "reverseHex";
582
+ };
583
+ };
584
+ };
505
585
  autolearnUnknownSensors: {
506
586
  id: number[];
507
587
  name: string;
@@ -645,6 +725,94 @@ declare const _default: {
645
725
  };
646
726
  };
647
727
  };
728
+ idsPerWheel: {
729
+ id: number[];
730
+ name: string;
731
+ structure: {
732
+ wheel01: {
733
+ size: number;
734
+ description: string;
735
+ };
736
+ wheel02: {
737
+ size: number;
738
+ description: string;
739
+ };
740
+ wheel03: {
741
+ size: number;
742
+ description: string;
743
+ };
744
+ wheel04: {
745
+ size: number;
746
+ description: string;
747
+ };
748
+ wheel05: {
749
+ size: number;
750
+ description: string;
751
+ };
752
+ wheel06: {
753
+ size: number;
754
+ description: string;
755
+ };
756
+ wheel07: {
757
+ size: number;
758
+ description: string;
759
+ };
760
+ wheel08: {
761
+ size: number;
762
+ description: string;
763
+ };
764
+ wheel09: {
765
+ size: number;
766
+ description: string;
767
+ };
768
+ wheel10: {
769
+ size: number;
770
+ description: string;
771
+ };
772
+ wheel11: {
773
+ size: number;
774
+ description: string;
775
+ };
776
+ wheel12: {
777
+ size: number;
778
+ description: string;
779
+ };
780
+ wheel13: {
781
+ size: number;
782
+ description: string;
783
+ };
784
+ wheel14: {
785
+ size: number;
786
+ description: string;
787
+ };
788
+ wheel15: {
789
+ size: number;
790
+ description: string;
791
+ };
792
+ };
793
+ };
794
+ firmwareVersion: {
795
+ id: number[];
796
+ name: string;
797
+ structure: {
798
+ bluetoothStackVersion: {
799
+ size: number;
800
+ description: string;
801
+ };
802
+ configurationDataVersion: {
803
+ size: number;
804
+ description: string;
805
+ };
806
+ bleChipFwCompilationDate: {
807
+ size: number;
808
+ description: string;
809
+ };
810
+ bluetoothChipFwVersion: {
811
+ size: number;
812
+ description: string;
813
+ };
814
+ };
815
+ };
648
816
  };
649
817
 
650
818
  type DeepPartial<T> = T extends object ? {
@@ -732,6 +900,15 @@ interface BridgeConfiguration {
732
900
  pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
733
901
  /** only available after 0.9.8 fw */
734
902
  autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
903
+ vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
904
+ /** Per-axle wheel sensor IDs, indexed by axle (0-14). Each entry holds the 15 wheel slots of one axle. */
905
+ axleInfo?: BridgeCommandStructurized<typeof _default.idsPerWheel.structure>[];
906
+ /** Parsed 0x90 SW Version DID (BT stack, config data version, BLE chip compilation date, BT chip FW version). */
907
+ firmwareVersion?: BridgeCommandStructurized<typeof _default.firmwareVersion.structure>;
908
+ /** only available after 0.9.7 fw */
909
+ autolearnIdStatus?: BridgeCommandStructurized<typeof _default.autolearnIdStatus.structure>;
910
+ /** only available after 0.9.7 fw */
911
+ autolearnUnknownSensors?: BridgeCommandStructurized<typeof _default.autolearnUnknownSensors.structure>;
735
912
  }
736
913
  interface BridgeReading {
737
914
  date: number;
@@ -963,7 +1140,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
963
1140
  connect: (deviceId: string, accessLevel: BridgeAccessLevel) => Promise<void>;
964
1141
  getVehicle: (deviceId: string) => Promise<BridgeTcVehicle>;
965
1142
  setVehicle: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<void>;
966
- getConfiguration: (deviceId: string) => Promise<BridgeConfiguration>;
1143
+ getConfiguration: (deviceId: string, includeVehicleData?: boolean) => Promise<BridgeConfiguration>;
967
1144
  setConfiguration: (deviceId: string, bridgeConfiguration: BridgeConfiguration) => Promise<void>;
968
1145
  getSensorReading: (deviceId: string, positionId: number) => Promise<BridgeReading>;
969
1146
  getVehicleReadings: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeReading[]>;
package/dist/index.d.mts CHANGED
@@ -501,7 +501,87 @@ declare const _default: {
501
501
  };
502
502
  };
503
503
  };
504
- autolearnIdStatus: BridgeCommandStructure;
504
+ autolearnIdStatus: {
505
+ id: number[];
506
+ name: string;
507
+ structure: {
508
+ axle01: {
509
+ size: number;
510
+ description: string;
511
+ display: "reverseHex";
512
+ };
513
+ axle02: {
514
+ size: number;
515
+ description: string;
516
+ display: "reverseHex";
517
+ };
518
+ axle03: {
519
+ size: number;
520
+ description: string;
521
+ display: "reverseHex";
522
+ };
523
+ axle04: {
524
+ size: number;
525
+ description: string;
526
+ display: "reverseHex";
527
+ };
528
+ axle05: {
529
+ size: number;
530
+ description: string;
531
+ display: "reverseHex";
532
+ };
533
+ axle06: {
534
+ size: number;
535
+ description: string;
536
+ display: "reverseHex";
537
+ };
538
+ axle07: {
539
+ size: number;
540
+ description: string;
541
+ display: "reverseHex";
542
+ };
543
+ axle08: {
544
+ size: number;
545
+ description: string;
546
+ display: "reverseHex";
547
+ };
548
+ axle09: {
549
+ size: number;
550
+ description: string;
551
+ display: "reverseHex";
552
+ };
553
+ axle10: {
554
+ size: number;
555
+ description: string;
556
+ display: "reverseHex";
557
+ };
558
+ axle11: {
559
+ size: number;
560
+ description: string;
561
+ display: "reverseHex";
562
+ };
563
+ axle12: {
564
+ size: number;
565
+ description: string;
566
+ display: "reverseHex";
567
+ };
568
+ axle13: {
569
+ size: number;
570
+ description: string;
571
+ display: "reverseHex";
572
+ };
573
+ axle14: {
574
+ size: number;
575
+ description: string;
576
+ display: "reverseHex";
577
+ };
578
+ axle15: {
579
+ size: number;
580
+ description: string;
581
+ display: "reverseHex";
582
+ };
583
+ };
584
+ };
505
585
  autolearnUnknownSensors: {
506
586
  id: number[];
507
587
  name: string;
@@ -645,6 +725,94 @@ declare const _default: {
645
725
  };
646
726
  };
647
727
  };
728
+ idsPerWheel: {
729
+ id: number[];
730
+ name: string;
731
+ structure: {
732
+ wheel01: {
733
+ size: number;
734
+ description: string;
735
+ };
736
+ wheel02: {
737
+ size: number;
738
+ description: string;
739
+ };
740
+ wheel03: {
741
+ size: number;
742
+ description: string;
743
+ };
744
+ wheel04: {
745
+ size: number;
746
+ description: string;
747
+ };
748
+ wheel05: {
749
+ size: number;
750
+ description: string;
751
+ };
752
+ wheel06: {
753
+ size: number;
754
+ description: string;
755
+ };
756
+ wheel07: {
757
+ size: number;
758
+ description: string;
759
+ };
760
+ wheel08: {
761
+ size: number;
762
+ description: string;
763
+ };
764
+ wheel09: {
765
+ size: number;
766
+ description: string;
767
+ };
768
+ wheel10: {
769
+ size: number;
770
+ description: string;
771
+ };
772
+ wheel11: {
773
+ size: number;
774
+ description: string;
775
+ };
776
+ wheel12: {
777
+ size: number;
778
+ description: string;
779
+ };
780
+ wheel13: {
781
+ size: number;
782
+ description: string;
783
+ };
784
+ wheel14: {
785
+ size: number;
786
+ description: string;
787
+ };
788
+ wheel15: {
789
+ size: number;
790
+ description: string;
791
+ };
792
+ };
793
+ };
794
+ firmwareVersion: {
795
+ id: number[];
796
+ name: string;
797
+ structure: {
798
+ bluetoothStackVersion: {
799
+ size: number;
800
+ description: string;
801
+ };
802
+ configurationDataVersion: {
803
+ size: number;
804
+ description: string;
805
+ };
806
+ bleChipFwCompilationDate: {
807
+ size: number;
808
+ description: string;
809
+ };
810
+ bluetoothChipFwVersion: {
811
+ size: number;
812
+ description: string;
813
+ };
814
+ };
815
+ };
648
816
  };
649
817
 
650
818
  type DeepPartial<T> = T extends object ? {
@@ -732,6 +900,15 @@ interface BridgeConfiguration {
732
900
  pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
733
901
  /** only available after 0.9.8 fw */
734
902
  autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
903
+ vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
904
+ /** Per-axle wheel sensor IDs, indexed by axle (0-14). Each entry holds the 15 wheel slots of one axle. */
905
+ axleInfo?: BridgeCommandStructurized<typeof _default.idsPerWheel.structure>[];
906
+ /** Parsed 0x90 SW Version DID (BT stack, config data version, BLE chip compilation date, BT chip FW version). */
907
+ firmwareVersion?: BridgeCommandStructurized<typeof _default.firmwareVersion.structure>;
908
+ /** only available after 0.9.7 fw */
909
+ autolearnIdStatus?: BridgeCommandStructurized<typeof _default.autolearnIdStatus.structure>;
910
+ /** only available after 0.9.7 fw */
911
+ autolearnUnknownSensors?: BridgeCommandStructurized<typeof _default.autolearnUnknownSensors.structure>;
735
912
  }
736
913
  interface BridgeReading {
737
914
  date: number;
@@ -963,7 +1140,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
963
1140
  connect: (deviceId: string, accessLevel: BridgeAccessLevel) => Promise<void>;
964
1141
  getVehicle: (deviceId: string) => Promise<BridgeTcVehicle>;
965
1142
  setVehicle: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<void>;
966
- getConfiguration: (deviceId: string) => Promise<BridgeConfiguration>;
1143
+ getConfiguration: (deviceId: string, includeVehicleData?: boolean) => Promise<BridgeConfiguration>;
967
1144
  setConfiguration: (deviceId: string, bridgeConfiguration: BridgeConfiguration) => Promise<void>;
968
1145
  getSensorReading: (deviceId: string, positionId: number) => Promise<BridgeReading>;
969
1146
  getVehicleReadings: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeReading[]>;
package/dist/index.d.ts CHANGED
@@ -501,7 +501,87 @@ declare const _default: {
501
501
  };
502
502
  };
503
503
  };
504
- autolearnIdStatus: BridgeCommandStructure;
504
+ autolearnIdStatus: {
505
+ id: number[];
506
+ name: string;
507
+ structure: {
508
+ axle01: {
509
+ size: number;
510
+ description: string;
511
+ display: "reverseHex";
512
+ };
513
+ axle02: {
514
+ size: number;
515
+ description: string;
516
+ display: "reverseHex";
517
+ };
518
+ axle03: {
519
+ size: number;
520
+ description: string;
521
+ display: "reverseHex";
522
+ };
523
+ axle04: {
524
+ size: number;
525
+ description: string;
526
+ display: "reverseHex";
527
+ };
528
+ axle05: {
529
+ size: number;
530
+ description: string;
531
+ display: "reverseHex";
532
+ };
533
+ axle06: {
534
+ size: number;
535
+ description: string;
536
+ display: "reverseHex";
537
+ };
538
+ axle07: {
539
+ size: number;
540
+ description: string;
541
+ display: "reverseHex";
542
+ };
543
+ axle08: {
544
+ size: number;
545
+ description: string;
546
+ display: "reverseHex";
547
+ };
548
+ axle09: {
549
+ size: number;
550
+ description: string;
551
+ display: "reverseHex";
552
+ };
553
+ axle10: {
554
+ size: number;
555
+ description: string;
556
+ display: "reverseHex";
557
+ };
558
+ axle11: {
559
+ size: number;
560
+ description: string;
561
+ display: "reverseHex";
562
+ };
563
+ axle12: {
564
+ size: number;
565
+ description: string;
566
+ display: "reverseHex";
567
+ };
568
+ axle13: {
569
+ size: number;
570
+ description: string;
571
+ display: "reverseHex";
572
+ };
573
+ axle14: {
574
+ size: number;
575
+ description: string;
576
+ display: "reverseHex";
577
+ };
578
+ axle15: {
579
+ size: number;
580
+ description: string;
581
+ display: "reverseHex";
582
+ };
583
+ };
584
+ };
505
585
  autolearnUnknownSensors: {
506
586
  id: number[];
507
587
  name: string;
@@ -645,6 +725,94 @@ declare const _default: {
645
725
  };
646
726
  };
647
727
  };
728
+ idsPerWheel: {
729
+ id: number[];
730
+ name: string;
731
+ structure: {
732
+ wheel01: {
733
+ size: number;
734
+ description: string;
735
+ };
736
+ wheel02: {
737
+ size: number;
738
+ description: string;
739
+ };
740
+ wheel03: {
741
+ size: number;
742
+ description: string;
743
+ };
744
+ wheel04: {
745
+ size: number;
746
+ description: string;
747
+ };
748
+ wheel05: {
749
+ size: number;
750
+ description: string;
751
+ };
752
+ wheel06: {
753
+ size: number;
754
+ description: string;
755
+ };
756
+ wheel07: {
757
+ size: number;
758
+ description: string;
759
+ };
760
+ wheel08: {
761
+ size: number;
762
+ description: string;
763
+ };
764
+ wheel09: {
765
+ size: number;
766
+ description: string;
767
+ };
768
+ wheel10: {
769
+ size: number;
770
+ description: string;
771
+ };
772
+ wheel11: {
773
+ size: number;
774
+ description: string;
775
+ };
776
+ wheel12: {
777
+ size: number;
778
+ description: string;
779
+ };
780
+ wheel13: {
781
+ size: number;
782
+ description: string;
783
+ };
784
+ wheel14: {
785
+ size: number;
786
+ description: string;
787
+ };
788
+ wheel15: {
789
+ size: number;
790
+ description: string;
791
+ };
792
+ };
793
+ };
794
+ firmwareVersion: {
795
+ id: number[];
796
+ name: string;
797
+ structure: {
798
+ bluetoothStackVersion: {
799
+ size: number;
800
+ description: string;
801
+ };
802
+ configurationDataVersion: {
803
+ size: number;
804
+ description: string;
805
+ };
806
+ bleChipFwCompilationDate: {
807
+ size: number;
808
+ description: string;
809
+ };
810
+ bluetoothChipFwVersion: {
811
+ size: number;
812
+ description: string;
813
+ };
814
+ };
815
+ };
648
816
  };
649
817
 
650
818
  type DeepPartial<T> = T extends object ? {
@@ -732,6 +900,15 @@ interface BridgeConfiguration {
732
900
  pressuresPerAxle: BridgeCommandStructurized<typeof _default.pressuresPerAxle.structure>;
733
901
  /** only available after 0.9.8 fw */
734
902
  autolearnSettings?: BridgeCommandStructurized<typeof _default.autolearnSettings.structure>;
903
+ vehicleLayout?: BridgeCommandStructurized<typeof _default.vehicleLayout.structure>;
904
+ /** Per-axle wheel sensor IDs, indexed by axle (0-14). Each entry holds the 15 wheel slots of one axle. */
905
+ axleInfo?: BridgeCommandStructurized<typeof _default.idsPerWheel.structure>[];
906
+ /** Parsed 0x90 SW Version DID (BT stack, config data version, BLE chip compilation date, BT chip FW version). */
907
+ firmwareVersion?: BridgeCommandStructurized<typeof _default.firmwareVersion.structure>;
908
+ /** only available after 0.9.7 fw */
909
+ autolearnIdStatus?: BridgeCommandStructurized<typeof _default.autolearnIdStatus.structure>;
910
+ /** only available after 0.9.7 fw */
911
+ autolearnUnknownSensors?: BridgeCommandStructurized<typeof _default.autolearnUnknownSensors.structure>;
735
912
  }
736
913
  interface BridgeReading {
737
914
  date: number;
@@ -963,7 +1140,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
963
1140
  connect: (deviceId: string, accessLevel: BridgeAccessLevel) => Promise<void>;
964
1141
  getVehicle: (deviceId: string) => Promise<BridgeTcVehicle>;
965
1142
  setVehicle: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<void>;
966
- getConfiguration: (deviceId: string) => Promise<BridgeConfiguration>;
1143
+ getConfiguration: (deviceId: string, includeVehicleData?: boolean) => Promise<BridgeConfiguration>;
967
1144
  setConfiguration: (deviceId: string, bridgeConfiguration: BridgeConfiguration) => Promise<void>;
968
1145
  getSensorReading: (deviceId: string, positionId: number) => Promise<BridgeReading>;
969
1146
  getVehicleReadings: (deviceId: string, tcVehicle: BridgeTcVehicle) => Promise<BridgeReading[]>;
package/dist/index.mjs CHANGED
@@ -1564,6 +1564,95 @@ const bridgeCommandStructures = {
1564
1564
  version: "1.0.3"
1565
1565
  }
1566
1566
  }
1567
+ },
1568
+ idsPerWheel: {
1569
+ // base sub-command id, the actual axle is addressed via `0x20 + axleIndex` (0x20 - 0x2F)
1570
+ id: [98, 32],
1571
+ name: "idsPerWheel",
1572
+ structure: {
1573
+ wheel01: {
1574
+ size: 4,
1575
+ description: "Wheel 01 sensor ID (4-byte, little-endian)"
1576
+ },
1577
+ wheel02: {
1578
+ size: 4,
1579
+ description: "Wheel 02 sensor ID (4-byte, little-endian)"
1580
+ },
1581
+ wheel03: {
1582
+ size: 4,
1583
+ description: "Wheel 03 sensor ID (4-byte, little-endian)"
1584
+ },
1585
+ wheel04: {
1586
+ size: 4,
1587
+ description: "Wheel 04 sensor ID (4-byte, little-endian)"
1588
+ },
1589
+ wheel05: {
1590
+ size: 4,
1591
+ description: "Wheel 05 sensor ID (4-byte, little-endian)"
1592
+ },
1593
+ wheel06: {
1594
+ size: 4,
1595
+ description: "Wheel 06 sensor ID (4-byte, little-endian), left-outer position"
1596
+ },
1597
+ wheel07: {
1598
+ size: 4,
1599
+ description: "Wheel 07 sensor ID (4-byte, little-endian), left-inner position"
1600
+ },
1601
+ wheel08: {
1602
+ size: 4,
1603
+ description: "Wheel 08 sensor ID (4-byte, little-endian), center / spare position"
1604
+ },
1605
+ wheel09: {
1606
+ size: 4,
1607
+ description: "Wheel 09 sensor ID (4-byte, little-endian), right-inner position"
1608
+ },
1609
+ wheel10: {
1610
+ size: 4,
1611
+ description: "Wheel 10 sensor ID (4-byte, little-endian), right-outer position"
1612
+ },
1613
+ wheel11: {
1614
+ size: 4,
1615
+ description: "Wheel 11 sensor ID (4-byte, little-endian)"
1616
+ },
1617
+ wheel12: {
1618
+ size: 4,
1619
+ description: "Wheel 12 sensor ID (4-byte, little-endian)"
1620
+ },
1621
+ wheel13: {
1622
+ size: 4,
1623
+ description: "Wheel 13 sensor ID (4-byte, little-endian)"
1624
+ },
1625
+ wheel14: {
1626
+ size: 4,
1627
+ description: "Wheel 14 sensor ID (4-byte, little-endian)"
1628
+ },
1629
+ wheel15: {
1630
+ size: 4,
1631
+ description: "Wheel 15 sensor ID (4-byte, little-endian)"
1632
+ }
1633
+ }
1634
+ },
1635
+ firmwareVersion: {
1636
+ id: [98, 144],
1637
+ name: "firmwareVersion",
1638
+ structure: {
1639
+ bluetoothStackVersion: {
1640
+ size: 20,
1641
+ description: "Bluetooth stack version + bootloader (e.g. BT stack 4.0.0.191)"
1642
+ },
1643
+ configurationDataVersion: {
1644
+ size: 4,
1645
+ description: "Configuration data version"
1646
+ },
1647
+ bleChipFwCompilationDate: {
1648
+ size: 7,
1649
+ description: "BLE chip FW compilation date: second, minute, hour, day, month, year (2-byte, big-endian)"
1650
+ },
1651
+ bluetoothChipFwVersion: {
1652
+ size: 4,
1653
+ description: "Bluetooth chip FW version: major.minor.patch + release type (e.g. 1.2.0 Release)"
1654
+ }
1655
+ }
1567
1656
  }
1568
1657
  };
1569
1658
 
@@ -1973,12 +2062,13 @@ const bridgeCommands = {
1973
2062
  );
1974
2063
  return await this.writeCommand(deviceData, commandIds$1.writeData, subCommandIds.autolearnIdStatus, payload);
1975
2064
  },
1976
- async getAutolearnUnknownSensors(device) {
1977
- const result = await this.readCommand(device, subCommandIds.autolearnUnknownSensors);
2065
+ async getAutolearnUnknownSensors(deviceId) {
2066
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2067
+ const result = await this.readCommand(deviceData, subCommandIds.autolearnUnknownSensors);
1978
2068
  const structurized = bridgeTools.convertBytesToStructure(
1979
2069
  bridgeCommandStructures.autolearnUnknownSensors.structure,
1980
2070
  result.data,
1981
- device.advertisingData.fwVersion
2071
+ deviceData.advertisingData.fwVersion
1982
2072
  );
1983
2073
  return { ...structurized, isFactory: result.isFactory };
1984
2074
  },
@@ -2049,6 +2139,18 @@ const bridgeCommands = {
2049
2139
  );
2050
2140
  return structurizedData;
2051
2141
  },
2142
+ async getFirmwareVersion(deviceId) {
2143
+ const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2144
+ const result = await this.readCommand(deviceData, subCommandIds.firmwareVersion, {
2145
+ headerLength: 5,
2146
+ footerLength: 0
2147
+ });
2148
+ return bridgeTools.convertBytesToStructure(
2149
+ bridgeCommandStructures.firmwareVersion.structure,
2150
+ result.data,
2151
+ deviceData.advertisingData.fwVersion
2152
+ );
2153
+ },
2052
2154
  async getSensorMeasurement(deviceId, positionId) {
2053
2155
  const deviceData = bridgeTools.getBridgeFromStore(deviceId);
2054
2156
  const isSpare = String(positionId).endsWith("0");
@@ -2062,7 +2164,7 @@ const bridgeCommands = {
2062
2164
  const result = await this.writeCommand(deviceData, commandIds$1.sensorMeasurement, subCommandId, []);
2063
2165
  return result;
2064
2166
  },
2065
- async readCommand(device, subCommandId) {
2167
+ async readCommand(device, subCommandId, { headerLength = 19, footerLength = 8 } = {}) {
2066
2168
  const commandLength = 2;
2067
2169
  const result = await this.promisify(device, [
2068
2170
  ...this.getCommandHeader(device),
@@ -2070,9 +2172,9 @@ const bridgeCommands = {
2070
2172
  commandIds$1.readData,
2071
2173
  subCommandId
2072
2174
  ]);
2073
- const data = result.slice(19, result.length - 8);
2074
- const crc = result.slice(result.length - 8, result.length - 4);
2075
- const isFactory = crc.every((n) => n === 0);
2175
+ const data = result.slice(headerLength, result.length - footerLength);
2176
+ const crc = result.slice(result.length - footerLength, result.length - footerLength + 4);
2177
+ const isFactory = crc.length === 4 && crc.every((n) => n === 0);
2076
2178
  return { data, isFactory };
2077
2179
  },
2078
2180
  async writeCommand(device, commandId, subCommandId, payload) {
@@ -2209,7 +2311,7 @@ async function setVehicleLayout(deviceId, tcVehicle) {
2209
2311
  }
2210
2312
  await bridgeCommands.setVehicleLayout(deviceId, result);
2211
2313
  }
2212
- async function getConfiguration(deviceId) {
2314
+ async function getConfiguration(deviceId, includeVehicleData = false) {
2213
2315
  const customerCANSettings = await bridgeCommands.getCustomerCANSettings(deviceId);
2214
2316
  const workshopCANSettings = await bridgeCommands.getWorkshopCANSettings(deviceId);
2215
2317
  const customerPressureThresholds = await bridgeCommands.getCustomerPressureThresholds(deviceId);
@@ -2220,7 +2322,7 @@ async function getConfiguration(deviceId) {
2220
2322
  if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
2221
2323
  autolearnSettings = await bridgeCommands.getAutolearnSettings(deviceId);
2222
2324
  }
2223
- return {
2325
+ const configuration = {
2224
2326
  customerCANSettings,
2225
2327
  workshopCANSettings,
2226
2328
  customerPressureThresholds,
@@ -2229,6 +2331,24 @@ async function getConfiguration(deviceId) {
2229
2331
  pressuresPerAxle,
2230
2332
  autolearnSettings
2231
2333
  };
2334
+ if (includeVehicleData) {
2335
+ configuration.vehicleLayout = await bridgeCommands.getVehicleLayout(deviceId);
2336
+ configuration.axleInfo = [];
2337
+ for (let axleIndex = 0; axleIndex < 15; axleIndex++) {
2338
+ const axleBytes = await bridgeCommands.getAxleInfo(deviceId, axleIndex);
2339
+ configuration.axleInfo.push(
2340
+ bridgeTools.convertBytesToStructure(bridgeCommandStructures.idsPerWheel.structure, axleBytes)
2341
+ );
2342
+ }
2343
+ if (bridgeTools.isVersionGreaterThan(deviceId, "1.1.F")) {
2344
+ configuration.firmwareVersion = await bridgeCommands.getFirmwareVersion(deviceId);
2345
+ }
2346
+ if (bridgeTools.isVersionGreaterThan(deviceId, "0.9.7")) {
2347
+ configuration.autolearnIdStatus = await bridgeCommands.getAutolearnIdStatus(deviceId);
2348
+ configuration.autolearnUnknownSensors = await bridgeCommands.getAutolearnUnknownSensors(deviceId);
2349
+ }
2350
+ }
2351
+ return configuration;
2232
2352
  }
2233
2353
  function bridgeVehiclesDifference(original, change) {
2234
2354
  const differences = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirecheck-device-sdk",
3
- "version": "0.2.65",
3
+ "version": "0.2.66",
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",