incyclist-devices 2.1.18 → 2.1.21
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/README.MD +3 -0
- package/lib/antv2/base/adapter.d.ts +2 -1
- package/lib/antv2/base/adapter.js +9 -3
- package/lib/antv2/factories/sensor-factory.js +2 -0
- package/lib/antv2/index.d.ts +4 -1
- package/lib/antv2/index.js +8 -1
- package/lib/antv2/sc/adapter.d.ts +11 -0
- package/lib/antv2/sc/adapter.js +30 -0
- package/lib/antv2/sc/index.d.ts +2 -0
- package/lib/antv2/sc/index.js +7 -0
- package/lib/antv2/spd/adapter.d.ts +11 -0
- package/lib/antv2/spd/adapter.js +25 -0
- package/lib/antv2/spd/index.d.ts +2 -0
- package/lib/antv2/spd/index.js +7 -0
- package/lib/ble/ble-interface.js +7 -1
- package/lib/ble/consts.d.ts +3 -0
- package/lib/ble/consts.js +4 -1
- package/lib/ble/wahoo/comms.js +1 -1
- package/lib/serial/base/serial-interface.js +8 -0
- package/lib/serial/base/serial-scanner.js +10 -7
- package/lib/serial/daum/DaumAdapter.js +1 -1
- package/lib/serial/kettler/ergo-racer/adapter.js +1 -1
- package/lib/simulator/Simulator.js +1 -1
- package/lib/types/capabilities.d.ts +0 -1
- package/lib/types/capabilities.js +0 -1
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -3,7 +3,7 @@ import { IChannel, ISensor, Profile } from 'incyclist-ant-plus';
|
|
|
3
3
|
import AntInterface from './interface';
|
|
4
4
|
import IncyclistDevice from '../../base/adpater';
|
|
5
5
|
import { AntDeviceProperties, AntDeviceSettings, LegacyProfile, BaseDeviceData, AdapterStartStatus } from '../types';
|
|
6
|
-
import { IAdapter, IncyclistAdapterData, IncyclistBikeData } from '../../types';
|
|
6
|
+
import { IAdapter, IncyclistAdapterData, IncyclistBikeData, IncyclistCapability } from '../../types';
|
|
7
7
|
export default class AntAdapter<TDeviceData extends BaseDeviceData> extends IncyclistDevice<AntDeviceProperties> {
|
|
8
8
|
sensor: ISensor;
|
|
9
9
|
data: IncyclistAdapterData;
|
|
@@ -29,6 +29,7 @@ export default class AntAdapter<TDeviceData extends BaseDeviceData> extends Incy
|
|
|
29
29
|
constructor(settings: AntDeviceSettings, props?: AntDeviceProperties);
|
|
30
30
|
getProfileName(): Profile;
|
|
31
31
|
getLegacyProfileName(): LegacyProfile;
|
|
32
|
+
protected getStaticCapabilities(): Array<IncyclistCapability>;
|
|
32
33
|
createSensor(settings: AntDeviceSettings): ISensor;
|
|
33
34
|
isEqual(settings: AntDeviceSettings): boolean;
|
|
34
35
|
getDefaultReconnectDelay(): number;
|
|
@@ -51,15 +51,22 @@ class AntAdapter extends adpater_1.default {
|
|
|
51
51
|
if (this.isDebugEnabled()) {
|
|
52
52
|
this.ant.setLogger(this);
|
|
53
53
|
}
|
|
54
|
+
if (this.getStaticCapabilities())
|
|
55
|
+
this.capabilities = this.getStaticCapabilities();
|
|
54
56
|
}
|
|
55
57
|
getProfileName() {
|
|
58
|
+
var _a;
|
|
56
59
|
const C = this.constructor;
|
|
57
|
-
return C['ANT_PROFILE_NAME'];
|
|
60
|
+
return ((_a = this.sensor) === null || _a === void 0 ? void 0 : _a.getProfile()) || C['ANT_PROFILE_NAME'];
|
|
58
61
|
}
|
|
59
62
|
getLegacyProfileName() {
|
|
60
63
|
const C = this.constructor;
|
|
61
64
|
return C['INCYCLIST_PROFILE_NAME'];
|
|
62
65
|
}
|
|
66
|
+
getStaticCapabilities() {
|
|
67
|
+
const C = this.constructor;
|
|
68
|
+
return C['CAPABILITIES'];
|
|
69
|
+
}
|
|
63
70
|
createSensor(settings) {
|
|
64
71
|
return sensor_factory_1.default.create(this.getProfileName(), Number(settings.deviceID));
|
|
65
72
|
}
|
|
@@ -190,11 +197,10 @@ class AntAdapter extends adpater_1.default {
|
|
|
190
197
|
return id.toString();
|
|
191
198
|
}
|
|
192
199
|
getName() {
|
|
193
|
-
var _a;
|
|
194
200
|
if (this.settings.name)
|
|
195
201
|
return this.settings.name;
|
|
196
202
|
const deviceID = this.getID();
|
|
197
|
-
const profile =
|
|
203
|
+
const profile = this.getProfileName();
|
|
198
204
|
return `Ant+${profile} ${deviceID}`;
|
|
199
205
|
}
|
|
200
206
|
getUniqueName() {
|
|
@@ -7,6 +7,8 @@ const profiles = [
|
|
|
7
7
|
{ profile: 'HR', Class: incyclist_ant_plus_2.HeartRateSensor },
|
|
8
8
|
{ profile: 'FE', Class: incyclist_ant_plus_2.FitnessEquipmentSensor },
|
|
9
9
|
{ profile: 'CAD', Class: incyclist_ant_plus_1.CadenceSensor },
|
|
10
|
+
{ profile: 'SPD', Class: incyclist_ant_plus_1.SpeedSensor },
|
|
11
|
+
{ profile: 'SC', Class: incyclist_ant_plus_1.SpeedCadenceSensor },
|
|
10
12
|
];
|
|
11
13
|
class SensorFactory {
|
|
12
14
|
static create(profile, deviceID) {
|
package/lib/antv2/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import AntPwrAdapter from "./pwr";
|
|
2
2
|
import AntFEAdapter from "./fe";
|
|
3
3
|
import AntHrAdapter from "./hr";
|
|
4
|
+
import AntCadAdapter from "./cad";
|
|
4
5
|
import AntAdapterFactory from "./factories/adapter-factory";
|
|
5
6
|
import AntInterface from "./base/interface";
|
|
6
7
|
import { AntInterfaceProps } from "./types";
|
|
8
|
+
import AntSpdAdapter from "./spd";
|
|
9
|
+
import AntScAdapter from "./sc";
|
|
7
10
|
export { AntDeviceSettings, AntDeviceProperties, AntScanProps } from "./types";
|
|
8
|
-
export { AntAdapterFactory, AntFEAdapter, AntHrAdapter, AntPwrAdapter, AntInterface, AntInterfaceProps };
|
|
11
|
+
export { AntAdapterFactory, AntFEAdapter, AntHrAdapter, AntPwrAdapter, AntScAdapter, AntSpdAdapter, AntCadAdapter, AntInterface, AntInterfaceProps };
|
package/lib/antv2/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AntInterface = exports.AntPwrAdapter = exports.AntHrAdapter = exports.AntFEAdapter = exports.AntAdapterFactory = void 0;
|
|
6
|
+
exports.AntInterface = exports.AntCadAdapter = exports.AntSpdAdapter = exports.AntScAdapter = exports.AntPwrAdapter = exports.AntHrAdapter = exports.AntFEAdapter = exports.AntAdapterFactory = void 0;
|
|
7
7
|
const pwr_1 = __importDefault(require("./pwr"));
|
|
8
8
|
exports.AntPwrAdapter = pwr_1.default;
|
|
9
9
|
const fe_1 = __importDefault(require("./fe"));
|
|
@@ -11,12 +11,19 @@ exports.AntFEAdapter = fe_1.default;
|
|
|
11
11
|
const hr_1 = __importDefault(require("./hr"));
|
|
12
12
|
exports.AntHrAdapter = hr_1.default;
|
|
13
13
|
const cad_1 = __importDefault(require("./cad"));
|
|
14
|
+
exports.AntCadAdapter = cad_1.default;
|
|
14
15
|
const adapter_factory_1 = __importDefault(require("./factories/adapter-factory"));
|
|
15
16
|
exports.AntAdapterFactory = adapter_factory_1.default;
|
|
16
17
|
const interface_1 = __importDefault(require("./base/interface"));
|
|
17
18
|
exports.AntInterface = interface_1.default;
|
|
19
|
+
const spd_1 = __importDefault(require("./spd"));
|
|
20
|
+
exports.AntSpdAdapter = spd_1.default;
|
|
21
|
+
const sc_1 = __importDefault(require("./sc"));
|
|
22
|
+
exports.AntScAdapter = sc_1.default;
|
|
18
23
|
const af = adapter_factory_1.default.getInstance();
|
|
19
24
|
af.register('PWR', 'Power Meter', pwr_1.default);
|
|
20
25
|
af.register('HR', 'Heartrate Monitor', hr_1.default);
|
|
21
26
|
af.register('FE', 'Smart Trainer', fe_1.default);
|
|
22
27
|
af.register('CAD', 'Cadence Sensor', cad_1.default);
|
|
28
|
+
af.register('SPD', 'Speed Sensor', spd_1.default);
|
|
29
|
+
af.register('SC', 'Speed + Cadence Sensor', sc_1.default);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SpeedCadenceSensorState, Profile } from "incyclist-ant-plus";
|
|
2
|
+
import AntAdapter from "../base/adapter";
|
|
3
|
+
import { LegacyProfile } from "../types";
|
|
4
|
+
import { IncyclistCapability } from "../../types";
|
|
5
|
+
export default class AntSpdAdapter extends AntAdapter<SpeedCadenceSensorState> {
|
|
6
|
+
protected static INCYCLIST_PROFILE_NAME: LegacyProfile;
|
|
7
|
+
protected static ANT_PROFILE_NAME: Profile;
|
|
8
|
+
protected static CAPABILITIES: IncyclistCapability[];
|
|
9
|
+
mapToAdapterData(deviceData: SpeedCadenceSensorState): void;
|
|
10
|
+
hasData(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const adapter_1 = __importDefault(require("../base/adapter"));
|
|
7
|
+
const types_1 = require("../../types");
|
|
8
|
+
class AntSpdAdapter extends adapter_1.default {
|
|
9
|
+
mapToAdapterData(deviceData) {
|
|
10
|
+
if (deviceData.CalculatedSpeed !== undefined) {
|
|
11
|
+
this.data.speed = deviceData.CalculatedSpeed;
|
|
12
|
+
this.data.timestamp = Date.now();
|
|
13
|
+
}
|
|
14
|
+
if (deviceData.CalculatedDistance !== undefined) {
|
|
15
|
+
this.data.deviceDistanceCounter = deviceData.CalculatedDistance;
|
|
16
|
+
}
|
|
17
|
+
if (deviceData.CalculatedCadence) {
|
|
18
|
+
this.data.cadence = deviceData.CalculatedCadence;
|
|
19
|
+
this.data.timestamp = Date.now();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
hasData() {
|
|
23
|
+
return ((this.deviceData.CalculatedSpeed !== undefined && this.deviceData.CalculatedSpeed !== null) ||
|
|
24
|
+
(this.deviceData.CalculatedCadence !== undefined && this.deviceData.CalculatedCadence !== null));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
AntSpdAdapter.INCYCLIST_PROFILE_NAME = 'Speed + Cadence Sensor';
|
|
28
|
+
AntSpdAdapter.ANT_PROFILE_NAME = 'SC';
|
|
29
|
+
AntSpdAdapter.CAPABILITIES = [types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence];
|
|
30
|
+
exports.default = AntSpdAdapter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const adapter_1 = __importDefault(require("./adapter"));
|
|
7
|
+
exports.default = adapter_1.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SpeedSensorState, Profile } from "incyclist-ant-plus";
|
|
2
|
+
import AntAdapter from "../base/adapter";
|
|
3
|
+
import { LegacyProfile } from "../types";
|
|
4
|
+
import { IncyclistCapability } from "../../types";
|
|
5
|
+
export default class AntSpdAdapter extends AntAdapter<SpeedSensorState> {
|
|
6
|
+
protected static INCYCLIST_PROFILE_NAME: LegacyProfile;
|
|
7
|
+
protected static ANT_PROFILE_NAME: Profile;
|
|
8
|
+
protected static CAPABILITIES: IncyclistCapability[];
|
|
9
|
+
mapToAdapterData(deviceData: SpeedSensorState): void;
|
|
10
|
+
hasData(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const adapter_1 = __importDefault(require("../base/adapter"));
|
|
7
|
+
const types_1 = require("../../types");
|
|
8
|
+
class AntSpdAdapter extends adapter_1.default {
|
|
9
|
+
mapToAdapterData(deviceData) {
|
|
10
|
+
if (deviceData.CalculatedSpeed !== undefined) {
|
|
11
|
+
this.data.speed = deviceData.CalculatedSpeed;
|
|
12
|
+
this.data.timestamp = Date.now();
|
|
13
|
+
}
|
|
14
|
+
if (deviceData.CalculatedDistance !== undefined) {
|
|
15
|
+
this.data.deviceDistanceCounter = deviceData.CalculatedDistance;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
hasData() {
|
|
19
|
+
return this.deviceData.CalculatedSpeed !== undefined && this.deviceData.CalculatedSpeed !== null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
AntSpdAdapter.INCYCLIST_PROFILE_NAME = 'Speed Sensor';
|
|
23
|
+
AntSpdAdapter.ANT_PROFILE_NAME = 'SPD';
|
|
24
|
+
AntSpdAdapter.CAPABILITIES = [types_1.IncyclistCapability.Speed];
|
|
25
|
+
exports.default = AntSpdAdapter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const adapter_1 = __importDefault(require("./adapter"));
|
|
7
|
+
exports.default = adapter_1.default;
|
package/lib/ble/ble-interface.js
CHANGED
|
@@ -387,6 +387,8 @@ class BleInterface extends events_1.default {
|
|
|
387
387
|
let opStr;
|
|
388
388
|
opStr = 'search device';
|
|
389
389
|
this.logEvent({ message: 'search device request', request });
|
|
390
|
+
const wasLoggingPaused = this.loggingPaused;
|
|
391
|
+
this.resumeLogging();
|
|
390
392
|
if (this.scanState.isScanning) {
|
|
391
393
|
try {
|
|
392
394
|
this.logEvent({ message: `${opStr}: waiting for previous scan to finish` });
|
|
@@ -408,6 +410,8 @@ class BleInterface extends events_1.default {
|
|
|
408
410
|
this.logEvent({ message: `${opStr} result: timeout`, request });
|
|
409
411
|
ble.removeAllListeners('discover');
|
|
410
412
|
this.logEvent({ message: `${opStr}: stop scanning`, request });
|
|
413
|
+
if (wasLoggingPaused)
|
|
414
|
+
this.pauseLogging();
|
|
411
415
|
ble.stopScanning(() => {
|
|
412
416
|
this.scanState.isScanning = false;
|
|
413
417
|
try {
|
|
@@ -440,6 +444,8 @@ class BleInterface extends events_1.default {
|
|
|
440
444
|
this.scanState.timeout = null;
|
|
441
445
|
}
|
|
442
446
|
this.logEvent({ message: `${opStr}: stop scanning`, request });
|
|
447
|
+
if (wasLoggingPaused)
|
|
448
|
+
this.pauseLogging();
|
|
443
449
|
ble.stopScanning(() => {
|
|
444
450
|
ble.removeAllListeners('discover');
|
|
445
451
|
this.scanState.isScanning = false;
|
|
@@ -464,8 +470,8 @@ class BleInterface extends events_1.default {
|
|
|
464
470
|
}
|
|
465
471
|
scan(props = {}) {
|
|
466
472
|
return __awaiter(this, void 0, void 0, function* () {
|
|
467
|
-
this.resumeLogging();
|
|
468
473
|
this.logEvent({ message: 'starting scan ..' });
|
|
474
|
+
this.resumeLogging();
|
|
469
475
|
const { timeout, protocol, protocols } = props;
|
|
470
476
|
const requestedProtocols = protocols || [];
|
|
471
477
|
if (protocol && !requestedProtocols.find(p => p === protocol))
|
package/lib/ble/consts.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export declare const FTMS = "1826";
|
|
|
5
5
|
export declare const FTMS_CP = "2ad9";
|
|
6
6
|
export declare const FTMS_STATUS = "2ada";
|
|
7
7
|
export declare const INDOOR_BIKE_DATA = "2ad2";
|
|
8
|
+
export declare const FTMS_FEATURE = "2acc";
|
|
9
|
+
export declare const RES_LEVEL_RANGE = "2ad6";
|
|
10
|
+
export declare const POWER_RANGE = "2ad8";
|
|
8
11
|
export declare const CSP = "1818";
|
|
9
12
|
export declare const CSP_MEASUREMENT = "2a63";
|
|
10
13
|
export declare const CSP_FEATURE = "2a65";
|
package/lib/ble/consts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ELITE_TRAINER_SVC = exports.WAHOO_ADVANCED_TRAINER_CP_FULL = exports.WAHOO_ADVANCED_FTMS = exports.WAHOO_ADVANCED_TRAINER_CP = exports.CSC_MEASUREMENT = exports.CSC = exports.HR_MEASUREMENT = exports.CSP_FEATURE = exports.CSP_MEASUREMENT = exports.CSP = exports.INDOOR_BIKE_DATA = exports.FTMS_STATUS = exports.FTMS_CP = exports.FTMS = exports.TACX_FE_C_TX = exports.TACX_FE_C_RX = exports.TACX_FE_C_BLE = void 0;
|
|
3
|
+
exports.ELITE_TRAINER_SVC = exports.WAHOO_ADVANCED_TRAINER_CP_FULL = exports.WAHOO_ADVANCED_FTMS = exports.WAHOO_ADVANCED_TRAINER_CP = exports.CSC_MEASUREMENT = exports.CSC = exports.HR_MEASUREMENT = exports.CSP_FEATURE = exports.CSP_MEASUREMENT = exports.CSP = exports.POWER_RANGE = exports.RES_LEVEL_RANGE = exports.FTMS_FEATURE = exports.INDOOR_BIKE_DATA = exports.FTMS_STATUS = exports.FTMS_CP = exports.FTMS = exports.TACX_FE_C_TX = exports.TACX_FE_C_RX = exports.TACX_FE_C_BLE = void 0;
|
|
4
4
|
exports.TACX_FE_C_BLE = '6e40fec1';
|
|
5
5
|
exports.TACX_FE_C_RX = '6e40fec2';
|
|
6
6
|
exports.TACX_FE_C_TX = '6e40fec3';
|
|
@@ -8,6 +8,9 @@ exports.FTMS = '1826';
|
|
|
8
8
|
exports.FTMS_CP = '2ad9';
|
|
9
9
|
exports.FTMS_STATUS = '2ada';
|
|
10
10
|
exports.INDOOR_BIKE_DATA = '2ad2';
|
|
11
|
+
exports.FTMS_FEATURE = '2acc';
|
|
12
|
+
exports.RES_LEVEL_RANGE = '2ad6';
|
|
13
|
+
exports.POWER_RANGE = '2ad8';
|
|
11
14
|
exports.CSP = '1818';
|
|
12
15
|
exports.CSP_MEASUREMENT = '2a63';
|
|
13
16
|
exports.CSP_FEATURE = '2a65';
|
package/lib/ble/wahoo/comms.js
CHANGED
|
@@ -394,6 +394,6 @@ class BleWahooDevice extends comms_1.default {
|
|
|
394
394
|
}
|
|
395
395
|
BleWahooDevice.protocol = 'wahoo';
|
|
396
396
|
BleWahooDevice.services = [consts_2.CSP];
|
|
397
|
-
BleWahooDevice.characteristics = [
|
|
397
|
+
BleWahooDevice.characteristics = [consts_2.FTMS_FEATURE, consts_2.INDOOR_BIKE_DATA, consts_2.RES_LEVEL_RANGE, consts_2.POWER_RANGE, consts_2.FTMS_CP, consts_2.FTMS_STATUS, consts_2.WAHOO_ADVANCED_TRAINER_CP];
|
|
398
398
|
BleWahooDevice.detectionPriority = 5;
|
|
399
399
|
exports.default = BleWahooDevice;
|
|
@@ -19,6 +19,7 @@ const utils_1 = require("../../utils/utils");
|
|
|
19
19
|
const adapter_factory_1 = __importDefault(require("../factories/adapter-factory"));
|
|
20
20
|
const serial_scanner_1 = require("./serial-scanner");
|
|
21
21
|
const DEFAULT_SCAN_TIMEOUT = 10000;
|
|
22
|
+
const MAX_PARALLEL_SCANS = 5;
|
|
22
23
|
class SerialInterface extends events_1.default {
|
|
23
24
|
static getInstance(props) {
|
|
24
25
|
const { ifaceName, binding, logger } = props;
|
|
@@ -237,6 +238,10 @@ class SerialInterface extends events_1.default {
|
|
|
237
238
|
return [];
|
|
238
239
|
}
|
|
239
240
|
this.logEvent({ message: 'scanning on ', interface: this.ifaceName, paths: paths.map(p => p.path).join(','), timeout });
|
|
241
|
+
let listReduced = false;
|
|
242
|
+
if (paths.length > MAX_PARALLEL_SCANS) {
|
|
243
|
+
paths = paths.filter((p, idx) => idx < MAX_PARALLEL_SCANS);
|
|
244
|
+
}
|
|
240
245
|
const scanners = paths.map(p => new serial_scanner_1.SinglePathScanner(p.path, this, Object.assign(Object.assign({}, props), { logger: this.logger })));
|
|
241
246
|
try {
|
|
242
247
|
yield Promise.all(scanners.map(s => s.scan()
|
|
@@ -259,6 +264,9 @@ class SerialInterface extends events_1.default {
|
|
|
259
264
|
clearTimeout(this.toScan);
|
|
260
265
|
this.toScan = null;
|
|
261
266
|
}
|
|
267
|
+
if (listReduced) {
|
|
268
|
+
paths.forEach(p => this.inUse.push(p.path));
|
|
269
|
+
}
|
|
262
270
|
this.isScanning = false;
|
|
263
271
|
this.logEvent({ message: 'scan finished on', interface: this.ifaceName, paths: paths.map(p => p.path), devices: detected.map(d => {
|
|
264
272
|
const res = Object.assign({}, d);
|
|
@@ -67,17 +67,20 @@ class SinglePathScanner {
|
|
|
67
67
|
}
|
|
68
68
|
const adapterSettings = { interface: this.serial.getName(), host, port, protocol };
|
|
69
69
|
const adapter = adapter_factory_1.default.getInstance().createInstance(adapterSettings);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
if (this.isScanning) {
|
|
71
|
+
found = yield (adapter === null || adapter === void 0 ? void 0 : adapter.check());
|
|
72
|
+
if (found) {
|
|
73
|
+
this.isFound = true;
|
|
74
|
+
const name = adapter.getName();
|
|
75
|
+
resolve(Object.assign(Object.assign({}, adapterSettings), { name }));
|
|
76
|
+
}
|
|
77
|
+
yield adapter.close();
|
|
78
|
+
yield (0, utils_1.sleep)(1000);
|
|
75
79
|
}
|
|
76
|
-
yield (0, utils_1.sleep)(100);
|
|
77
80
|
}
|
|
78
81
|
catch (err) {
|
|
79
82
|
this.logEvent({ message: 'error', fn: 'scan()', error: err.message || err, stack: err.stack });
|
|
80
|
-
yield (0, utils_1.sleep)(
|
|
83
|
+
yield (0, utils_1.sleep)(2000);
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}));
|
|
@@ -37,7 +37,7 @@ class DaumAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
37
37
|
heartrate: 0
|
|
38
38
|
};
|
|
39
39
|
this.capabilities = [
|
|
40
|
-
types_1.IncyclistCapability.Power, types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence, types_1.IncyclistCapability.
|
|
40
|
+
types_1.IncyclistCapability.Power, types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence, types_1.IncyclistCapability.HeartRate,
|
|
41
41
|
types_1.IncyclistCapability.Control
|
|
42
42
|
];
|
|
43
43
|
}
|
|
@@ -29,7 +29,7 @@ class KettlerRacerAdapter extends adapter_1.SerialIncyclistDevice {
|
|
|
29
29
|
this.iv = null;
|
|
30
30
|
this.comms = new comms_1.default({ interface: settings.interface, port: settings.port, logger: this.logger });
|
|
31
31
|
this.capabilities = [
|
|
32
|
-
types_1.IncyclistCapability.Power, types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence, types_1.IncyclistCapability.
|
|
32
|
+
types_1.IncyclistCapability.Power, types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence, types_1.IncyclistCapability.HeartRate,
|
|
33
33
|
types_1.IncyclistCapability.Control
|
|
34
34
|
];
|
|
35
35
|
}
|
|
@@ -35,7 +35,7 @@ class Simulator extends adpater_1.default {
|
|
|
35
35
|
const modeSettings = this.isBot ? props.settings : this.getCyclingMode().getSettings();
|
|
36
36
|
this.setCyclingMode(name, modeSettings);
|
|
37
37
|
this.capabilities = [
|
|
38
|
-
types_1.IncyclistCapability.Power, types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence,
|
|
38
|
+
types_1.IncyclistCapability.Power, types_1.IncyclistCapability.Speed, types_1.IncyclistCapability.Cadence,
|
|
39
39
|
types_1.IncyclistCapability.Control, types_1.IncyclistCapability.HeartRate
|
|
40
40
|
];
|
|
41
41
|
}
|
|
@@ -7,6 +7,5 @@ var IncyclistCapability;
|
|
|
7
7
|
IncyclistCapability["Speed"] = "speed";
|
|
8
8
|
IncyclistCapability["Cadence"] = "cadence";
|
|
9
9
|
IncyclistCapability["HeartRate"] = "heartrate";
|
|
10
|
-
IncyclistCapability["Gear"] = "gear";
|
|
11
10
|
IncyclistCapability["Control"] = "control";
|
|
12
11
|
})(IncyclistCapability || (exports.IncyclistCapability = IncyclistCapability = {}));
|