incyclist-devices 3.0.38 → 3.0.41
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/cjs/ble/base/interface.js +15 -0
- package/lib/cjs/ble/base/peripheral.js +26 -7
- package/lib/cjs/ble/bkool/adapter.js +49 -0
- package/lib/cjs/ble/bkool/consts.js +11 -0
- package/lib/cjs/ble/bkool/index.js +10 -0
- package/lib/cjs/ble/bkool/sensor.js +160 -0
- package/lib/cjs/ble/characteristics/csc/measurement.js +4 -37
- package/lib/cjs/ble/cp/sensor.js +4 -36
- package/lib/cjs/ble/crank-cadence.js +49 -0
- package/lib/cjs/ble/fe-c-pages.js +56 -0
- package/lib/cjs/ble/fm/adapter.js +5 -0
- package/lib/cjs/ble/index.js +13 -10
- package/lib/cjs/ble/tacx/sensor.js +10 -127
- package/lib/cjs/ble/wahoo/sensor.js +3 -33
- package/lib/cjs/ble/zwift/play/sensor.js +3 -0
- package/lib/esm/ble/base/interface.js +15 -0
- package/lib/esm/ble/base/peripheral.js +26 -7
- package/lib/esm/ble/bkool/adapter.js +43 -0
- package/lib/esm/ble/bkool/consts.js +7 -0
- package/lib/esm/ble/bkool/index.js +3 -0
- package/lib/esm/ble/bkool/sensor.js +154 -0
- package/lib/esm/ble/characteristics/csc/measurement.js +4 -37
- package/lib/esm/ble/cp/sensor.js +4 -36
- package/lib/esm/ble/crank-cadence.js +45 -0
- package/lib/esm/ble/fe-c-pages.js +48 -0
- package/lib/esm/ble/fm/adapter.js +5 -0
- package/lib/esm/ble/index.js +3 -1
- package/lib/esm/ble/tacx/sensor.js +10 -127
- package/lib/esm/ble/wahoo/sensor.js +3 -33
- package/lib/esm/ble/zwift/play/sensor.js +3 -0
- package/lib/types/ble/base/interface.d.ts +1 -0
- package/lib/types/ble/base/peripheral.d.ts +3 -0
- package/lib/types/ble/bkool/adapter.d.ts +13 -0
- package/lib/types/ble/bkool/consts.d.ts +5 -0
- package/lib/types/ble/bkool/index.d.ts +3 -0
- package/lib/types/ble/bkool/sensor.d.ts +35 -0
- package/lib/types/ble/characteristics/csc/measurement.d.ts +2 -9
- package/lib/types/ble/cp/sensor.d.ts +3 -8
- package/lib/types/ble/crank-cadence.d.ts +20 -0
- package/lib/types/ble/fe-c-pages.d.ts +12 -0
- package/lib/types/ble/fm/adapter.d.ts +1 -0
- package/lib/types/ble/index.d.ts +2 -1
- package/lib/types/ble/tacx/sensor.d.ts +2 -11
- package/lib/types/ble/types.d.ts +2 -2
- package/lib/types/ble/wahoo/sensor.d.ts +2 -8
- package/lib/types/ble/zwift/play/sensor.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ const peripheral_js_1 = require("./peripheral.js");
|
|
|
8
8
|
const utils_js_1 = require("../utils.js");
|
|
9
9
|
const types_js_1 = require("./types.js");
|
|
10
10
|
const index_js_1 = require("../factories/index.js");
|
|
11
|
+
const consts_js_1 = require("../consts.js");
|
|
12
|
+
const consts_js_2 = require("../bkool/consts.js");
|
|
11
13
|
const BLE_EXPIRATION_TIMEOUT = 10 * 1000 * 60;
|
|
12
14
|
const BLE_DEFAULT_CONNECT_TIMEOUT = 30 * 1000;
|
|
13
15
|
let instanceCount = 0;
|
|
@@ -436,8 +438,21 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
436
438
|
this.processEnrichedAnnouncement(announcement);
|
|
437
439
|
return;
|
|
438
440
|
}
|
|
441
|
+
const isBkool = this.checkForBkoolEnhancement(announcement);
|
|
442
|
+
if (isBkool) {
|
|
443
|
+
this.processEnrichedAnnouncement(announcement);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
439
446
|
this.addService(announcement);
|
|
440
447
|
}
|
|
448
|
+
checkForBkoolEnhancement(announcement) {
|
|
449
|
+
if (!(0, consts_js_2.isBkoolDeviceName)(announcement.name))
|
|
450
|
+
return false;
|
|
451
|
+
const supported = new Set(announcement.serviceUUIDs.map(s => (0, utils_js_1.beautifyUUID)(s)));
|
|
452
|
+
const cp = (0, utils_js_1.beautifyUUID)(consts_js_1.CSP);
|
|
453
|
+
const bkoolService = (0, utils_js_1.beautifyUUID)(consts_js_2.BKOOL_SERVICE);
|
|
454
|
+
return supported.has(cp) && !supported.has(bkoolService);
|
|
455
|
+
}
|
|
441
456
|
checkForWahooEnhancement(announcement) {
|
|
442
457
|
if (announcement.name.includes('KICKR') || announcement.name.includes('Zwift')) {
|
|
443
458
|
const supported = announcement.serviceUUIDs.map(s => (0, utils_js_1.beautifyUUID)(s));
|
|
@@ -5,6 +5,8 @@ const utils_js_1 = require("../../utils/utils.js");
|
|
|
5
5
|
const utils_js_2 = require("../utils.js");
|
|
6
6
|
const interface_js_1 = require("./interface.js");
|
|
7
7
|
const SERVICE_COMPLETENESS_WHITELIST = ['MRK-R15'];
|
|
8
|
+
const POST_CONNECT_DISCOVERY_ATTEMPTS = 4;
|
|
9
|
+
const POST_CONNECT_DISCOVERY_BACKOFF_MS = 1000;
|
|
8
10
|
class BlePeripheral {
|
|
9
11
|
announcement;
|
|
10
12
|
connected = false;
|
|
@@ -19,6 +21,7 @@ class BlePeripheral {
|
|
|
19
21
|
serviceDiscoveryIncomplete = false;
|
|
20
22
|
discoverServicesPromise;
|
|
21
23
|
discoverCharacteristicsPromise = {};
|
|
24
|
+
awaitingPostConnectDiscovery = false;
|
|
22
25
|
onErrorHandler = this.onPeripheralError.bind(this);
|
|
23
26
|
constructor(announcement) {
|
|
24
27
|
this.announcement = announcement;
|
|
@@ -70,6 +73,7 @@ class BlePeripheral {
|
|
|
70
73
|
peripheral.once('disconnect', () => { this.onPeripheralDisconnect(); });
|
|
71
74
|
peripheral.on('error', this.onErrorHandler);
|
|
72
75
|
this.connected = true;
|
|
76
|
+
this.awaitingPostConnectDiscovery = true;
|
|
73
77
|
done();
|
|
74
78
|
})
|
|
75
79
|
.catch(() => {
|
|
@@ -233,7 +237,7 @@ class BlePeripheral {
|
|
|
233
237
|
async subscribe(characteristicUUID, callback) {
|
|
234
238
|
try {
|
|
235
239
|
if (this.disconnecting || !this.connected) {
|
|
236
|
-
this.logEvent({ message: 'peripheral subscribe failed',
|
|
240
|
+
this.logEvent({ message: 'peripheral subscribe failed', characteristic: (0, utils_js_2.beautifyUUID)(characteristicUUID), reason: 'not connected',
|
|
237
241
|
disconnecting: this.disconnecting, connected: this.connected
|
|
238
242
|
});
|
|
239
243
|
return false;
|
|
@@ -247,7 +251,7 @@ class BlePeripheral {
|
|
|
247
251
|
};
|
|
248
252
|
const subscription = this.subscribed.find(s => s.uuid === uuid);
|
|
249
253
|
if (subscription) {
|
|
250
|
-
this.logEvent({ message: 'peripheral subscribe skipped',
|
|
254
|
+
this.logEvent({ message: 'peripheral subscribe skipped', characteristic: (0, utils_js_2.beautifyUUID)(characteristicUUID), reason: 'already subscribed' });
|
|
251
255
|
const c = this.getRawCharacteristic(characteristicUUID);
|
|
252
256
|
if (c) {
|
|
253
257
|
c.off('data', onData);
|
|
@@ -257,13 +261,13 @@ class BlePeripheral {
|
|
|
257
261
|
}
|
|
258
262
|
let c = await this.queryRawCharacteristic(characteristicUUID).catch(() => null);
|
|
259
263
|
if (!c) {
|
|
260
|
-
this.logEvent({ message: 'peripheral subscribe failed',
|
|
264
|
+
this.logEvent({ message: 'peripheral subscribe failed', characteristic: (0, utils_js_2.beautifyUUID)(characteristicUUID), reason: 'not found' });
|
|
261
265
|
return false;
|
|
262
266
|
}
|
|
263
267
|
return new Promise((resolve, reject) => {
|
|
264
268
|
const info = this.subscribed.find(s => s.uuid === characteristicUUID);
|
|
265
269
|
if (info) {
|
|
266
|
-
this.logEvent({ message: 'peripheral subscribe skipped',
|
|
270
|
+
this.logEvent({ message: 'peripheral subscribe skipped', characteristic: (0, utils_js_2.beautifyUUID)(characteristicUUID), reason: 'already subscribed' });
|
|
267
271
|
return Promise.resolve(true);
|
|
268
272
|
}
|
|
269
273
|
this.logEvent({ message: 'subscribe request', address: this.getPeripheral().address, characteristic: uuid, success: true });
|
|
@@ -357,10 +361,10 @@ class BlePeripheral {
|
|
|
357
361
|
else {
|
|
358
362
|
const uuid = (0, utils_js_2.beautifyUUID)(element);
|
|
359
363
|
if (c?.properties) {
|
|
360
|
-
this.logEvent({ message: 'cannot subscribe', uuid, reason: 'invalid type', properties: c.properties.join('|') });
|
|
364
|
+
this.logEvent({ message: 'cannot subscribe', characteristics: (0, utils_js_2.beautifyUUID)(uuid), reason: 'invalid type', properties: c.properties.join('|') });
|
|
361
365
|
}
|
|
362
366
|
else {
|
|
363
|
-
this.logEvent({ message: 'cannot subscribe', uuid, reason: 'not found' });
|
|
367
|
+
this.logEvent({ message: 'cannot subscribe', characteristics: (0, utils_js_2.beautifyUUID)(uuid), reason: 'not found' });
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
}
|
|
@@ -371,11 +375,26 @@ class BlePeripheral {
|
|
|
371
375
|
return true;
|
|
372
376
|
}
|
|
373
377
|
catch (err) {
|
|
374
|
-
this.logEvent({ message: 'Error', fn: 'subscribeSelected', error: err.message, stack: err.stack });
|
|
378
|
+
this.logEvent({ message: 'Error', fn: 'subscribeSelected', uuids, error: err.message, stack: err.stack });
|
|
375
379
|
return false;
|
|
376
380
|
}
|
|
377
381
|
}
|
|
378
382
|
async discoverAllCharacteristics() {
|
|
383
|
+
const attempts = this.awaitingPostConnectDiscovery ? POST_CONNECT_DISCOVERY_ATTEMPTS : 1;
|
|
384
|
+
return this.discoverAllCharacteristicsAttempt(1, attempts);
|
|
385
|
+
}
|
|
386
|
+
async discoverAllCharacteristicsAttempt(attempt, maxAttempts) {
|
|
387
|
+
const found = await this.queryAllCharacteristics();
|
|
388
|
+
if (found.length > 0 || attempt >= maxAttempts) {
|
|
389
|
+
this.awaitingPostConnectDiscovery = false;
|
|
390
|
+
return found;
|
|
391
|
+
}
|
|
392
|
+
const { name, address } = this.getInfo();
|
|
393
|
+
this.logEvent({ message: 'discover all characteristics empty after connect - retrying', name, address, attempt });
|
|
394
|
+
await (0, utils_js_1.sleep)(POST_CONNECT_DISCOVERY_BACKOFF_MS * attempt);
|
|
395
|
+
return this.discoverAllCharacteristicsAttempt(attempt + 1, maxAttempts);
|
|
396
|
+
}
|
|
397
|
+
async queryAllCharacteristics() {
|
|
379
398
|
try {
|
|
380
399
|
const { name, address } = this.getInfo();
|
|
381
400
|
this.logEvent({ message: 'discover all characteristics', name, address });
|
|
@@ -0,0 +1,49 @@
|
|
|
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 gd_eventlog_1 = require("gd-eventlog");
|
|
7
|
+
const index_js_1 = require("../fm/index.js");
|
|
8
|
+
const sensor_js_1 = __importDefault(require("./sensor.js"));
|
|
9
|
+
const consts_js_1 = require("../../base/consts.js");
|
|
10
|
+
const index_js_2 = require("../../types/index.js");
|
|
11
|
+
class BleBkoolAdapter extends index_js_1.BleFmAdapter {
|
|
12
|
+
static INCYCLIST_PROFILE_NAME = 'Smart Trainer';
|
|
13
|
+
constructor(settings, props) {
|
|
14
|
+
super(settings, props);
|
|
15
|
+
this.logger = new gd_eventlog_1.EventLogger('BLE-BkoolFM');
|
|
16
|
+
this.device = new sensor_js_1.default(this.getPeripheral(), { logger: this.logger });
|
|
17
|
+
this.capabilities = [
|
|
18
|
+
index_js_2.IncyclistCapability.Power, index_js_2.IncyclistCapability.Speed, index_js_2.IncyclistCapability.Cadence,
|
|
19
|
+
index_js_2.IncyclistCapability.Control
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
isSame(device) {
|
|
23
|
+
if (!(device instanceof BleBkoolAdapter))
|
|
24
|
+
return false;
|
|
25
|
+
return this.isEqual(device.settings);
|
|
26
|
+
}
|
|
27
|
+
getProfile() {
|
|
28
|
+
return 'Smart Trainer';
|
|
29
|
+
}
|
|
30
|
+
updateSensor(peripheral) {
|
|
31
|
+
this.device = new sensor_js_1.default(peripheral, { logger: this.logger });
|
|
32
|
+
}
|
|
33
|
+
async initControl(props) {
|
|
34
|
+
const sensor = this.getSensor();
|
|
35
|
+
const { user, wheelDiameter, gearRatio, bikeWeight = consts_js_1.DEFAULT_BIKE_WEIGHT } = props || {};
|
|
36
|
+
const userWeight = user?.weight ?? consts_js_1.DEFAULT_USER_WEIGHT;
|
|
37
|
+
await sensor.sendBasicResistance(0);
|
|
38
|
+
await sensor.sendWindResistance(sensor.getCw(), sensor.getWindSpeed(), 0);
|
|
39
|
+
await sensor.sendTrackResistance(0, sensor.getCrr());
|
|
40
|
+
await sensor.sendUserConfiguration(userWeight, bikeWeight, wheelDiameter, gearRatio);
|
|
41
|
+
const startRequest = this.getCyclingMode().getBikeInitRequest();
|
|
42
|
+
await this.sendUpdate(startRequest);
|
|
43
|
+
}
|
|
44
|
+
checkCapabilities() {
|
|
45
|
+
this.logEvent({ message: 'device capabilities updated', name: this.getSettings().name, interface: this.getSettings().interface, capabilities: this.capabilities });
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = BleBkoolAdapter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BKOOL_FRAME_MARKER = exports.BKOOL_NAME_PREFIX = exports.BKOOL_CONTROL = exports.BKOOL_SERVICE = void 0;
|
|
4
|
+
exports.isBkoolDeviceName = isBkoolDeviceName;
|
|
5
|
+
exports.BKOOL_SERVICE = 'f03eee01-4910-473c-be46-960948c2f59c';
|
|
6
|
+
exports.BKOOL_CONTROL = 'f03ee002-4910-473c-be46-960948c2f59c';
|
|
7
|
+
exports.BKOOL_NAME_PREFIX = 'BKOOLSMARTPRO';
|
|
8
|
+
function isBkoolDeviceName(name) {
|
|
9
|
+
return !!name && name.toUpperCase().startsWith(exports.BKOOL_NAME_PREFIX);
|
|
10
|
+
}
|
|
11
|
+
exports.BKOOL_FRAME_MARKER = 0x25;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
exports.BleBkoolComms = exports.BleBkoolAdapter = void 0;
|
|
7
|
+
const sensor_js_1 = __importDefault(require("./sensor.js"));
|
|
8
|
+
exports.BleBkoolComms = sensor_js_1.default;
|
|
9
|
+
const adapter_js_1 = __importDefault(require("./adapter.js"));
|
|
10
|
+
exports.BleBkoolAdapter = adapter_js_1.default;
|
|
@@ -0,0 +1,160 @@
|
|
|
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 consts_js_1 = require("../consts.js");
|
|
7
|
+
const consts_js_2 = require("./consts.js");
|
|
8
|
+
const fe_c_pages_js_1 = require("../fe-c-pages.js");
|
|
9
|
+
const sensor_js_1 = __importDefault(require("../fm/sensor.js"));
|
|
10
|
+
const utils_js_1 = require("../utils.js");
|
|
11
|
+
const crank_cadence_js_1 = require("../crank-cadence.js");
|
|
12
|
+
class BleBkoolDevice extends sensor_js_1.default {
|
|
13
|
+
static profile = 'Smart Trainer';
|
|
14
|
+
static protocol = 'bkool';
|
|
15
|
+
static services = [consts_js_1.CSP, consts_js_2.BKOOL_SERVICE];
|
|
16
|
+
static characteristics = [consts_js_1.CSP_MEASUREMENT, consts_js_2.BKOOL_CONTROL];
|
|
17
|
+
static detectionPriority = 5;
|
|
18
|
+
crankCadence = new crank_cadence_js_1.CrankCadenceCalculator();
|
|
19
|
+
constructor(peripheral, props) {
|
|
20
|
+
super(peripheral, props);
|
|
21
|
+
this.data = {};
|
|
22
|
+
this._features = {
|
|
23
|
+
fitnessMachine: 0, targetSettings: 0,
|
|
24
|
+
power: true, cadence: true, heartrate: this.supportsHeartRate(),
|
|
25
|
+
setPower: true, setSlope: true, setResistance: true
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
isMatching(serviceUUIDs) {
|
|
29
|
+
const uuids = new Set(serviceUUIDs.map(uuid => (0, utils_js_1.beautifyUUID)(uuid)));
|
|
30
|
+
return uuids.has((0, utils_js_1.beautifyUUID)(consts_js_1.CSP)) && uuids.has((0, utils_js_1.beautifyUUID)(consts_js_2.BKOOL_SERVICE));
|
|
31
|
+
}
|
|
32
|
+
reset() {
|
|
33
|
+
this.data = {};
|
|
34
|
+
}
|
|
35
|
+
getRequiredCharacteristics() {
|
|
36
|
+
return [consts_js_1.CSP_MEASUREMENT, consts_js_2.BKOOL_CONTROL];
|
|
37
|
+
}
|
|
38
|
+
onData(characteristic, characteristicData) {
|
|
39
|
+
const data = Buffer.from(characteristicData);
|
|
40
|
+
const uuid = (0, utils_js_1.beautifyUUID)(characteristic).toLowerCase();
|
|
41
|
+
let res;
|
|
42
|
+
if (uuid === consts_js_1.CSP_MEASUREMENT) {
|
|
43
|
+
res = this.parsePower(data);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.logEvent({ message: 'data', uuid, data: Buffer.from(data).toString('hex') });
|
|
47
|
+
}
|
|
48
|
+
if (res) {
|
|
49
|
+
this.emit('data', res);
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
requestControl() {
|
|
55
|
+
return Promise.resolve(true);
|
|
56
|
+
}
|
|
57
|
+
async setTargetPower(power) {
|
|
58
|
+
this.logEvent({ message: 'setTargetPower', power, skip: (this.data.targetPower !== undefined && this.data.targetPower === power) });
|
|
59
|
+
if (this.data.targetPower !== undefined && this.data.targetPower === power)
|
|
60
|
+
return true;
|
|
61
|
+
const res = await this.sendTargetPower(power);
|
|
62
|
+
if (res)
|
|
63
|
+
this.data.targetPower = power;
|
|
64
|
+
return res;
|
|
65
|
+
}
|
|
66
|
+
async setSlope(slope) {
|
|
67
|
+
this.logEvent({ message: 'setSlope', slope });
|
|
68
|
+
if (this.data.targetInclination !== undefined && this.data.targetInclination === slope)
|
|
69
|
+
return true;
|
|
70
|
+
const res = await this.sendTrackResistance(slope, this.crr);
|
|
71
|
+
if (res)
|
|
72
|
+
this.data.targetInclination = slope;
|
|
73
|
+
return res;
|
|
74
|
+
}
|
|
75
|
+
async setTargetResistanceLevel(resistanceLevel) {
|
|
76
|
+
return await this.setSlope(resistanceLevel / 10);
|
|
77
|
+
}
|
|
78
|
+
async sendBasicResistance(resistance) {
|
|
79
|
+
return await this.sendFrame((0, fe_c_pages_js_1.buildBasicResistancePage)(resistance, consts_js_2.BKOOL_FRAME_MARKER));
|
|
80
|
+
}
|
|
81
|
+
async sendTargetPower(power) {
|
|
82
|
+
return await this.sendFrame((0, fe_c_pages_js_1.buildTargetPowerPage)(power, consts_js_2.BKOOL_FRAME_MARKER));
|
|
83
|
+
}
|
|
84
|
+
async sendWindResistance(windCoeff, windSpeed, draftFactor) {
|
|
85
|
+
return await this.sendFrame((0, fe_c_pages_js_1.buildWindResistancePage)(windCoeff, windSpeed, draftFactor, consts_js_2.BKOOL_FRAME_MARKER));
|
|
86
|
+
}
|
|
87
|
+
async sendTrackResistance(slope, rrCoeff) {
|
|
88
|
+
return await this.sendFrame((0, fe_c_pages_js_1.buildTrackResistancePage)(slope, rrCoeff, consts_js_2.BKOOL_FRAME_MARKER));
|
|
89
|
+
}
|
|
90
|
+
async sendUserConfiguration(userWeight, bikeWeight, wheelDiameter, gearRatio) {
|
|
91
|
+
return await this.sendFrame((0, fe_c_pages_js_1.buildUserConfigurationPage)(userWeight, bikeWeight, wheelDiameter, gearRatio));
|
|
92
|
+
}
|
|
93
|
+
async sendFrame(frame) {
|
|
94
|
+
const data = Buffer.from(frame);
|
|
95
|
+
this.logEvent({ message: 'bkool:write', data: data.toString('hex') });
|
|
96
|
+
try {
|
|
97
|
+
await this.write(consts_js_2.BKOOL_CONTROL, data, { withoutResponse: true });
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
this.logEvent({ message: 'bkool:write failed', reason: err.message });
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
parsePower(_data) {
|
|
106
|
+
const data = Buffer.from(_data);
|
|
107
|
+
try {
|
|
108
|
+
let offset = 4;
|
|
109
|
+
const flags = data.readUInt16LE(0);
|
|
110
|
+
this.data.instantaneousPower = data.readUInt16LE(2);
|
|
111
|
+
if (flags & 0x1)
|
|
112
|
+
offset++;
|
|
113
|
+
if (flags & 0x4)
|
|
114
|
+
offset += 2;
|
|
115
|
+
if (flags & 0x10)
|
|
116
|
+
offset += 6;
|
|
117
|
+
if (flags & 0x20) {
|
|
118
|
+
const crankData = {
|
|
119
|
+
revolutions: data.readUInt16LE(offset),
|
|
120
|
+
time: data.readUInt16LE(offset + 2)
|
|
121
|
+
};
|
|
122
|
+
const { rpm, time } = this.crankCadence.update(crankData);
|
|
123
|
+
this.data.cadence = rpm;
|
|
124
|
+
this.data.time = time;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
this.logEvent({ message: 'error', fn: 'parsePower', error: err.message, stack: err.stack });
|
|
129
|
+
}
|
|
130
|
+
const { instantaneousPower, cadence, time } = this.data;
|
|
131
|
+
return { instantaneousPower, cadence, time, raw: '2a63:' + data.toString('hex') };
|
|
132
|
+
}
|
|
133
|
+
supportsHeartRate() {
|
|
134
|
+
try {
|
|
135
|
+
if (!this.peripheral)
|
|
136
|
+
return false;
|
|
137
|
+
return this.peripheral.services?.find(s => (0, utils_js_1.beautifyUUID)(s.uuid) === (0, utils_js_1.beautifyUUID)('180d')) !== undefined;
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
this.logEvent({ message: 'error', fn: 'supportsHeartRate', error: err.message, stack: err.stack });
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
startRequest() {
|
|
145
|
+
return Promise.resolve(true);
|
|
146
|
+
}
|
|
147
|
+
stopRequest() {
|
|
148
|
+
return Promise.resolve(true);
|
|
149
|
+
}
|
|
150
|
+
PauseRequest() {
|
|
151
|
+
return Promise.resolve(true);
|
|
152
|
+
}
|
|
153
|
+
setTargetInclination(_inclination) {
|
|
154
|
+
return Promise.resolve(true);
|
|
155
|
+
}
|
|
156
|
+
getName() {
|
|
157
|
+
return this.peripheral?.getInfo().name ?? 'ble-bkool-device';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.default = BleBkoolDevice;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CscMeasurement = void 0;
|
|
4
4
|
const consts_js_1 = require("../../../base/consts.js");
|
|
5
|
+
const crank_cadence_js_1 = require("../../crank-cadence.js");
|
|
5
6
|
class CscMeasurement {
|
|
6
7
|
data;
|
|
7
|
-
|
|
8
|
-
currentCrankData = undefined;
|
|
8
|
+
crankCadence = new crank_cadence_js_1.CrankCadenceCalculator(true);
|
|
9
9
|
prevWheelData = undefined;
|
|
10
10
|
currentWheelData = undefined;
|
|
11
11
|
timeOffset = 0;
|
|
@@ -38,44 +38,12 @@ class CscMeasurement {
|
|
|
38
38
|
revolutions: data.readUInt16LE(offset),
|
|
39
39
|
time: data.readUInt16LE(offset + 2)
|
|
40
40
|
};
|
|
41
|
-
const { rpm } = this.
|
|
41
|
+
const { rpm } = this.crankCadence.update(crankData);
|
|
42
42
|
this.data.cadence = rpm;
|
|
43
43
|
}
|
|
44
44
|
this.data.raw = data.toString('hex');
|
|
45
45
|
return this.data;
|
|
46
46
|
}
|
|
47
|
-
parseCrankData(crankData) {
|
|
48
|
-
if (!this.prevCrankData) {
|
|
49
|
-
this.prevCrankData = { ...crankData, cntUpdateMissing: -1 };
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
const c = this.currentCrankData = crankData;
|
|
53
|
-
const p = this.prevCrankData;
|
|
54
|
-
let rpm = this.data.cadence;
|
|
55
|
-
let hasUpdate = c.time !== p.time;
|
|
56
|
-
if (hasUpdate) {
|
|
57
|
-
let time = c.time - p.time;
|
|
58
|
-
let revs = c.revolutions - p.revolutions;
|
|
59
|
-
if (c.time < p.time) {
|
|
60
|
-
time += 0x10000;
|
|
61
|
-
this.timeOffset += 0x10000;
|
|
62
|
-
}
|
|
63
|
-
if (c.revolutions < p.revolutions)
|
|
64
|
-
revs += 0x10000;
|
|
65
|
-
const seconds = time / 1024;
|
|
66
|
-
rpm = 60 * revs / seconds;
|
|
67
|
-
}
|
|
68
|
-
else if (p.cntUpdateMissing < 0 || p.cntUpdateMissing > 2) {
|
|
69
|
-
rpm = 0;
|
|
70
|
-
}
|
|
71
|
-
const cntUpdateMissing = p.cntUpdateMissing;
|
|
72
|
-
this.prevCrankData = this.currentCrankData;
|
|
73
|
-
if (hasUpdate)
|
|
74
|
-
this.prevCrankData.cntUpdateMissing = 0;
|
|
75
|
-
else
|
|
76
|
-
this.prevCrankData.cntUpdateMissing = cntUpdateMissing + 1;
|
|
77
|
-
return { rpm, time: this.timeOffset + c.time };
|
|
78
|
-
}
|
|
79
47
|
parseWheelData(wheelData) {
|
|
80
48
|
if (!this.prevWheelData) {
|
|
81
49
|
this.prevWheelData = { ...wheelData, cntUpdateMissing: -1 };
|
|
@@ -109,8 +77,7 @@ class CscMeasurement {
|
|
|
109
77
|
}
|
|
110
78
|
reset() {
|
|
111
79
|
this.data = {};
|
|
112
|
-
this.
|
|
113
|
-
this.currentCrankData = undefined;
|
|
80
|
+
this.crankCadence = new crank_cadence_js_1.CrankCadenceCalculator(true);
|
|
114
81
|
this.prevWheelData = undefined;
|
|
115
82
|
this.currentWheelData = undefined;
|
|
116
83
|
this.timeOffset = 0;
|
package/lib/cjs/ble/cp/sensor.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const consts_js_1 = require("../consts.js");
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
5
|
const sensor_js_1 = require("../base/sensor.js");
|
|
6
|
+
const crank_cadence_js_1 = require("../crank-cadence.js");
|
|
6
7
|
class BleCyclingPowerDevice extends sensor_js_1.TBleSensor {
|
|
7
8
|
static profile = 'Power Meter';
|
|
8
9
|
static protocol = 'cp';
|
|
@@ -13,39 +14,8 @@ class BleCyclingPowerDevice extends sensor_js_1.TBleSensor {
|
|
|
13
14
|
balance = undefined;
|
|
14
15
|
accTorque = undefined;
|
|
15
16
|
rpm = undefined;
|
|
16
|
-
timeOffset = 0;
|
|
17
17
|
time = undefined;
|
|
18
|
-
|
|
19
|
-
prevCrankData = undefined;
|
|
20
|
-
parseCrankData(crankData) {
|
|
21
|
-
if (!this.prevCrankData)
|
|
22
|
-
this.prevCrankData = { revolutions: 0, time: 0, cntUpdateMissing: -1 };
|
|
23
|
-
const c = this.currentCrankData = crankData;
|
|
24
|
-
const p = this.prevCrankData;
|
|
25
|
-
let rpm = this.rpm;
|
|
26
|
-
let hasUpdate = c.time !== p.time;
|
|
27
|
-
if (hasUpdate) {
|
|
28
|
-
let time = c.time - p.time;
|
|
29
|
-
let revs = c.revolutions - p.revolutions;
|
|
30
|
-
if (c.time < p.time) {
|
|
31
|
-
time += 0x10000;
|
|
32
|
-
this.timeOffset += 0x10000;
|
|
33
|
-
}
|
|
34
|
-
if (c.revolutions < p.revolutions)
|
|
35
|
-
revs += 0x10000;
|
|
36
|
-
rpm = 1024 * 60 * revs / time;
|
|
37
|
-
}
|
|
38
|
-
else if (p.cntUpdateMissing < 0 || p.cntUpdateMissing > 2) {
|
|
39
|
-
rpm = 0;
|
|
40
|
-
}
|
|
41
|
-
const cntUpdateMissing = p.cntUpdateMissing;
|
|
42
|
-
this.prevCrankData = this.currentCrankData;
|
|
43
|
-
if (hasUpdate)
|
|
44
|
-
this.prevCrankData.cntUpdateMissing = 0;
|
|
45
|
-
else
|
|
46
|
-
this.prevCrankData.cntUpdateMissing = cntUpdateMissing + 1;
|
|
47
|
-
return { rpm, time: this.timeOffset + c.time };
|
|
48
|
-
}
|
|
18
|
+
crankCadence = new crank_cadence_js_1.CrankCadenceCalculator();
|
|
49
19
|
parsePower(_data) {
|
|
50
20
|
const data = Buffer.from(_data);
|
|
51
21
|
try {
|
|
@@ -66,7 +36,7 @@ class BleCyclingPowerDevice extends sensor_js_1.TBleSensor {
|
|
|
66
36
|
revolutions: data.readUInt16LE(offset),
|
|
67
37
|
time: data.readUInt16LE(offset + 2)
|
|
68
38
|
};
|
|
69
|
-
const { rpm, time } = this.
|
|
39
|
+
const { rpm, time } = this.crankCadence.update(crankData);
|
|
70
40
|
this.rpm = rpm;
|
|
71
41
|
this.time = time;
|
|
72
42
|
}
|
|
@@ -96,10 +66,8 @@ class BleCyclingPowerDevice extends sensor_js_1.TBleSensor {
|
|
|
96
66
|
this.balance = undefined;
|
|
97
67
|
this.accTorque = undefined;
|
|
98
68
|
this.rpm = undefined;
|
|
99
|
-
this.timeOffset = 0;
|
|
100
69
|
this.time = undefined;
|
|
101
|
-
this.
|
|
102
|
-
this.prevCrankData = undefined;
|
|
70
|
+
this.crankCadence = new crank_cadence_js_1.CrankCadenceCalculator();
|
|
103
71
|
}
|
|
104
72
|
}
|
|
105
73
|
exports.default = BleCyclingPowerDevice;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrankCadenceCalculator = void 0;
|
|
4
|
+
class CrankCadenceCalculator {
|
|
5
|
+
seedOnFirstSample;
|
|
6
|
+
prev;
|
|
7
|
+
timeOffset = 0;
|
|
8
|
+
rpm;
|
|
9
|
+
constructor(seedOnFirstSample = false) {
|
|
10
|
+
this.seedOnFirstSample = seedOnFirstSample;
|
|
11
|
+
}
|
|
12
|
+
update(sample) {
|
|
13
|
+
if (!this.prev) {
|
|
14
|
+
if (this.seedOnFirstSample) {
|
|
15
|
+
this.prev = { revolutions: sample.revolutions, time: sample.time, cntUpdateMissing: -1 };
|
|
16
|
+
return { rpm: undefined, time: undefined };
|
|
17
|
+
}
|
|
18
|
+
this.prev = { revolutions: 0, time: 0, cntUpdateMissing: -1 };
|
|
19
|
+
}
|
|
20
|
+
const p = this.prev;
|
|
21
|
+
const hasUpdate = sample.time !== p.time;
|
|
22
|
+
if (hasUpdate) {
|
|
23
|
+
let time = sample.time - p.time;
|
|
24
|
+
let revs = sample.revolutions - p.revolutions;
|
|
25
|
+
if (sample.time < p.time) {
|
|
26
|
+
time += 0x10000;
|
|
27
|
+
this.timeOffset += 0x10000;
|
|
28
|
+
}
|
|
29
|
+
if (sample.revolutions < p.revolutions)
|
|
30
|
+
revs += 0x10000;
|
|
31
|
+
this.rpm = 1024 * 60 * revs / time;
|
|
32
|
+
}
|
|
33
|
+
else if (p.cntUpdateMissing < 0 || p.cntUpdateMissing > 2) {
|
|
34
|
+
this.rpm = 0;
|
|
35
|
+
}
|
|
36
|
+
this.prev = {
|
|
37
|
+
revolutions: sample.revolutions,
|
|
38
|
+
time: sample.time,
|
|
39
|
+
cntUpdateMissing: hasUpdate ? 0 : p.cntUpdateMissing + 1
|
|
40
|
+
};
|
|
41
|
+
return { rpm: this.rpm, time: this.timeOffset + sample.time };
|
|
42
|
+
}
|
|
43
|
+
reset() {
|
|
44
|
+
this.prev = undefined;
|
|
45
|
+
this.timeOffset = 0;
|
|
46
|
+
this.rpm = undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.CrankCadenceCalculator = CrankCadenceCalculator;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FECPage = void 0;
|
|
4
|
+
exports.buildBasicResistancePage = buildBasicResistancePage;
|
|
5
|
+
exports.buildTargetPowerPage = buildTargetPowerPage;
|
|
6
|
+
exports.buildWindResistancePage = buildWindResistancePage;
|
|
7
|
+
exports.buildTrackResistancePage = buildTrackResistancePage;
|
|
8
|
+
exports.buildUserConfigurationPage = buildUserConfigurationPage;
|
|
9
|
+
var FECPage;
|
|
10
|
+
(function (FECPage) {
|
|
11
|
+
FECPage[FECPage["basicResistance"] = 48] = "basicResistance";
|
|
12
|
+
FECPage[FECPage["targetPower"] = 49] = "targetPower";
|
|
13
|
+
FECPage[FECPage["windResistance"] = 50] = "windResistance";
|
|
14
|
+
FECPage[FECPage["trackResistance"] = 51] = "trackResistance";
|
|
15
|
+
FECPage[FECPage["userConfiguration"] = 55] = "userConfiguration";
|
|
16
|
+
})(FECPage || (exports.FECPage = FECPage = {}));
|
|
17
|
+
const RESERVED = 0xFF;
|
|
18
|
+
function buildBasicResistancePage(resistancePercent, reservedByte1 = RESERVED) {
|
|
19
|
+
const res = resistancePercent === undefined ? RESERVED : Math.trunc(resistancePercent / 0.5) & 0xFF;
|
|
20
|
+
return [FECPage.basicResistance, reservedByte1, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, res];
|
|
21
|
+
}
|
|
22
|
+
function buildTargetPowerPage(powerWatts, reservedByte1 = RESERVED) {
|
|
23
|
+
const p = powerWatts === undefined ? 0xFFFF : Math.trunc(powerWatts * 4) & 0xFFFF;
|
|
24
|
+
return [FECPage.targetPower, reservedByte1, RESERVED, RESERVED, RESERVED, RESERVED, p & 0xFF, (p >> 8) & 0xFF];
|
|
25
|
+
}
|
|
26
|
+
function buildWindResistancePage(windCoeff, windSpeed, draftFactor, reservedByte1 = RESERVED) {
|
|
27
|
+
const wc = windCoeff === undefined ? RESERVED : Math.trunc(windCoeff / 0.01) & 0xFF;
|
|
28
|
+
const ws = windSpeed === undefined ? RESERVED : Math.trunc(windSpeed + 127) & 0xFF;
|
|
29
|
+
const df = draftFactor === undefined ? RESERVED : Math.trunc(draftFactor / 0.01) & 0xFF;
|
|
30
|
+
return [FECPage.windResistance, reservedByte1, RESERVED, RESERVED, RESERVED, wc, ws, df];
|
|
31
|
+
}
|
|
32
|
+
function buildTrackResistancePage(slopePercent, rrCoeff, reservedByte1 = RESERVED) {
|
|
33
|
+
const s = slopePercent === undefined ? 0xFFFF : Math.trunc((slopePercent + 200) / 0.01) & 0xFFFF;
|
|
34
|
+
const rr = rrCoeff === undefined ? RESERVED : Math.trunc(rrCoeff / 0.00005) & 0xFF;
|
|
35
|
+
return [FECPage.trackResistance, reservedByte1, RESERVED, RESERVED, RESERVED, s & 0xFF, (s >> 8) & 0xFF, rr];
|
|
36
|
+
}
|
|
37
|
+
function buildUserConfigurationPage(userWeightKg, bikeWeightKg, wheelDiameterM, gearRatio) {
|
|
38
|
+
let m = userWeightKg === undefined ? 0xFFFF : Math.trunc(userWeightKg * 100);
|
|
39
|
+
let mb = bikeWeightKg === undefined ? 0xFFF : Math.trunc(bikeWeightKg * 20);
|
|
40
|
+
let d = wheelDiameterM ?? RESERVED;
|
|
41
|
+
const gr = gearRatio === undefined ? 0x00 : Math.trunc(gearRatio / 0.03);
|
|
42
|
+
let dOffset = RESERVED;
|
|
43
|
+
if (d !== RESERVED) {
|
|
44
|
+
d = d * 1000;
|
|
45
|
+
dOffset = d % 10;
|
|
46
|
+
d = Math.trunc(d / 10);
|
|
47
|
+
}
|
|
48
|
+
return [
|
|
49
|
+
FECPage.userConfiguration,
|
|
50
|
+
m & 0xFF, (m >> 8) & 0xFF,
|
|
51
|
+
RESERVED,
|
|
52
|
+
((mb & 0xF) << 4) | (dOffset & 0xF), (mb >> 4) & 0xF,
|
|
53
|
+
d & 0xFF,
|
|
54
|
+
gr & 0xFF
|
|
55
|
+
];
|
|
56
|
+
}
|
|
@@ -163,6 +163,11 @@ class BleFmAdapter extends adapter_js_1.default {
|
|
|
163
163
|
this.isHubInitialized = false;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
async restart(pause) {
|
|
167
|
+
this.zwiftPlay?.resetHubState();
|
|
168
|
+
this.isHubInitialized = false;
|
|
169
|
+
return await super.restart(pause);
|
|
170
|
+
}
|
|
166
171
|
async initControl(_startProps) {
|
|
167
172
|
if (!this.isStarting())
|
|
168
173
|
return;
|
package/lib/cjs/ble/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.BleTacxAdapter = exports.BleWahooAdapter = exports.BleFmAdapter = exports.BlePwrAdapter = exports.BleHrmAdapter = exports.BleInterface = exports.BleInterfaceFactory = exports.BleAdapterFactory = void 0;
|
|
17
|
+
exports.BleBkoolAdapter = exports.BleTacxAdapter = exports.BleWahooAdapter = exports.BleFmAdapter = exports.BlePwrAdapter = exports.BleHrmAdapter = exports.BleInterface = exports.BleInterfaceFactory = exports.BleAdapterFactory = void 0;
|
|
18
18
|
const index_js_1 = require("./hr/index.js");
|
|
19
19
|
Object.defineProperty(exports, "BleHrmAdapter", { enumerable: true, get: function () { return index_js_1.BleHrmAdapter; } });
|
|
20
20
|
const index_js_2 = require("./cp/index.js");
|
|
@@ -25,22 +25,25 @@ const index_js_4 = require("./wahoo/index.js");
|
|
|
25
25
|
Object.defineProperty(exports, "BleWahooAdapter", { enumerable: true, get: function () { return index_js_4.BleWahooAdapter; } });
|
|
26
26
|
const index_js_5 = require("./tacx/index.js");
|
|
27
27
|
Object.defineProperty(exports, "BleTacxAdapter", { enumerable: true, get: function () { return index_js_5.BleTacxAdapter; } });
|
|
28
|
+
const index_js_6 = require("./bkool/index.js");
|
|
29
|
+
Object.defineProperty(exports, "BleBkoolAdapter", { enumerable: true, get: function () { return index_js_6.BleBkoolAdapter; } });
|
|
28
30
|
const interface_js_1 = require("../ble/base/interface.js");
|
|
29
31
|
Object.defineProperty(exports, "BleInterface", { enumerable: true, get: function () { return interface_js_1.BleInterface; } });
|
|
30
|
-
const
|
|
31
|
-
Object.defineProperty(exports, "BleInterfaceFactory", { enumerable: true, get: function () { return
|
|
32
|
-
Object.defineProperty(exports, "BleAdapterFactory", { enumerable: true, get: function () { return
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const index_js_7 = require("./factories/index.js");
|
|
33
|
+
Object.defineProperty(exports, "BleInterfaceFactory", { enumerable: true, get: function () { return index_js_7.BleMultiTransportInterfaceFactory; } });
|
|
34
|
+
Object.defineProperty(exports, "BleAdapterFactory", { enumerable: true, get: function () { return index_js_7.BleAdapterFactory; } });
|
|
35
|
+
const index_js_8 = require("./csc/index.js");
|
|
36
|
+
const index_js_9 = require("./zwift/play/index.js");
|
|
35
37
|
['ble', 'wifi'].forEach(i => {
|
|
36
|
-
const af =
|
|
38
|
+
const af = index_js_7.BleAdapterFactory.getInstance(i);
|
|
37
39
|
af.register('hr', index_js_1.BleHrmAdapter, index_js_1.BleHrmComms);
|
|
38
40
|
af.register('cp', index_js_2.BlePwrAdapter, index_js_2.BlePwrComms);
|
|
39
41
|
af.register('fm', index_js_3.BleFmAdapter, index_js_3.BleFmComms);
|
|
40
42
|
af.register('wahoo', index_js_4.BleWahooAdapter, index_js_4.BleWahooComms);
|
|
41
43
|
af.register('tacx', index_js_5.BleTacxAdapter, index_js_5.BleTacxComms);
|
|
42
|
-
af.register('
|
|
43
|
-
af.register('
|
|
44
|
+
af.register('bkool', index_js_6.BleBkoolAdapter, index_js_6.BleBkoolComms);
|
|
45
|
+
af.register('csc', index_js_8.BleCSCAdapter, index_js_8.BleCyclingSpeedCadenceDevice);
|
|
46
|
+
af.register('zwift-play', index_js_9.ZwiftPlayAdapter, index_js_9.BleZwiftPlaySensor);
|
|
44
47
|
});
|
|
45
|
-
|
|
48
|
+
index_js_7.BleMultiTransportInterfaceFactory.register('ble', interface_js_1.BleInterfaceFactory);
|
|
46
49
|
__exportStar(require("./utils.js"), exports);
|