tirecheck-device-sdk 0.2.23 → 0.2.24

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
@@ -3070,6 +3070,7 @@ const torqueWrenchCommands = {
3070
3070
  result = await torqueWrenchPromiseQueue.enqueue(deviceId, twMeta.communication, decimalArray, commandIds[command]);
3071
3071
  } catch (error) {
3072
3072
  const formattedError = formatError(error);
3073
+ torqueWrench.disconnect(deviceId, "lostConnection");
3073
3074
  throw new Error(formattedError);
3074
3075
  }
3075
3076
  return result.map((num) => String.fromCharCode(num)).join("");
@@ -3260,6 +3261,7 @@ const torqueWrench = {
3260
3261
  async connect(deviceId) {
3261
3262
  const twMeta = deviceMeta.torqueWrench;
3262
3263
  await bluetooth.connect(deviceId, this.disconnect);
3264
+ await torqueWrenchPromiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3263
3265
  await ble.startNotification(
3264
3266
  deviceId,
3265
3267
  twMeta.communication.serviceId,
@@ -3276,6 +3278,7 @@ const torqueWrench = {
3276
3278
  async disconnect(deviceId, reason) {
3277
3279
  store.setState(deviceId, "disconnecting");
3278
3280
  await torqueWrenchService.stopJob(deviceId);
3281
+ await torqueWrenchPromiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3279
3282
  await bluetooth.disconnect(deviceId);
3280
3283
  store.setState(deviceId, void 0, reason ?? "manualDisconnection");
3281
3284
  },
package/dist/index.mjs CHANGED
@@ -3063,6 +3063,7 @@ const torqueWrenchCommands = {
3063
3063
  result = await torqueWrenchPromiseQueue.enqueue(deviceId, twMeta.communication, decimalArray, commandIds[command]);
3064
3064
  } catch (error) {
3065
3065
  const formattedError = formatError(error);
3066
+ torqueWrench.disconnect(deviceId, "lostConnection");
3066
3067
  throw new Error(formattedError);
3067
3068
  }
3068
3069
  return result.map((num) => String.fromCharCode(num)).join("");
@@ -3253,6 +3254,7 @@ const torqueWrench = {
3253
3254
  async connect(deviceId) {
3254
3255
  const twMeta = deviceMeta.torqueWrench;
3255
3256
  await bluetooth.connect(deviceId, this.disconnect);
3257
+ await torqueWrenchPromiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3256
3258
  await ble.startNotification(
3257
3259
  deviceId,
3258
3260
  twMeta.communication.serviceId,
@@ -3269,6 +3271,7 @@ const torqueWrench = {
3269
3271
  async disconnect(deviceId, reason) {
3270
3272
  store.setState(deviceId, "disconnecting");
3271
3273
  await torqueWrenchService.stopJob(deviceId);
3274
+ await torqueWrenchPromiseQueue.clearQueue(deviceId, "Previous pending commands aborted");
3272
3275
  await bluetooth.disconnect(deviceId);
3273
3276
  store.setState(deviceId, void 0, reason ?? "manualDisconnection");
3274
3277
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tirecheck-device-sdk",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
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",