incyclist-devices 1.5.17 → 1.5.19
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/lib/antv2/fe.d.ts
CHANGED
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 }
|
package/lib/daum/DaumAdapter.js
CHANGED
|
@@ -204,6 +204,8 @@ class DaumAdapterBase extends device_1.default {
|
|
|
204
204
|
this.logger.logEvent(event);
|
|
205
205
|
}
|
|
206
206
|
stop() {
|
|
207
|
+
if (this.stopped)
|
|
208
|
+
return Promise.resolve(true);
|
|
207
209
|
this.logEvent({ message: 'stop request' });
|
|
208
210
|
this.stopped = true;
|
|
209
211
|
return new Promise((resolve, reject) => {
|
|
@@ -241,7 +243,7 @@ class DaumAdapterBase extends device_1.default {
|
|
|
241
243
|
}
|
|
242
244
|
sendUpdate(request) {
|
|
243
245
|
return __awaiter(this, void 0, void 0, function* () {
|
|
244
|
-
if (this.paused)
|
|
246
|
+
if (this.paused || this.stopped)
|
|
245
247
|
return;
|
|
246
248
|
this.logEvent({ message: 'sendUpdate', request, waiting: this.requests.length });
|
|
247
249
|
return yield this.processClientRequest(request);
|
|
@@ -253,6 +255,8 @@ class DaumAdapterBase extends device_1.default {
|
|
|
253
255
|
}
|
|
254
256
|
update() {
|
|
255
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
if (this.stopped)
|
|
259
|
+
return;
|
|
256
260
|
this.updateBusy = true;
|
|
257
261
|
this.getCurrentBikeData()
|
|
258
262
|
.then(bikeData => {
|
|
@@ -271,6 +275,8 @@ class DaumAdapterBase extends device_1.default {
|
|
|
271
275
|
}
|
|
272
276
|
sendRequests() {
|
|
273
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
if (this.stopped)
|
|
279
|
+
return;
|
|
274
280
|
if (this.requests.length > 0) {
|
|
275
281
|
const processing = [...this.requests];
|
|
276
282
|
const cnt = processing.length;
|
|
@@ -294,7 +300,7 @@ class DaumAdapterBase extends device_1.default {
|
|
|
294
300
|
}
|
|
295
301
|
bikeSync() {
|
|
296
302
|
return __awaiter(this, void 0, void 0, function* () {
|
|
297
|
-
if (this.paused) {
|
|
303
|
+
if (this.paused || this.stopped) {
|
|
298
304
|
return;
|
|
299
305
|
}
|
|
300
306
|
if (this.updateBusy || this.requestBusy) {
|
|
@@ -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();
|
|
@@ -137,7 +137,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
performStart(props = {}) {
|
|
140
|
+
performStart(props = {}, isRelaunch = false) {
|
|
141
141
|
this.stop();
|
|
142
142
|
const { user, bikeSettings } = props;
|
|
143
143
|
if (user && user.weight)
|
|
@@ -148,7 +148,7 @@ class DaumClassicAdapter extends DaumAdapter_1.default {
|
|
|
148
148
|
let startState = {};
|
|
149
149
|
return (0, utils_1.runWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
150
150
|
try {
|
|
151
|
-
if (!this.bike.isConnected())
|
|
151
|
+
if (!isRelaunch && !this.bike.isConnected())
|
|
152
152
|
yield this.bike.saveConnect();
|
|
153
153
|
yield this.getBike().resetDevice();
|
|
154
154
|
if (!startState.setProg) {
|
package/lib/daum/classic/bike.js
CHANGED
|
@@ -76,10 +76,12 @@ class Daum8008 {
|
|
|
76
76
|
return 10;
|
|
77
77
|
}
|
|
78
78
|
connect() {
|
|
79
|
-
this.logEvent({ message: "connect()", port: this.getPort(), sp: (this.sp !== undefined), });
|
|
79
|
+
this.logEvent({ message: "connect()", port: this.getPort(), isConnected: this.connected, sp: (this.sp !== undefined), });
|
|
80
80
|
if (this.closing || this.opening) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
+
if (this.connected)
|
|
84
|
+
return;
|
|
83
85
|
try {
|
|
84
86
|
if (this.sp === undefined) {
|
|
85
87
|
const settings = this.settings.port || {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-devices",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.19",
|
|
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.
|
|
9
|
+
"incyclist-ant-plus": "^0.1.10",
|
|
10
10
|
"win32filetime": "^1.0.2"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|