incyclist-devices 2.4.6 → 2.4.8
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FitnessEquipmentSensorState, Profile } from "incyclist-ant-plus";
|
|
2
2
|
import AntAdapter from "../base/adapter";
|
|
3
|
-
import ICyclingMode, { UpdateRequest } from '../../modes/types';
|
|
3
|
+
import ICyclingMode, { CyclingMode, UpdateRequest } from '../../modes/types';
|
|
4
4
|
import { AntDeviceProperties, AntDeviceSettings, LegacyProfile } from "../types";
|
|
5
5
|
import { IncyclistBikeData, ControllerConfig } from "../../types";
|
|
6
6
|
interface AntFEStartDeviceProperties extends AntDeviceProperties {
|
|
@@ -20,6 +20,7 @@ export default class AntFEAdapter extends AntAdapter<FitnessEquipmentSensorState
|
|
|
20
20
|
constructor(settings: AntDeviceSettings, props?: AntDeviceProperties);
|
|
21
21
|
getDisplayName(): string;
|
|
22
22
|
isReconnecting(): boolean;
|
|
23
|
+
getSupportedCyclingModes(): Array<typeof CyclingMode>;
|
|
23
24
|
getDefaultCyclingMode(): ICyclingMode;
|
|
24
25
|
sendUpdate(request: UpdateRequest): Promise<UpdateRequest | void>;
|
|
25
26
|
onDeviceData(deviceData: FitnessEquipmentSensorState): void;
|
package/lib/antv2/fe/adapter.js
CHANGED
|
@@ -37,6 +37,13 @@ class AntFEAdapter extends adapter_1.default {
|
|
|
37
37
|
isReconnecting() {
|
|
38
38
|
return this.promiseReconnect !== null && this.promiseReconnect !== undefined;
|
|
39
39
|
}
|
|
40
|
+
getSupportedCyclingModes() {
|
|
41
|
+
var _a;
|
|
42
|
+
const modes = [power_meter_1.default];
|
|
43
|
+
if (((_a = this.props) === null || _a === void 0 ? void 0 : _a.capabilities) && this.props.capabilities.indexOf(types_1.IncyclistCapability.Control) === -1)
|
|
44
|
+
return modes;
|
|
45
|
+
return super.getSupportedCyclingModes();
|
|
46
|
+
}
|
|
40
47
|
getDefaultCyclingMode() {
|
|
41
48
|
if (this.props.capabilities && this.props.capabilities.indexOf(types_1.IncyclistCapability.Control) === -1)
|
|
42
49
|
return this.createMode(power_meter_1.default);
|
package/lib/base/adpater.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export default class IncyclistDevice<P extends DeviceProperties> extends EventEm
|
|
|
51
51
|
update(): void;
|
|
52
52
|
setCyclingMode(mode: string | ICyclingMode, settings?: any, sendInitCommands?: boolean): void;
|
|
53
53
|
createMode(ModeClass: typeof CyclingMode): ICyclingMode;
|
|
54
|
-
protected createOrGetMode(mode: string | ICyclingMode): ICyclingMode;
|
|
54
|
+
protected createOrGetMode(mode: string | ICyclingMode, useCurrent?: boolean): ICyclingMode;
|
|
55
55
|
getSupportedCyclingModes(): Array<typeof CyclingMode>;
|
|
56
56
|
getCyclingMode(): ICyclingMode;
|
|
57
57
|
getDefaultCyclingMode(): ICyclingMode;
|
package/lib/base/adpater.js
CHANGED
|
@@ -150,16 +150,16 @@ class IncyclistDevice extends events_1.default {
|
|
|
150
150
|
createMode(ModeClass) {
|
|
151
151
|
try {
|
|
152
152
|
const mode = new ModeClass(null);
|
|
153
|
-
return this.createOrGetMode(mode.getName());
|
|
153
|
+
return this.createOrGetMode(mode.getName(), false);
|
|
154
154
|
}
|
|
155
155
|
catch (err) {
|
|
156
156
|
this.logEvent({ message: 'error', error: err.message, stack: err.stack, mode: ModeClass === null || ModeClass === void 0 ? void 0 : ModeClass.name });
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
createOrGetMode(mode) {
|
|
159
|
+
createOrGetMode(mode, useCurrent = true) {
|
|
160
160
|
var _a, _b, _c;
|
|
161
161
|
if (typeof mode === 'string') {
|
|
162
|
-
if (mode === ((_a = this.
|
|
162
|
+
if (useCurrent && this.cyclingMode && mode === ((_a = this.cyclingMode) === null || _a === void 0 ? void 0 : _a.getName())) {
|
|
163
163
|
return this.cyclingMode;
|
|
164
164
|
}
|
|
165
165
|
const supported = this.getSupportedCyclingModes();
|
package/lib/ble/fm/sensor.js
CHANGED
|
@@ -391,7 +391,7 @@ class BleFitnessMachineDevice extends sensor_1.TBleSensor {
|
|
|
391
391
|
check(consts_2.TargetSettingFeatureFlag.WheelCircumferenceConfigurationSupported, 'wheelCircumference');
|
|
392
392
|
check(consts_2.TargetSettingFeatureFlag.SpinDownControlSupported, 'spindown');
|
|
393
393
|
check(consts_2.TargetSettingFeatureFlag.TargetedCadenceConfigurationSupported, 'cadence');
|
|
394
|
-
if (this.supportsVirtualShifting) {
|
|
394
|
+
if (this.supportsVirtualShifting()) {
|
|
395
395
|
info.push('virtualShifting');
|
|
396
396
|
}
|
|
397
397
|
}
|