incyclist-devices 1.5.17 → 1.5.18
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/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) {
|
|
@@ -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 || {};
|