incyclist-devices 2.3.26 → 2.3.28
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/antv2/fe/adapter.d.ts +2 -1
- package/lib/antv2/fe/adapter.js +6 -0
- package/lib/ble/base/adapter.js +5 -2
- package/lib/ble/fm/adapter.js +4 -0
- package/lib/serial/daum/DaumAdapter.d.ts +2 -1
- package/lib/serial/daum/DaumAdapter.js +5 -0
- package/lib/types/device.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FitnessEquipmentSensorState, Profile } from "incyclist-ant-plus";
|
|
2
2
|
import AntAdapter from "../base/adapter";
|
|
3
|
-
import { UpdateRequest } from '../../modes/types';
|
|
3
|
+
import ICyclingMode, { 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
|
+
getDefaultCyclingMode(): ICyclingMode;
|
|
23
24
|
sendUpdate(request: UpdateRequest): Promise<UpdateRequest | void>;
|
|
24
25
|
onDeviceData(deviceData: FitnessEquipmentSensorState): void;
|
|
25
26
|
mapData(deviceData: FitnessEquipmentSensorState): IncyclistBikeData;
|
package/lib/antv2/fe/adapter.js
CHANGED
|
@@ -18,6 +18,7 @@ const ant_fe_adv_st_mode_1 = __importDefault(require("../../modes/ant-fe-adv-st-
|
|
|
18
18
|
const consts_1 = require("../../base/consts");
|
|
19
19
|
const antble_erg_1 = __importDefault(require("../../modes/antble-erg"));
|
|
20
20
|
const antble_smarttrainer_1 = __importDefault(require("../../modes/antble-smarttrainer"));
|
|
21
|
+
const power_meter_1 = __importDefault(require("../../modes/power-meter"));
|
|
21
22
|
const DEFAULT_BIKE_WEIGHT_MOUNTAIN = 14.5;
|
|
22
23
|
class AntFEAdapter extends adapter_1.default {
|
|
23
24
|
constructor(settings, props) {
|
|
@@ -36,6 +37,11 @@ class AntFEAdapter extends adapter_1.default {
|
|
|
36
37
|
isReconnecting() {
|
|
37
38
|
return this.promiseReconnect !== null && this.promiseReconnect !== undefined;
|
|
38
39
|
}
|
|
40
|
+
getDefaultCyclingMode() {
|
|
41
|
+
if (this.props.capabilities && this.props.capabilities.indexOf(types_1.IncyclistCapability.Control) === -1)
|
|
42
|
+
return new power_meter_1.default(this);
|
|
43
|
+
return super.getDefaultCyclingMode();
|
|
44
|
+
}
|
|
39
45
|
sendUpdate(request) {
|
|
40
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
47
|
if ((this.paused || this.isReconnecting()) && !request.forced)
|
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);
|
|
@@ -4,7 +4,7 @@ import { DaumSerialComms } from './types';
|
|
|
4
4
|
import { SerialIncyclistDevice } from '../base/adapter';
|
|
5
5
|
import SerialInterface from '../base/serial-interface';
|
|
6
6
|
import EventEmitter from 'events';
|
|
7
|
-
import { UpdateRequest } from '../../modes/types';
|
|
7
|
+
import ICyclingMode, { UpdateRequest } from '../../modes/types';
|
|
8
8
|
export default class DaumAdapter<S extends SerialDeviceSettings, P extends DeviceProperties, C extends DaumSerialComms> extends SerialIncyclistDevice<P> {
|
|
9
9
|
protected static controllers: ControllerConfig;
|
|
10
10
|
comms: C;
|
|
@@ -27,6 +27,7 @@ export default class DaumAdapter<S extends SerialDeviceSettings, P extends Devic
|
|
|
27
27
|
constructor(settings: S, props?: P);
|
|
28
28
|
getPort(): string;
|
|
29
29
|
getSerialInterface(): SerialInterface;
|
|
30
|
+
getDefaultCyclingMode(): ICyclingMode;
|
|
30
31
|
sendInitCommands(): Promise<boolean>;
|
|
31
32
|
getCurrentBikeData(): Promise<IncyclistBikeData>;
|
|
32
33
|
getComms(): C;
|
|
@@ -50,6 +50,11 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
50
50
|
var _a;
|
|
51
51
|
return (_a = this.comms) === null || _a === void 0 ? void 0 : _a.serial;
|
|
52
52
|
}
|
|
53
|
+
getDefaultCyclingMode() {
|
|
54
|
+
if (this.props.capabilities && this.props.capabilities.indexOf(types_1.IncyclistCapability.Control) === -1)
|
|
55
|
+
return new daum_power_1.default(this);
|
|
56
|
+
return super.getDefaultCyclingMode();
|
|
57
|
+
}
|
|
53
58
|
sendInitCommands() {
|
|
54
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
60
|
if (this.started && !this.stopped) {
|
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;
|