tirecheck-device-sdk 0.2.29 → 0.2.30

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
@@ -2750,30 +2750,6 @@ async function disconnect(deviceId, reason) {
2750
2750
  store.setState(deviceId, void 0, reason ?? "manualDisconnection");
2751
2751
  }
2752
2752
 
2753
- const callbacks = {};
2754
- const simulatorSvc = {
2755
- registerEvent(eventName, callback) {
2756
- callbacks[eventName] = callback;
2757
- },
2758
- triggerEvent(eventName, deviceId, payload) {
2759
- if (payload === void 0) {
2760
- const simulatedDevice = store.simulatedDevices[deviceId];
2761
- if (!simulatedDevice) throw new Error(`Device not found`);
2762
- payload = simulatedDevice.simulatorData?.events?.[eventName];
2763
- if (!payload) throw new Error(`Event not found`);
2764
- }
2765
- const callback = callbacks[eventName];
2766
- if (!callback) {
2767
- console.warn(`Event ${eventName} not registered`);
2768
- } else {
2769
- callback(deviceId, payload);
2770
- }
2771
- },
2772
- merge(deviceTemplate, initialData) {
2773
- return ___default.mergeWith({}, deviceTemplate, initialData, (a, b) => ___default.isArray(b) ? b : void 0);
2774
- }
2775
- };
2776
-
2777
2753
  const devicePromiseQueue = {};
2778
2754
  const deviceCurrentResolve = {};
2779
2755
  const deviceCurrentReject = {};
@@ -2828,6 +2804,30 @@ const promiseQueue = {
2828
2804
  }
2829
2805
  };
2830
2806
 
2807
+ const callbacks = {};
2808
+ const simulatorSvc = {
2809
+ registerEvent(eventName, callback) {
2810
+ callbacks[eventName] = callback;
2811
+ },
2812
+ triggerEvent(eventName, deviceId, payload) {
2813
+ if (payload === void 0) {
2814
+ const simulatedDevice = store.simulatedDevices[deviceId];
2815
+ if (!simulatedDevice) throw new Error(`Device not found`);
2816
+ payload = simulatedDevice.simulatorData?.events?.[eventName];
2817
+ if (!payload) throw new Error(`Event not found`);
2818
+ }
2819
+ const callback = callbacks[eventName];
2820
+ if (!callback) {
2821
+ console.warn(`Event ${eventName} not registered`);
2822
+ } else {
2823
+ callback(deviceId, payload);
2824
+ }
2825
+ },
2826
+ merge(deviceTemplate, initialData) {
2827
+ return ___default.mergeWith({}, deviceTemplate, initialData, (a, b) => ___default.isArray(b) ? b : void 0);
2828
+ }
2829
+ };
2830
+
2831
2831
  const flexiGaugeTpmsSecurity = {
2832
2832
  getCommandsSignature(seed) {
2833
2833
  const key = store.securityKeys?.flexiGaugeTpms?.signatureKeys.allLFCommands;
@@ -3026,7 +3026,7 @@ const flexiGaugeTpmsService = {
3026
3026
  }
3027
3027
  flexiGaugeTpmsCommands.processMessage(deviceId, message);
3028
3028
  },
3029
- programSensor,
3029
+ setSensorDisplayId,
3030
3030
  getFirmwareVersion
3031
3031
  };
3032
3032
  function processTreadDepth(deviceId, value) {
@@ -3066,7 +3066,7 @@ function processTpms(deviceId, value) {
3066
3066
  simulatorSvc.triggerEvent("fg:tpms", deviceId, strongestReading);
3067
3067
  }
3068
3068
  }
3069
- async function programSensor(deviceId, oldSensorId, newSensorId) {
3069
+ async function setSensorDisplayId(deviceId, oldSensorId, newSensorId) {
3070
3070
  const fw = await getFirmwareVersion(deviceId);
3071
3071
  if (fw < "1.4.4") throw new Error("Programming sensors is not supported on this firmware version");
3072
3072
  await findSensor(deviceId, oldSensorId);
@@ -3127,6 +3127,7 @@ const flexiGaugeTpms = {
3127
3127
  async connect(deviceId) {
3128
3128
  const fgMeta = deviceMeta.flexiGaugeTpms;
3129
3129
  await bluetooth.connect(deviceId, this.disconnect);
3130
+ await promiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3130
3131
  await ble.startNotification(
3131
3132
  deviceId,
3132
3133
  fgMeta.communication.serviceId,
@@ -3138,6 +3139,7 @@ const flexiGaugeTpms = {
3138
3139
  },
3139
3140
  async disconnect(deviceId, reason) {
3140
3141
  store.setState(deviceId, "disconnecting");
3142
+ await promiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3141
3143
  await bluetooth.disconnect(deviceId);
3142
3144
  store.setState(deviceId, void 0, reason ?? "manualDisconnection");
3143
3145
  },
@@ -3147,7 +3149,8 @@ const flexiGaugeTpms = {
3147
3149
  getBattery: flexiGaugeTpmsService.getBattery,
3148
3150
  getFirmwareVersion: flexiGaugeTpmsService.getFirmwareVersion,
3149
3151
  startTpmsScan: flexiGaugeTpmsService.startTpmsScan,
3150
- programSensor: flexiGaugeTpmsService.programSensor
3152
+ setSensorDisplayId: flexiGaugeTpmsService.setSensorDisplayId,
3153
+ resetSensorDisplayId: (deviceId, sensorId) => flexiGaugeTpmsService.setSensorDisplayId(deviceId, sensorId, "00000000")
3151
3154
  };
3152
3155
 
3153
3156
  const capabilities = [
@@ -3821,13 +3824,16 @@ const flexiGaugeTpmsSimulator = {
3821
3824
  await toolsSvc.delay(200);
3822
3825
  return fg.simulatorData.battery;
3823
3826
  },
3827
+ setSensorDisplayId(deviceId, oldSensorId, newSensorId) {
3828
+ return new Promise((resolve) => resolve());
3829
+ },
3830
+ resetSensorDisplayId(deviceId, sensorId) {
3831
+ return new Promise((resolve) => resolve());
3832
+ },
3824
3833
  async getFirmwareVersion(deviceId) {
3825
3834
  await toolsSvc.delay(100);
3826
3835
  return "9.9.9";
3827
3836
  },
3828
- programSensor(deviceId, oldSensorId, newSensorId) {
3829
- return new Promise((resolve) => resolve());
3830
- },
3831
3837
  onButtonPress(callback) {
3832
3838
  },
3833
3839
  onTpms(callback) {
package/dist/index.d.cts CHANGED
@@ -929,7 +929,8 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
929
929
  getBattery: (deviceId: string) => Promise<number>;
930
930
  getFirmwareVersion: (deviceId: string) => Promise<string>;
931
931
  startTpmsScan: (deviceId: string) => void;
932
- programSensor: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
932
+ setSensorDisplayId: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
933
+ resetSensorDisplayId: (deviceId: string, sensorId: string) => Promise<void>;
933
934
  };
934
935
  /** Methods for working with Tirecheck Pressure Stick */
935
936
  pressureStick: {
package/dist/index.d.mts CHANGED
@@ -929,7 +929,8 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
929
929
  getBattery: (deviceId: string) => Promise<number>;
930
930
  getFirmwareVersion: (deviceId: string) => Promise<string>;
931
931
  startTpmsScan: (deviceId: string) => void;
932
- programSensor: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
932
+ setSensorDisplayId: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
933
+ resetSensorDisplayId: (deviceId: string, sensorId: string) => Promise<void>;
933
934
  };
934
935
  /** Methods for working with Tirecheck Pressure Stick */
935
936
  pressureStick: {
package/dist/index.d.ts CHANGED
@@ -929,7 +929,8 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
929
929
  getBattery: (deviceId: string) => Promise<number>;
930
930
  getFirmwareVersion: (deviceId: string) => Promise<string>;
931
931
  startTpmsScan: (deviceId: string) => void;
932
- programSensor: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
932
+ setSensorDisplayId: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
933
+ resetSensorDisplayId: (deviceId: string, sensorId: string) => Promise<void>;
933
934
  };
934
935
  /** Methods for working with Tirecheck Pressure Stick */
935
936
  pressureStick: {
package/dist/index.mjs CHANGED
@@ -2743,30 +2743,6 @@ async function disconnect(deviceId, reason) {
2743
2743
  store.setState(deviceId, void 0, reason ?? "manualDisconnection");
2744
2744
  }
2745
2745
 
2746
- const callbacks = {};
2747
- const simulatorSvc = {
2748
- registerEvent(eventName, callback) {
2749
- callbacks[eventName] = callback;
2750
- },
2751
- triggerEvent(eventName, deviceId, payload) {
2752
- if (payload === void 0) {
2753
- const simulatedDevice = store.simulatedDevices[deviceId];
2754
- if (!simulatedDevice) throw new Error(`Device not found`);
2755
- payload = simulatedDevice.simulatorData?.events?.[eventName];
2756
- if (!payload) throw new Error(`Event not found`);
2757
- }
2758
- const callback = callbacks[eventName];
2759
- if (!callback) {
2760
- console.warn(`Event ${eventName} not registered`);
2761
- } else {
2762
- callback(deviceId, payload);
2763
- }
2764
- },
2765
- merge(deviceTemplate, initialData) {
2766
- return _.mergeWith({}, deviceTemplate, initialData, (a, b) => _.isArray(b) ? b : void 0);
2767
- }
2768
- };
2769
-
2770
2746
  const devicePromiseQueue = {};
2771
2747
  const deviceCurrentResolve = {};
2772
2748
  const deviceCurrentReject = {};
@@ -2821,6 +2797,30 @@ const promiseQueue = {
2821
2797
  }
2822
2798
  };
2823
2799
 
2800
+ const callbacks = {};
2801
+ const simulatorSvc = {
2802
+ registerEvent(eventName, callback) {
2803
+ callbacks[eventName] = callback;
2804
+ },
2805
+ triggerEvent(eventName, deviceId, payload) {
2806
+ if (payload === void 0) {
2807
+ const simulatedDevice = store.simulatedDevices[deviceId];
2808
+ if (!simulatedDevice) throw new Error(`Device not found`);
2809
+ payload = simulatedDevice.simulatorData?.events?.[eventName];
2810
+ if (!payload) throw new Error(`Event not found`);
2811
+ }
2812
+ const callback = callbacks[eventName];
2813
+ if (!callback) {
2814
+ console.warn(`Event ${eventName} not registered`);
2815
+ } else {
2816
+ callback(deviceId, payload);
2817
+ }
2818
+ },
2819
+ merge(deviceTemplate, initialData) {
2820
+ return _.mergeWith({}, deviceTemplate, initialData, (a, b) => _.isArray(b) ? b : void 0);
2821
+ }
2822
+ };
2823
+
2824
2824
  const flexiGaugeTpmsSecurity = {
2825
2825
  getCommandsSignature(seed) {
2826
2826
  const key = store.securityKeys?.flexiGaugeTpms?.signatureKeys.allLFCommands;
@@ -3019,7 +3019,7 @@ const flexiGaugeTpmsService = {
3019
3019
  }
3020
3020
  flexiGaugeTpmsCommands.processMessage(deviceId, message);
3021
3021
  },
3022
- programSensor,
3022
+ setSensorDisplayId,
3023
3023
  getFirmwareVersion
3024
3024
  };
3025
3025
  function processTreadDepth(deviceId, value) {
@@ -3059,7 +3059,7 @@ function processTpms(deviceId, value) {
3059
3059
  simulatorSvc.triggerEvent("fg:tpms", deviceId, strongestReading);
3060
3060
  }
3061
3061
  }
3062
- async function programSensor(deviceId, oldSensorId, newSensorId) {
3062
+ async function setSensorDisplayId(deviceId, oldSensorId, newSensorId) {
3063
3063
  const fw = await getFirmwareVersion(deviceId);
3064
3064
  if (fw < "1.4.4") throw new Error("Programming sensors is not supported on this firmware version");
3065
3065
  await findSensor(deviceId, oldSensorId);
@@ -3120,6 +3120,7 @@ const flexiGaugeTpms = {
3120
3120
  async connect(deviceId) {
3121
3121
  const fgMeta = deviceMeta.flexiGaugeTpms;
3122
3122
  await bluetooth.connect(deviceId, this.disconnect);
3123
+ await promiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3123
3124
  await ble.startNotification(
3124
3125
  deviceId,
3125
3126
  fgMeta.communication.serviceId,
@@ -3131,6 +3132,7 @@ const flexiGaugeTpms = {
3131
3132
  },
3132
3133
  async disconnect(deviceId, reason) {
3133
3134
  store.setState(deviceId, "disconnecting");
3135
+ await promiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3134
3136
  await bluetooth.disconnect(deviceId);
3135
3137
  store.setState(deviceId, void 0, reason ?? "manualDisconnection");
3136
3138
  },
@@ -3140,7 +3142,8 @@ const flexiGaugeTpms = {
3140
3142
  getBattery: flexiGaugeTpmsService.getBattery,
3141
3143
  getFirmwareVersion: flexiGaugeTpmsService.getFirmwareVersion,
3142
3144
  startTpmsScan: flexiGaugeTpmsService.startTpmsScan,
3143
- programSensor: flexiGaugeTpmsService.programSensor
3145
+ setSensorDisplayId: flexiGaugeTpmsService.setSensorDisplayId,
3146
+ resetSensorDisplayId: (deviceId, sensorId) => flexiGaugeTpmsService.setSensorDisplayId(deviceId, sensorId, "00000000")
3144
3147
  };
3145
3148
 
3146
3149
  const capabilities = [
@@ -3814,13 +3817,16 @@ const flexiGaugeTpmsSimulator = {
3814
3817
  await toolsSvc.delay(200);
3815
3818
  return fg.simulatorData.battery;
3816
3819
  },
3820
+ setSensorDisplayId(deviceId, oldSensorId, newSensorId) {
3821
+ return new Promise((resolve) => resolve());
3822
+ },
3823
+ resetSensorDisplayId(deviceId, sensorId) {
3824
+ return new Promise((resolve) => resolve());
3825
+ },
3817
3826
  async getFirmwareVersion(deviceId) {
3818
3827
  await toolsSvc.delay(100);
3819
3828
  return "9.9.9";
3820
3829
  },
3821
- programSensor(deviceId, oldSensorId, newSensorId) {
3822
- return new Promise((resolve) => resolve());
3823
- },
3824
3830
  onButtonPress(callback) {
3825
3831
  },
3826
3832
  onTpms(callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirecheck-device-sdk",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
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",