incyclist-devices 2.3.26 → 2.3.27
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/ble/base/adapter.js
CHANGED
|
@@ -257,8 +257,10 @@ class BleAdapter extends adpater_1.default {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
getStartLogProps(props) {
|
|
260
|
+
var _a;
|
|
261
|
+
const capabilities = (_a = this.props) === null || _a === void 0 ? void 0 : _a.capabilities;
|
|
260
262
|
const { user, userWeight, bikeWeight, timeout, wheelDiameter, restart, scanOnly } = props !== null && props !== void 0 ? props : {};
|
|
261
|
-
return { user, userWeight, bikeWeight, wheelDiameter, timeout, restart, scanOnly };
|
|
263
|
+
return { user, userWeight, bikeWeight, wheelDiameter, timeout, restart, scanOnly, capabilities };
|
|
262
264
|
}
|
|
263
265
|
startAdapter(startProps) {
|
|
264
266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -292,7 +294,8 @@ class BleAdapter extends adpater_1.default {
|
|
|
292
294
|
}
|
|
293
295
|
yield this.waitForInitialData(timeout);
|
|
294
296
|
yield this.checkCapabilities();
|
|
295
|
-
|
|
297
|
+
const skipControl = this.props.capabilities && !this.props.capabilities.includes(types_1.IncyclistCapability.Control);
|
|
298
|
+
if (this.hasCapability(types_1.IncyclistCapability.Control) && !skipControl)
|
|
296
299
|
yield this.initControl(startProps);
|
|
297
300
|
this.stopped = false;
|
|
298
301
|
this.started = true;
|
package/lib/ble/fm/adapter.js
CHANGED
|
@@ -47,6 +47,8 @@ class BleFmAdapter extends adapter_1.default {
|
|
|
47
47
|
getSupportedCyclingModes() {
|
|
48
48
|
var _a;
|
|
49
49
|
const modes = [power_meter_1.default];
|
|
50
|
+
if (this.props.capabilities && this.props.capabilities.indexOf(types_1.IncyclistCapability.Control) === -1)
|
|
51
|
+
return modes;
|
|
50
52
|
const features = (_a = this.getSensor()) === null || _a === void 0 ? void 0 : _a.features;
|
|
51
53
|
if (!features)
|
|
52
54
|
return [power_meter_1.default, antble_smarttrainer_1.default, antble_erg_1.default];
|
|
@@ -58,6 +60,8 @@ class BleFmAdapter extends adapter_1.default {
|
|
|
58
60
|
}
|
|
59
61
|
getDefaultCyclingMode() {
|
|
60
62
|
var _a;
|
|
63
|
+
if (this.props.capabilities && this.props.capabilities.indexOf(types_1.IncyclistCapability.Control) === -1)
|
|
64
|
+
return new power_meter_1.default(this);
|
|
61
65
|
const features = (_a = this.getSensor()) === null || _a === void 0 ? void 0 : _a.features;
|
|
62
66
|
if (!features)
|
|
63
67
|
return new antble_smarttrainer_1.default(this);
|
package/lib/types/device.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventLogger } from "gd-eventlog";
|
|
2
2
|
import { IncyclistInterface } from "./interface";
|
|
3
3
|
import { User } from "./user";
|
|
4
|
+
import { IncyclistCapability } from "./capabilities";
|
|
4
5
|
export declare enum INTERFACE {
|
|
5
6
|
SERIAL = "serial",
|
|
6
7
|
TCPIP = "tcpip",
|
|
@@ -15,6 +16,7 @@ export type DeviceProperties = {
|
|
|
15
16
|
user?: User;
|
|
16
17
|
userWeight?: number;
|
|
17
18
|
bikeWeight?: number;
|
|
19
|
+
capabilities?: IncyclistCapability[];
|
|
18
20
|
};
|
|
19
21
|
export interface DeviceStartProperties extends DeviceProperties {
|
|
20
22
|
timeout?: number;
|