incyclist-devices 2.3.15-beta.1 → 2.3.15
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.
|
@@ -391,7 +391,6 @@ class BleInterface extends events_1.default {
|
|
|
391
391
|
if (announcement.name.includes('KICKR')) {
|
|
392
392
|
const supported = announcement.serviceUUIDs.map(s => (0, utils_1.beautifyUUID)(s));
|
|
393
393
|
if (supported.length === 1 && (supported[0] === '1818' || supported[0] === 'FC82')) {
|
|
394
|
-
this.logEvent({ message: 'wahoo enhancement detected', name: announcement.name, supported });
|
|
395
394
|
return true;
|
|
396
395
|
}
|
|
397
396
|
}
|
|
@@ -533,7 +532,6 @@ class BleInterface extends events_1.default {
|
|
|
533
532
|
}
|
|
534
533
|
addService(service) {
|
|
535
534
|
try {
|
|
536
|
-
this.logEvent({ message: 'ble peripheral announced', service });
|
|
537
535
|
const isSuported = this.isSupportedPeripheral(service);
|
|
538
536
|
if (!isSuported) {
|
|
539
537
|
return;
|
|
@@ -238,7 +238,6 @@ class DirectConnectInterface extends events_1.default {
|
|
|
238
238
|
try {
|
|
239
239
|
service.transport = this.getName();
|
|
240
240
|
const existing = this.find(service);
|
|
241
|
-
this.logEvent({ message: 'wifi service announced', device: service.name, announcement: service, source, existing, interface: 'wifi' });
|
|
242
241
|
if (existing) {
|
|
243
242
|
const idx = this.services.indexOf(existing);
|
|
244
243
|
this.services[idx] = { ts: Date.now(), service };
|
|
@@ -52,7 +52,7 @@ export default class DaumAdapter<S extends SerialDeviceSettings, P extends Devic
|
|
|
52
52
|
logEvent(event: any): void;
|
|
53
53
|
stop(): Promise<boolean>;
|
|
54
54
|
sendUpdate(request: any): Promise<UpdateRequest | void>;
|
|
55
|
-
update():
|
|
55
|
+
update(): void;
|
|
56
56
|
sendRequests(): Promise<void>;
|
|
57
57
|
bikeSync(): Promise<void>;
|
|
58
58
|
updateData(bikeData: IncyclistBikeData): IncyclistBikeData;
|
|
@@ -131,13 +131,13 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
131
131
|
const resumed = yield _super.resume.call(this);
|
|
132
132
|
(_a = this.comms) === null || _a === void 0 ? void 0 : _a.resume();
|
|
133
133
|
if (startUpdatePull)
|
|
134
|
-
|
|
134
|
+
this.startUpdatePull();
|
|
135
135
|
return resumed;
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
waitForPrevCheckFinished() {
|
|
139
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
if (this.checkPromise) {
|
|
140
|
+
if (this.checkPromise !== undefined && this.checkPromise !== null) {
|
|
141
141
|
this.logEvent({ message: "waiting for previous check device", port: this.getPort() });
|
|
142
142
|
try {
|
|
143
143
|
yield this.checkPromise;
|
|
@@ -173,7 +173,7 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
173
173
|
}
|
|
174
174
|
waitForPrevStartFinished() {
|
|
175
175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
if (this.startPromise) {
|
|
176
|
+
if (this.startPromise !== undefined && this.startPromise !== null) {
|
|
177
177
|
this.logEvent({ message: "waiting for previous device launch", port: this.getPort() });
|
|
178
178
|
try {
|
|
179
179
|
yield this.startPromise;
|
|
@@ -239,10 +239,7 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
239
239
|
return;
|
|
240
240
|
this.logEvent({ message: 'start update pull', port: this.getPort() });
|
|
241
241
|
const ivSync = setInterval(() => {
|
|
242
|
-
|
|
243
|
-
this.bikeSync();
|
|
244
|
-
}
|
|
245
|
-
catch (_a) { }
|
|
242
|
+
this.bikeSync().catch();
|
|
246
243
|
}, this.pullFrequency);
|
|
247
244
|
const ivUpdate = setInterval(() => {
|
|
248
245
|
try {
|
|
@@ -273,7 +270,8 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
273
270
|
}
|
|
274
271
|
stopUpdatePull() {
|
|
275
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
|
|
273
|
+
var _a;
|
|
274
|
+
if (!((_a = this.iv) === null || _a === void 0 ? void 0 : _a.emitter))
|
|
277
275
|
return;
|
|
278
276
|
return new Promise(done => {
|
|
279
277
|
this.iv.emitter.on('stop-done', () => {
|
|
@@ -373,26 +371,24 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
373
371
|
});
|
|
374
372
|
}
|
|
375
373
|
update() {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
374
|
+
if (!this.canEmitData() || this.updateBusy)
|
|
375
|
+
return;
|
|
376
|
+
this.updateBusy = true;
|
|
377
|
+
this.getCurrentBikeData()
|
|
378
|
+
.then(bikeData => {
|
|
379
|
+
const incyclistData = this.updateData(bikeData);
|
|
380
|
+
const data = this.transformData(incyclistData);
|
|
381
|
+
this.updateBusy = false;
|
|
382
|
+
this.emitData(data);
|
|
383
|
+
})
|
|
384
|
+
.catch(err => {
|
|
380
385
|
try {
|
|
381
|
-
|
|
382
|
-
const incyclistData = this.updateData(
|
|
383
|
-
|
|
384
|
-
this.updateBusy = false;
|
|
385
|
-
this.emitData(data);
|
|
386
|
-
}
|
|
387
|
-
catch (err) {
|
|
388
|
-
try {
|
|
389
|
-
this.logEvent({ message: 'bike update error', port: this.getPort(), error: err.message, stack: err.stack });
|
|
390
|
-
const incyclistData = this.updateData(this.deviceData);
|
|
391
|
-
this.transformData(incyclistData, false);
|
|
392
|
-
}
|
|
393
|
-
catch (_a) { }
|
|
394
|
-
this.updateBusy = false;
|
|
386
|
+
this.logEvent({ message: 'bike update error', port: this.getPort(), error: err.message, stack: err.stack });
|
|
387
|
+
const incyclistData = this.updateData(this.deviceData);
|
|
388
|
+
this.transformData(incyclistData, false);
|
|
395
389
|
}
|
|
390
|
+
catch (_a) { }
|
|
391
|
+
this.updateBusy = false;
|
|
396
392
|
});
|
|
397
393
|
}
|
|
398
394
|
sendRequests() {
|
|
@@ -428,7 +424,7 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
428
424
|
if (!((_a = this.iv) === null || _a === void 0 ? void 0 : _a.stopRequested))
|
|
429
425
|
yield this.sendRequests();
|
|
430
426
|
if (!((_b = this.iv) === null || _b === void 0 ? void 0 : _b.stopRequested))
|
|
431
|
-
|
|
427
|
+
this.update();
|
|
432
428
|
if ((_c = this.iv) === null || _c === void 0 ? void 0 : _c.stopRequested) {
|
|
433
429
|
this.iv.emitter.emit('stop-done', 'bikeSync');
|
|
434
430
|
}
|
|
@@ -518,12 +514,15 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
518
514
|
if (request.slope !== undefined) {
|
|
519
515
|
this.deviceData.slope = request.slope;
|
|
520
516
|
}
|
|
521
|
-
return new Promise((resolve) =>
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
517
|
+
return new Promise((resolve) => {
|
|
518
|
+
const fn = () => __awaiter(this, void 0, void 0, function* () {
|
|
519
|
+
let bikeRequest = this.getCyclingMode().sendBikeUpdate(request);
|
|
520
|
+
this.logEvent({ message: 'add request', request: bikeRequest });
|
|
521
|
+
this.requests.push(bikeRequest);
|
|
522
|
+
resolve(bikeRequest);
|
|
523
|
+
});
|
|
524
|
+
fn();
|
|
525
|
+
});
|
|
527
526
|
}
|
|
528
527
|
getDeviceInfo() {
|
|
529
528
|
return __awaiter(this, void 0, void 0, function* () {
|