incyclist-services 1.0.30 → 1.0.32
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/devices/ride/service.js +15 -0
- package/package.json +1 -1
|
@@ -507,9 +507,24 @@ class DeviceRideService extends events_1.default {
|
|
|
507
507
|
return;
|
|
508
508
|
adapters === null || adapters === void 0 ? void 0 : adapters.forEach(ai => ai.capabilities = ai.adapter.getCapabilities());
|
|
509
509
|
const selectedDevices = this.configurationService.getSelectedDevices();
|
|
510
|
+
if (selectedDevices.find(sd => sd.capability === incyclist_devices_1.IncyclistCapability.Speed) === undefined) {
|
|
511
|
+
const control = selectedDevices.find(sd => sd.capability === incyclist_devices_1.IncyclistCapability.Control);
|
|
512
|
+
if (control) {
|
|
513
|
+
const speed = (0, clone_1.default)(control);
|
|
514
|
+
speed.capability = incyclist_devices_1.IncyclistCapability.Speed;
|
|
515
|
+
selectedDevices.push(speed);
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
const power = selectedDevices.find(sd => sd.capability === incyclist_devices_1.IncyclistCapability.Power);
|
|
519
|
+
const speed = (0, clone_1.default)(power);
|
|
520
|
+
speed.capability = incyclist_devices_1.IncyclistCapability.Speed;
|
|
521
|
+
selectedDevices.push(speed);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
510
524
|
const enabledCapabilities = selectedDevices.filter(sd => sd.selected === adapterInfo.udid).map(c => c.capability);
|
|
511
525
|
const hasControl = (adapters === null || adapters === void 0 ? void 0 : adapters.find(ai => ai.capabilities.includes(incyclist_devices_1.IncyclistCapability.Control))) !== undefined;
|
|
512
526
|
const hasPower = (adapters === null || adapters === void 0 ? void 0 : adapters.find(ai => ai.capabilities.includes(incyclist_devices_1.IncyclistCapability.Power))) !== undefined;
|
|
527
|
+
this.logEvent({ message: 'Data Update', device: adapterInfo.adapter.getName(), data, enabledCapabilities });
|
|
513
528
|
enabledCapabilities.forEach(capability => {
|
|
514
529
|
switch (capability) {
|
|
515
530
|
case incyclist_devices_1.IncyclistCapability.HeartRate:
|