incyclist-devices 2.0.15 → 2.0.17
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/adapters.js +1 -1
- package/lib/antv2/adapter.d.ts +2 -2
- package/lib/antv2/ant-interface.js +1 -1
- package/lib/antv2/fe/adapter.js +1 -1
- package/lib/antv2/hr/adapter.js +1 -1
- package/lib/antv2/modes/ant-fe-erg-mode.js +1 -1
- package/lib/antv2/pwr/adapter.js +1 -1
- package/lib/ble/bindings/types.d.ts +1 -1
- package/lib/ble/cp/comm.js +1 -1
- package/lib/ble/elite/comms.js +1 -1
- package/lib/ble/fm/comms.js +1 -1
- package/lib/ble/hr/comm.js +1 -1
- package/lib/ble/tacx/comms.js +1 -1
- package/lib/ble/wahoo/comms.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/modes/ble-erg-mode.js +1 -1
- package/lib/modes/cycling-mode.js +1 -1
- package/lib/modes/simulator.js +1 -1
- package/lib/serial/bindings/tcp.js +17 -10
- package/lib/serial/daum/ERGCyclingMode.js +1 -1
- package/lib/serial/daum/SmartTrainerCyclingMode.js +1 -1
- package/lib/serial/daum/classic/adapter.js +1 -1
- package/lib/serial/daum/premium/adapter.js +1 -1
- package/lib/serial/daum/premium/utils.js +2 -2
- package/lib/serial/kettler/comms.js +2 -2
- package/lib/serial/kettler/ergo-racer/modes/erg.js +1 -1
- package/lib/serial/serial-interface.js +1 -1
- package/lib/types/capabilities.js +1 -1
- package/lib/types/route.js +1 -1
- package/lib/types/user.js +1 -1
- package/package.json +10 -9
package/lib/adapters.js
CHANGED
package/lib/antv2/adapter.d.ts
CHANGED
|
@@ -28,10 +28,10 @@ export default class AntAdapter<TDeviceData extends BaseDeviceData, TData> exten
|
|
|
28
28
|
};
|
|
29
29
|
onDataFn: (data: TData) => void;
|
|
30
30
|
startupRetryPause: number;
|
|
31
|
-
protected ivDataTimeout: NodeJS.
|
|
31
|
+
protected ivDataTimeout: NodeJS.Timeout;
|
|
32
32
|
protected lastDataTS: number;
|
|
33
33
|
protected dataMsgCount: number;
|
|
34
|
-
protected ivWaitForData: NodeJS.
|
|
34
|
+
protected ivWaitForData: NodeJS.Timeout;
|
|
35
35
|
constructor(settings: AntDeviceSettings, props?: DeviceProperties);
|
|
36
36
|
createSensor(settings: AntDeviceSettings): ISensor;
|
|
37
37
|
isEqual(settings: AntDeviceSettings): boolean;
|
|
@@ -280,6 +280,6 @@ class AntInterface extends events_1.default {
|
|
|
280
280
|
return (this.activeScan === undefined || this.activeScan === null);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
exports.default = AntInterface;
|
|
284
283
|
AntInterface._instance = undefined;
|
|
285
284
|
AntInterface.INTERFACE_NAME = 'ant';
|
|
285
|
+
exports.default = AntInterface;
|
package/lib/antv2/fe/adapter.js
CHANGED
package/lib/antv2/hr/adapter.js
CHANGED
|
@@ -71,6 +71,6 @@ class AntHrAdapter extends adapter_1.default {
|
|
|
71
71
|
return this.deviceData.ComputedHeartRate !== undefined && this.deviceData.ComputedHeartRate !== null;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
exports.default = AntHrAdapter;
|
|
75
74
|
AntHrAdapter.INCYCLIST_PROFILE_NAME = 'Heartrate Monitor';
|
|
76
75
|
AntHrAdapter.ANT_PROFILE_NAME = 'HR';
|
|
76
|
+
exports.default = AntHrAdapter;
|
package/lib/antv2/pwr/adapter.js
CHANGED
|
@@ -136,6 +136,6 @@ class AntPwrAdapter extends adapter_1.ControllableAntAdapter {
|
|
|
136
136
|
TimeStamp !== undefined || TimeStamp !== null;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
exports.default = AntPwrAdapter;
|
|
140
139
|
AntPwrAdapter.INCYCLIST_PROFILE_NAME = 'Power Meter';
|
|
141
140
|
AntPwrAdapter.ANT_PROFILE_NAME = 'PWR';
|
|
141
|
+
exports.default = AntPwrAdapter;
|
|
@@ -42,7 +42,7 @@ export declare class StaticWriteCharacteristic extends MockCharacteristic {
|
|
|
42
42
|
}
|
|
43
43
|
export declare abstract class StaticNotifyCharacteristic extends MockCharacteristic {
|
|
44
44
|
cntSubscriptions: number;
|
|
45
|
-
iv: NodeJS.
|
|
45
|
+
iv: NodeJS.Timeout;
|
|
46
46
|
notifyFrequency: number;
|
|
47
47
|
constructor(uuid: string, description: string);
|
|
48
48
|
subscribe(callback: (err: Error | undefined) => void): void;
|
package/lib/ble/cp/comm.js
CHANGED
|
@@ -118,8 +118,8 @@ class BleCyclingPowerDevice extends comms_1.BleComms {
|
|
|
118
118
|
this.prevCrankData = undefined;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
exports.default = BleCyclingPowerDevice;
|
|
122
121
|
BleCyclingPowerDevice.protocol = 'cp';
|
|
123
122
|
BleCyclingPowerDevice.services = [consts_1.CSP];
|
|
124
123
|
BleCyclingPowerDevice.characteristics = [consts_1.CSP_MEASUREMENT, consts_1.CSP_FEATURE, '2a5d', '2a3c'];
|
|
125
124
|
BleCyclingPowerDevice.detectionPriority = 1;
|
|
125
|
+
exports.default = BleCyclingPowerDevice;
|
package/lib/ble/elite/comms.js
CHANGED
|
@@ -119,8 +119,8 @@ class BleEliteDevice extends comms_1.BleComms {
|
|
|
119
119
|
this.prevCrankData = undefined;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
exports.default = BleEliteDevice;
|
|
123
122
|
BleEliteDevice.protocol = 'elite';
|
|
124
123
|
BleEliteDevice.services = [consts_1.ELITE_TRAINER_SVC];
|
|
125
124
|
BleEliteDevice.characteristics = [consts_1.CSP_MEASUREMENT, consts_1.CSP_FEATURE, '2a5d', '2a3c'];
|
|
126
125
|
BleEliteDevice.detectionPriority = 10;
|
|
126
|
+
exports.default = BleEliteDevice;
|
package/lib/ble/fm/comms.js
CHANGED
|
@@ -496,8 +496,8 @@ class BleFitnessMachineDevice extends comms_1.BleComms {
|
|
|
496
496
|
this.data = {};
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
exports.default = BleFitnessMachineDevice;
|
|
500
499
|
BleFitnessMachineDevice.protocol = 'fm';
|
|
501
500
|
BleFitnessMachineDevice.services = [consts_1.FTMS];
|
|
502
501
|
BleFitnessMachineDevice.characteristics = ['2acc', consts_1.INDOOR_BIKE_DATA, '2ad6', '2ad8', consts_1.FTMS_CP, consts_1.FTMS_STATUS];
|
|
503
502
|
BleFitnessMachineDevice.detectionPriority = 100;
|
|
503
|
+
exports.default = BleFitnessMachineDevice;
|
package/lib/ble/hr/comm.js
CHANGED
|
@@ -49,8 +49,8 @@ class BleHrmDevice extends comms_1.BleComms {
|
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
exports.default = BleHrmDevice;
|
|
53
52
|
BleHrmDevice.protocol = 'hr';
|
|
54
53
|
BleHrmDevice.services = ['180d'];
|
|
55
54
|
BleHrmDevice.characteristics = ['2a37', '2a38', '2a39', '2a3c'];
|
|
56
55
|
BleHrmDevice.detectionPriority = 1;
|
|
56
|
+
exports.default = BleHrmDevice;
|
package/lib/ble/tacx/comms.js
CHANGED
|
@@ -625,9 +625,9 @@ class TacxAdvancedFitnessMachineDevice extends comms_1.default {
|
|
|
625
625
|
this.data = {};
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
exports.default = TacxAdvancedFitnessMachineDevice;
|
|
629
628
|
TacxAdvancedFitnessMachineDevice.protocol = 'tacx';
|
|
630
629
|
TacxAdvancedFitnessMachineDevice.services = [consts_1.TACX_FE_C_BLE];
|
|
631
630
|
TacxAdvancedFitnessMachineDevice.characteristics = ['2acc', '2ad2', '2ad6', '2ad8', '2ad9', '2ada', consts_1.TACX_FE_C_RX, consts_1.TACX_FE_C_TX];
|
|
632
631
|
TacxAdvancedFitnessMachineDevice.PROFILE = PROFILE_ID;
|
|
633
632
|
TacxAdvancedFitnessMachineDevice.detectionPriority = 10;
|
|
633
|
+
exports.default = TacxAdvancedFitnessMachineDevice;
|
package/lib/ble/wahoo/comms.js
CHANGED
|
@@ -391,8 +391,8 @@ class BleWahooDevice extends comms_1.default {
|
|
|
391
391
|
this.simModeSettings = undefined;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
exports.default = BleWahooDevice;
|
|
395
394
|
BleWahooDevice.protocol = 'wahoo';
|
|
396
395
|
BleWahooDevice.services = [consts_1.CSP];
|
|
397
396
|
BleWahooDevice.characteristics = ['2acc', '2ad2', '2ad6', '2ad8', '2ad9', '2ada', consts_1.WAHOO_ADVANCED_TRAINER_CP];
|
|
398
397
|
BleWahooDevice.detectionPriority = 5;
|
|
398
|
+
exports.default = BleWahooDevice;
|
package/lib/index.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ import { IncyclistCapability } from './types/capabilities';
|
|
|
8
8
|
import { DeviceData } from './types/data';
|
|
9
9
|
import { DeviceSettings } from './types/device';
|
|
10
10
|
import CyclingMode from './modes/cycling-mode';
|
|
11
|
+
import calc from './utils/calculations';
|
|
11
12
|
export * from './modes/cycling-mode';
|
|
12
13
|
export * from './serial';
|
|
13
14
|
export * from './ble';
|
|
14
15
|
export * from './antv2';
|
|
15
|
-
export { IncyclistInterface, INTERFACE, InterfaceFactory, InterfaceProps, DeviceSettings, CyclingMode, AdapterFactory, IncyclistDeviceAdapter, Controllable, ControllableDeviceAdapter, DeviceData, IncyclistCapability, };
|
|
16
|
+
export { IncyclistInterface, INTERFACE, InterfaceFactory, InterfaceProps, DeviceSettings, CyclingMode, AdapterFactory, IncyclistDeviceAdapter, Controllable, ControllableDeviceAdapter, DeviceData, IncyclistCapability, calc, };
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.IncyclistCapability = exports.ControllableDeviceAdapter = exports.AdapterFactory = exports.InterfaceFactory = exports.INTERFACE = void 0;
|
|
20
|
+
exports.calc = exports.IncyclistCapability = exports.ControllableDeviceAdapter = exports.AdapterFactory = exports.InterfaceFactory = exports.INTERFACE = void 0;
|
|
21
21
|
const device_1 = require("./types/device");
|
|
22
22
|
Object.defineProperty(exports, "INTERFACE", { enumerable: true, get: function () { return device_1.INTERFACE; } });
|
|
23
23
|
const interfaces_1 = __importDefault(require("./interfaces"));
|
|
@@ -28,6 +28,8 @@ const adpater_1 = require("./base/adpater");
|
|
|
28
28
|
Object.defineProperty(exports, "ControllableDeviceAdapter", { enumerable: true, get: function () { return adpater_1.ControllableDevice; } });
|
|
29
29
|
const capabilities_1 = require("./types/capabilities");
|
|
30
30
|
Object.defineProperty(exports, "IncyclistCapability", { enumerable: true, get: function () { return capabilities_1.IncyclistCapability; } });
|
|
31
|
+
const calculations_1 = __importDefault(require("./utils/calculations"));
|
|
32
|
+
exports.calc = calculations_1.default;
|
|
31
33
|
__exportStar(require("./modes/cycling-mode"), exports);
|
|
32
34
|
__exportStar(require("./serial"), exports);
|
|
33
35
|
__exportStar(require("./ble"), exports);
|
|
@@ -9,7 +9,7 @@ var CyclingModeProperyType;
|
|
|
9
9
|
CyclingModeProperyType["String"] = "String";
|
|
10
10
|
CyclingModeProperyType["SingleSelect"] = "SingleSelect";
|
|
11
11
|
CyclingModeProperyType["MultiSelect"] = "MultiSelect";
|
|
12
|
-
})(CyclingModeProperyType
|
|
12
|
+
})(CyclingModeProperyType || (exports.CyclingModeProperyType = CyclingModeProperyType = {}));
|
|
13
13
|
class CyclingModeBase {
|
|
14
14
|
constructor(adapter, props) {
|
|
15
15
|
this.settings = {};
|
package/lib/modes/simulator.js
CHANGED
|
@@ -16,6 +16,7 @@ exports.TCPPortBinding = exports.TCPBinding = exports.getSubnets = exports.scanS
|
|
|
16
16
|
const gd_eventlog_1 = require("gd-eventlog");
|
|
17
17
|
const os_1 = require("os");
|
|
18
18
|
const net_1 = __importDefault(require("net"));
|
|
19
|
+
const DEFAULT_TIMEOUT = 3000;
|
|
19
20
|
function resolveNextTick() {
|
|
20
21
|
return new Promise(resolve => process.nextTick(() => resolve()));
|
|
21
22
|
}
|
|
@@ -123,8 +124,7 @@ exports.TCPBinding = {
|
|
|
123
124
|
return reject(new TypeError('"path" is not valid'));
|
|
124
125
|
}
|
|
125
126
|
const socket = new net_1.default.Socket();
|
|
126
|
-
|
|
127
|
-
socket.setTimeout(options.timeout);
|
|
127
|
+
socket.setTimeout(options.timeout || DEFAULT_TIMEOUT);
|
|
128
128
|
socket.once('timeout', () => { reject(new Error('timeout')); });
|
|
129
129
|
socket.once('error', (err) => { reject(err); });
|
|
130
130
|
socket.once('connect', () => { resolve(socket); });
|
|
@@ -145,6 +145,7 @@ class TCPPortBinding {
|
|
|
145
145
|
this.pendingRead = null;
|
|
146
146
|
this.writeOperation = null;
|
|
147
147
|
this.data = null;
|
|
148
|
+
this.socket.removeAllListeners();
|
|
148
149
|
this.socket.on('data', this.onData.bind(this));
|
|
149
150
|
this.socket.on('error', this.onError.bind(this));
|
|
150
151
|
this.socket.on('close', () => { this.close(); });
|
|
@@ -175,14 +176,20 @@ class TCPPortBinding {
|
|
|
175
176
|
if (!this.isOpen)
|
|
176
177
|
return;
|
|
177
178
|
this.data = Buffer.alloc(0);
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
const close = () => __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
return new Promise(done => {
|
|
181
|
+
const socket = this.socket;
|
|
182
|
+
socket.on('error', () => { done(false); });
|
|
183
|
+
socket.on('close', () => { socket.removeAllListeners(); done(true); });
|
|
184
|
+
socket.destroy();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
const closed = yield close();
|
|
188
|
+
if (closed) {
|
|
189
|
+
this.socket = null;
|
|
190
|
+
if (this.pendingRead) {
|
|
191
|
+
this.pendingRead(new CanceledError('port is closed'));
|
|
192
|
+
}
|
|
186
193
|
}
|
|
187
194
|
});
|
|
188
195
|
}
|
|
@@ -24,7 +24,7 @@ var direction;
|
|
|
24
24
|
(function (direction) {
|
|
25
25
|
direction["up"] = "up";
|
|
26
26
|
direction["down"] = "down";
|
|
27
|
-
})(direction
|
|
27
|
+
})(direction || (exports.direction = direction = {}));
|
|
28
28
|
class SmartTrainerCyclingMode extends cycling_mode_1.CyclingModeBase {
|
|
29
29
|
constructor(adapter, props) {
|
|
30
30
|
super(adapter, props);
|
|
@@ -183,13 +183,13 @@ var ReservedCommands;
|
|
|
183
183
|
ReservedCommands[ReservedCommands["RELAX_GET_DATA"] = 15] = "RELAX_GET_DATA";
|
|
184
184
|
ReservedCommands[ReservedCommands["KEY_PRESSED"] = 16] = "KEY_PRESSED";
|
|
185
185
|
ReservedCommands[ReservedCommands["PROGRAM_CONTROL"] = 17] = "PROGRAM_CONTROL";
|
|
186
|
-
})(ReservedCommands
|
|
186
|
+
})(ReservedCommands || (exports.ReservedCommands = ReservedCommands = {}));
|
|
187
187
|
var BikeType;
|
|
188
188
|
(function (BikeType) {
|
|
189
189
|
BikeType[BikeType["ALLROUND"] = 0] = "ALLROUND";
|
|
190
190
|
BikeType[BikeType["RACE"] = 1] = "RACE";
|
|
191
191
|
BikeType[BikeType["MOUNTAIN"] = 2] = "MOUNTAIN";
|
|
192
|
-
})(BikeType
|
|
192
|
+
})(BikeType || (exports.BikeType = BikeType = {}));
|
|
193
193
|
function getBikeType(bikeTypeStr) {
|
|
194
194
|
if (bikeTypeStr === undefined || bikeTypeStr === null)
|
|
195
195
|
return BikeType.RACE;
|
|
@@ -32,13 +32,13 @@ var SerialCommsState;
|
|
|
32
32
|
SerialCommsState[SerialCommsState["Disconnecting"] = 3] = "Disconnecting";
|
|
33
33
|
SerialCommsState[SerialCommsState["Disconnected"] = 4] = "Disconnected";
|
|
34
34
|
SerialCommsState[SerialCommsState["Error"] = 5] = "Error";
|
|
35
|
-
})(SerialCommsState
|
|
35
|
+
})(SerialCommsState || (exports.SerialCommsState = SerialCommsState = {}));
|
|
36
36
|
var SendState;
|
|
37
37
|
(function (SendState) {
|
|
38
38
|
SendState[SendState["Idle"] = 0] = "Idle";
|
|
39
39
|
SendState[SendState["Sending"] = 1] = "Sending";
|
|
40
40
|
SendState[SendState["Receiving"] = 2] = "Receiving";
|
|
41
|
-
})(SendState
|
|
41
|
+
})(SendState || (exports.SendState = SendState = {}));
|
|
42
42
|
const getBikeProps = (props) => {
|
|
43
43
|
const { port, interface: ifaceName } = props;
|
|
44
44
|
let serial;
|
|
@@ -9,4 +9,4 @@ var IncyclistCapability;
|
|
|
9
9
|
IncyclistCapability["HeartRate"] = "heartrate";
|
|
10
10
|
IncyclistCapability["Gear"] = "gear";
|
|
11
11
|
IncyclistCapability["Control"] = "control";
|
|
12
|
-
})(IncyclistCapability
|
|
12
|
+
})(IncyclistCapability || (exports.IncyclistCapability = IncyclistCapability = {}));
|
package/lib/types/route.js
CHANGED
package/lib/types/user.js
CHANGED
package/package.json
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-devices",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@serialport/bindings-interface": "^1.2.2",
|
|
6
6
|
"@serialport/parser-byte-length": "^9.0.1",
|
|
7
7
|
"@serialport/parser-delimiter": "^9.0.1",
|
|
8
8
|
"@serialport/parser-readline": "^10.5.0",
|
|
9
9
|
"@serialport/stream": "^10.5.0",
|
|
10
|
-
"incyclist-ant-plus": "^0.
|
|
10
|
+
"incyclist-ant-plus": "^0.2.0",
|
|
11
11
|
"win32filetime": "^1.0.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"gd-eventlog": "^0.1.
|
|
14
|
+
"gd-eventlog": "^0.1.24"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@serialport/binding-mock": "^10.2.2",
|
|
18
18
|
"@serialport/bindings-cpp": "^10.8.0",
|
|
19
|
-
"@types/jest": "^29.
|
|
20
|
-
"@types/node": "^
|
|
21
|
-
"eslint": "^8.
|
|
19
|
+
"@types/jest": "^29.5.3",
|
|
20
|
+
"@types/node": "^20.5.0",
|
|
21
|
+
"eslint": "^8.47.0",
|
|
22
22
|
"eslint-config-react-app": "^7.0.1",
|
|
23
|
-
"jest": "^29.
|
|
24
|
-
"ts-jest": "^29.
|
|
25
|
-
"typescript": "^
|
|
23
|
+
"jest": "^29.6.2",
|
|
24
|
+
"ts-jest": "^29.1.1",
|
|
25
|
+
"typescript": "^5.1.6"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"lint": "eslint . --ext .ts",
|
|
29
29
|
"build": "tsc",
|
|
30
30
|
"test": "jest --coverage",
|
|
31
|
+
"test:ci": "jest --coverage --forceExit",
|
|
31
32
|
"dev": "tsc --watch"
|
|
32
33
|
},
|
|
33
34
|
"files": [
|