incyclist-devices 2.1.30 → 2.1.31

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.
@@ -415,7 +415,7 @@ class AntAdapter extends adpater_1.default {
415
415
  yield (0, utils_1.sleep)(20);
416
416
  }
417
417
  try {
418
- stopped = yield this.ant.stopSensor(this.sensor);
418
+ stopped = yield (0, utils_1.runWithTimeout)(this.ant.stopSensor(this.sensor), 5000);
419
419
  }
420
420
  catch (err) {
421
421
  this.logEvent({ message: 'stop sensor failed', reason: err.message });
@@ -116,12 +116,14 @@ class AntInterface extends events_1.default {
116
116
  else
117
117
  promises.push(c.channel.stopAllSensors());
118
118
  });
119
- yield Promise.allSettled(promises);
119
+ yield (0, utils_1.waitWithTimeout)(Promise.allSettled(promises), 2000, () => {
120
+ this.logEvent({ message: 'ANT+ disconnect timeout' });
121
+ });
120
122
  yield (0, utils_1.sleep)(200);
121
123
  }
122
124
  if (this.device) {
123
125
  try {
124
- closed = yield this.device.close();
126
+ closed = yield (0, utils_1.runWithTimeout)(this.device.close(), 1000);
125
127
  }
126
128
  catch (_a) {
127
129
  closed = false;
@@ -133,6 +135,7 @@ class AntInterface extends events_1.default {
133
135
  }
134
136
  catch (err) {
135
137
  this.logEvent({ message: 'Error', fn: '', error: err.message, stack: err.stack });
138
+ closed = false;
136
139
  }
137
140
  this.logEvent({ message: 'ANT+ disconnected' });
138
141
  this.connectPromise = null;
@@ -227,9 +227,12 @@ class AntFEAdapter extends adapter_1.default {
227
227
  stop: { get: () => super.stop }
228
228
  });
229
229
  return __awaiter(this, void 0, void 0, function* () {
230
+ if (this.promiseStop)
231
+ return yield this.promiseStop;
230
232
  this.promiseStop = _super.stop.call(this);
231
233
  this.sensorConnected = false;
232
234
  const stopped = yield this.promiseStop;
235
+ delete this.promiseStop;
233
236
  return stopped;
234
237
  });
235
238
  }
@@ -12,7 +12,7 @@ class InterfaceFactory {
12
12
  switch (ifaceName) {
13
13
  case device_1.INTERFACE.SERIAL:
14
14
  case device_1.INTERFACE.TCPIP:
15
- const serialProps = props;
15
+ const serialProps = (props || {});
16
16
  serialProps.ifaceName = ifaceName;
17
17
  return serial_1.SerialInterface.getInstance(serialProps);
18
18
  case device_1.INTERFACE.ANT:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "2.1.30",
3
+ "version": "2.1.31",
4
4
  "dependencies": {
5
5
  "@serialport/bindings-interface": "^1.2.2",
6
6
  "@serialport/parser-byte-length": "^9.0.1",