incyclist-devices 1.5.18 → 1.5.20

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.
@@ -97,7 +97,6 @@ class AntAdapter extends device_1.default {
97
97
  if (this.ivDataTimeout)
98
98
  return;
99
99
  this.ivDataTimeout = setInterval(() => {
100
- console.log('~~~ check', this.lastDataTS);
101
100
  if (!this.lastDataTS)
102
101
  return;
103
102
  if (this.lastDataTS + NO_DATA_TIMEOUT < Date.now()) {
@@ -64,7 +64,7 @@ class AntInterface extends events_1.default {
64
64
  const device = new this.Binding(Object.assign(Object.assign({}, this.props), { logger: this.logger }));
65
65
  const opened = yield device.open();
66
66
  if (!opened) {
67
- this.logEvent({ message: 'could not connect' });
67
+ this.logEvent({ message: 'ANT+ not connected' });
68
68
  this.isConnecting = false;
69
69
  return false;
70
70
  }
package/lib/antv2/fe.d.ts CHANGED
@@ -25,5 +25,6 @@ export default class AntFEAdapter extends AntAdapter {
25
25
  mapData(deviceData: any): IncyclistBikeData;
26
26
  transformData(bikeData: any): any;
27
27
  start(props?: any): Promise<any>;
28
+ initTimeoutHandler(): void;
28
29
  stop(): Promise<boolean>;
29
30
  }
package/lib/antv2/fe.js CHANGED
@@ -104,6 +104,9 @@ class AntFEAdapter extends ant_device_1.default {
104
104
  }
105
105
  }
106
106
  catch (err) {
107
+ if (err.message && err.message.toLowerCase() === 'timeout') {
108
+ this.emit('timeout');
109
+ }
107
110
  this.logger.logEvent({ message: 'sendBikeUpdate() error', error: err.message });
108
111
  }
109
112
  });
@@ -220,6 +223,7 @@ class AntFEAdapter extends ant_device_1.default {
220
223
  this.stop();
221
224
  return reject(new Error(`could not start device`));
222
225
  }
226
+ this.initTimeoutHandler();
223
227
  try {
224
228
  const fe = this.sensor;
225
229
  const mode = this.getCyclingMode();
@@ -251,6 +255,10 @@ class AntFEAdapter extends ant_device_1.default {
251
255
  }));
252
256
  });
253
257
  }
258
+ initTimeoutHandler() {
259
+ const fe = this.sensor;
260
+ fe.setSendTimeout(5000);
261
+ }
254
262
  stop() {
255
263
  const _super = Object.create(null, {
256
264
  stop: { get: () => super.stop }
@@ -83,9 +83,9 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
83
83
  try {
84
84
  if (!this.bike.isConnected())
85
85
  yield this.bike.saveConnect();
86
- const address = yield this.bike.getAddress();
86
+ const address = (yield this.bike.getAddress()) || {};
87
87
  info.bikeNo = address.bike;
88
- const version = yield this.bike.getVersion();
88
+ const version = (yield this.bike.getVersion()) || {};
89
89
  info.serialNo = version.serialNo;
90
90
  info.cockpit = version.cockpit;
91
91
  this.setName('Daum ' + info.cockpit);
@@ -117,7 +117,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
117
117
  if (isRelaunch) {
118
118
  yield this.stop();
119
119
  }
120
- yield this.performStart(props);
120
+ yield this.performStart(props, isRelaunch);
121
121
  if (!isRelaunch) {
122
122
  try {
123
123
  const version = yield this.bike.getVersion();
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.5.18",
3
+ "version": "1.5.20",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",
7
7
  "@types/serialport": "^8.0.1",
8
8
  "gd-ant-plus": "^0.0.33",
9
- "incyclist-ant-plus": "^0.1.7",
9
+ "incyclist-ant-plus": "^0.1.12",
10
10
  "win32filetime": "^1.0.2"
11
11
  },
12
12
  "peerDependencies": {