incyclist-services 1.0.35 → 1.0.36
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.
|
@@ -61,6 +61,7 @@ class DeviceConfigurationService extends events_1.default {
|
|
|
61
61
|
catch (err) {
|
|
62
62
|
this.logError(err, 'init()');
|
|
63
63
|
}
|
|
64
|
+
this.verifyCapabilitySettings();
|
|
64
65
|
this.emitInitialized();
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
@@ -113,16 +114,19 @@ class DeviceConfigurationService extends events_1.default {
|
|
|
113
114
|
const speed = capabilities.find(c => c.capability === incyclist_devices_1.IncyclistCapability.Speed && c.selected !== undefined);
|
|
114
115
|
const cadence = capabilities.find(c => c.capability === incyclist_devices_1.IncyclistCapability.Cadence && c.selected !== undefined);
|
|
115
116
|
const adapter = this.getAdapter(bike);
|
|
117
|
+
let changed = false;
|
|
116
118
|
const verify = (uuid, cap) => {
|
|
117
119
|
if (!uuid && adapter.hasCapability(cap)) {
|
|
118
120
|
const setting = capabilities.find(c => c.capability === cap);
|
|
119
121
|
if (!setting) {
|
|
120
122
|
capabilities.push({ capability: cap, devices: [bike], selected: bike, disabled: false });
|
|
123
|
+
changed = true;
|
|
121
124
|
}
|
|
122
125
|
else {
|
|
123
126
|
setting.selected = bike;
|
|
124
127
|
if (!setting.devices.includes(bike))
|
|
125
128
|
setting.devices.push(bike);
|
|
129
|
+
changed = true;
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
};
|
|
@@ -130,6 +134,10 @@ class DeviceConfigurationService extends events_1.default {
|
|
|
130
134
|
verify(power, incyclist_devices_1.IncyclistCapability.Power);
|
|
131
135
|
verify(speed, incyclist_devices_1.IncyclistCapability.Speed);
|
|
132
136
|
verify(cadence, incyclist_devices_1.IncyclistCapability.Cadence);
|
|
137
|
+
if (changed) {
|
|
138
|
+
this.updateUserSettings();
|
|
139
|
+
this.logEvent({ message: 'capability changed after verification', capabilities });
|
|
140
|
+
}
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
initCapabilties() {
|