tirecheck-device-sdk 0.2.36 → 0.2.38

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
@@ -771,14 +771,12 @@ function processDevice(device) {
771
771
  return processedDevice;
772
772
  }
773
773
  function getDeviceTypeFromName(name) {
774
- let deviceType;
775
774
  for (const key in deviceMeta) {
776
775
  const meta = deviceMeta[key];
777
776
  if (meta.nameRegex.test(name)) {
778
- deviceType = key;
777
+ return key;
779
778
  }
780
779
  }
781
- return deviceType;
782
780
  }
783
781
  function getDeviceName(device) {
784
782
  const isBridge = deviceMeta.bridge.nameRegex.test(device.name) || deviceMeta.bridgeOta.nameRegex.test(device.name);
@@ -2813,7 +2811,7 @@ const capabilities$2 = [
2813
2811
  {
2814
2812
  id: "button",
2815
2813
  processFn: processButtonPress$1,
2816
- regex: /^[UDLRC]$/
2814
+ regex: /^\*?[UDLRC]\s?$/
2817
2815
  },
2818
2816
  {
2819
2817
  id: "keepAlive",
@@ -2850,8 +2848,9 @@ function processKeepAlive(deviceId) {
2850
2848
  flexiGaugeCommands.sendKeepAlive(deviceId);
2851
2849
  }
2852
2850
  function processTreadDepth$1(deviceId, value) {
2853
- const treadDepth = value.match(/\d+/)?.[0];
2854
- const convertedValue = Number(treadDepth) / 1e3;
2851
+ const isNewFormat = value.includes("TD");
2852
+ const treadDepth = isNewFormat ? value.match(/\d+/)?.[0] : value.match(/T(\d+\.\d+)m/)?.[1];
2853
+ const convertedValue = Number(treadDepth) / (isNewFormat ? 1e3 : 1);
2855
2854
  simulatorSvc.triggerEvent("fg:treadDepth", deviceId, convertedValue);
2856
2855
  }
2857
2856
  function processButtonPress$1(deviceId, value) {
package/dist/index.mjs CHANGED
@@ -764,14 +764,12 @@ function processDevice(device) {
764
764
  return processedDevice;
765
765
  }
766
766
  function getDeviceTypeFromName(name) {
767
- let deviceType;
768
767
  for (const key in deviceMeta) {
769
768
  const meta = deviceMeta[key];
770
769
  if (meta.nameRegex.test(name)) {
771
- deviceType = key;
770
+ return key;
772
771
  }
773
772
  }
774
- return deviceType;
775
773
  }
776
774
  function getDeviceName(device) {
777
775
  const isBridge = deviceMeta.bridge.nameRegex.test(device.name) || deviceMeta.bridgeOta.nameRegex.test(device.name);
@@ -2806,7 +2804,7 @@ const capabilities$2 = [
2806
2804
  {
2807
2805
  id: "button",
2808
2806
  processFn: processButtonPress$1,
2809
- regex: /^[UDLRC]$/
2807
+ regex: /^\*?[UDLRC]\s?$/
2810
2808
  },
2811
2809
  {
2812
2810
  id: "keepAlive",
@@ -2843,8 +2841,9 @@ function processKeepAlive(deviceId) {
2843
2841
  flexiGaugeCommands.sendKeepAlive(deviceId);
2844
2842
  }
2845
2843
  function processTreadDepth$1(deviceId, value) {
2846
- const treadDepth = value.match(/\d+/)?.[0];
2847
- const convertedValue = Number(treadDepth) / 1e3;
2844
+ const isNewFormat = value.includes("TD");
2845
+ const treadDepth = isNewFormat ? value.match(/\d+/)?.[0] : value.match(/T(\d+\.\d+)m/)?.[1];
2846
+ const convertedValue = Number(treadDepth) / (isNewFormat ? 1e3 : 1);
2848
2847
  simulatorSvc.triggerEvent("fg:treadDepth", deviceId, convertedValue);
2849
2848
  }
2850
2849
  function processButtonPress$1(deviceId, value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirecheck-device-sdk",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
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",