incyclist-devices 2.1.28 → 2.1.30
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.
|
@@ -16,6 +16,7 @@ export default class AntFEAdapter extends AntAdapter<FitnessEquipmentSensorState
|
|
|
16
16
|
protected startProps: AntDeviceProperties;
|
|
17
17
|
protected promiseReconnect: Promise<boolean>;
|
|
18
18
|
protected promiseSendUpdate: Promise<boolean>;
|
|
19
|
+
protected promiseStop: Promise<boolean>;
|
|
19
20
|
constructor(settings: AntDeviceSettings, props?: AntDeviceProperties);
|
|
20
21
|
getDisplayName(): string;
|
|
21
22
|
isReconnecting(): boolean;
|
package/lib/antv2/fe/adapter.js
CHANGED
|
@@ -40,6 +40,8 @@ class AntFEAdapter extends adapter_1.default {
|
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
if ((this.paused || this.isReconnecting()) && !forced)
|
|
42
42
|
return;
|
|
43
|
+
if (this.promiseStop)
|
|
44
|
+
return;
|
|
43
45
|
if (this.promiseSendUpdate) {
|
|
44
46
|
this.logEvent({ message: 'send bike update skipped', device: this.getName(), request, reason: 'busy' });
|
|
45
47
|
return;
|
|
@@ -221,9 +223,15 @@ class AntFEAdapter extends adapter_1.default {
|
|
|
221
223
|
fe.setSendTimeout(5000);
|
|
222
224
|
}
|
|
223
225
|
stop() {
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
const _super = Object.create(null, {
|
|
227
|
+
stop: { get: () => super.stop }
|
|
228
|
+
});
|
|
229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
this.promiseStop = _super.stop.call(this);
|
|
231
|
+
this.sensorConnected = false;
|
|
232
|
+
const stopped = yield this.promiseStop;
|
|
233
|
+
return stopped;
|
|
234
|
+
});
|
|
227
235
|
}
|
|
228
236
|
reconnect() {
|
|
229
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -56,7 +56,7 @@ export default class DaumAdapter<S extends SerialDeviceSettings, P extends Devic
|
|
|
56
56
|
sendRequests(): Promise<void>;
|
|
57
57
|
bikeSync(): Promise<void>;
|
|
58
58
|
updateData(bikeData: IncyclistBikeData): IncyclistBikeData;
|
|
59
|
-
transformData(cyclingData: IncyclistBikeData): IncyclistAdapterData;
|
|
59
|
+
transformData(cyclingData: IncyclistBikeData, fromBike?: boolean): IncyclistAdapterData;
|
|
60
60
|
sendRequest(request: any): Promise<any>;
|
|
61
61
|
refreshRequests(): void;
|
|
62
62
|
processClientRequest(request: any): Promise<unknown>;
|
|
@@ -382,7 +382,7 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
382
382
|
try {
|
|
383
383
|
this.logEvent({ message: 'bike update error', port: this.getPort(), error: err.message, stack: err.stack });
|
|
384
384
|
const incyclistData = this.updateData(this.deviceData);
|
|
385
|
-
this.transformData(incyclistData);
|
|
385
|
+
this.transformData(incyclistData, false);
|
|
386
386
|
}
|
|
387
387
|
catch (_a) { }
|
|
388
388
|
this.updateBusy = false;
|
|
@@ -445,7 +445,7 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
445
445
|
this.deviceData = this.getCyclingMode().updateData(data);
|
|
446
446
|
return this.deviceData;
|
|
447
447
|
}
|
|
448
|
-
transformData(cyclingData) {
|
|
448
|
+
transformData(cyclingData, fromBike = true) {
|
|
449
449
|
let distance = 0;
|
|
450
450
|
if (this.distanceInternal !== undefined && cyclingData.distanceInternal !== undefined) {
|
|
451
451
|
distance = cyclingData.distanceInternal - this.distanceInternal;
|
|
@@ -459,10 +459,10 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
459
459
|
cadence: (0, utils_1.intVal)(cyclingData.pedalRpm),
|
|
460
460
|
heartrate: (0, utils_1.intVal)(cyclingData.heartrate),
|
|
461
461
|
distance,
|
|
462
|
-
timestamp: Date.now(),
|
|
463
462
|
deviceTime: cyclingData.time,
|
|
464
463
|
deviceDistanceCounter: cyclingData.distanceInternal
|
|
465
464
|
};
|
|
465
|
+
data.timestamp = fromBike ? Date.now() : this.data.timestamp;
|
|
466
466
|
this.data = data;
|
|
467
467
|
return data;
|
|
468
468
|
}
|
|
@@ -20,6 +20,7 @@ export default class DaumPremiumAdapter extends DaumAdapter<SerialDeviceSettings
|
|
|
20
20
|
performCheck(): Promise<boolean>;
|
|
21
21
|
getStartRetries(): number;
|
|
22
22
|
getStartRetryTimeout(): number;
|
|
23
|
+
restart(pause?: number): Promise<boolean>;
|
|
23
24
|
performStart(props?: DaumPremiumDeviceProperties, _isRelaunch?: boolean, wasPaused?: boolean): Promise<boolean>;
|
|
24
25
|
requiresProgramUpload(): boolean;
|
|
25
26
|
getCurrentBikeData(): Promise<IncyclistBikeData>;
|
|
@@ -122,6 +122,16 @@ class DaumPremiumAdapter extends DaumAdapter_1.default {
|
|
|
122
122
|
getStartRetryTimeout() {
|
|
123
123
|
return START_RETRY_TIMEOUT;
|
|
124
124
|
}
|
|
125
|
+
restart(pause) {
|
|
126
|
+
const _super = Object.create(null, {
|
|
127
|
+
restart: { get: () => super.restart }
|
|
128
|
+
});
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
if (this.requiresProgramUpload())
|
|
131
|
+
return false;
|
|
132
|
+
return yield _super.restart.call(this, pause);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
125
135
|
performStart(props = {}, _isRelaunch = false, wasPaused = false) {
|
|
126
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
137
|
this.setBikeProps(props);
|