incyclist-devices 3.0.48 → 3.0.50
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 +25 -2
- package/lib/cjs/ble/zwift/play/sensor.js +38 -39
- package/lib/esm/ble/base/interface.js +25 -2
- package/lib/esm/ble/zwift/play/sensor.js +38 -39
- package/lib/types/ble/base/interface.d.ts +6 -0
- package/lib/types/ble/zwift/play/sensor.d.ts +4 -1
- package/package.json +1 -1
|
@@ -26,6 +26,7 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
26
26
|
logDisabled;
|
|
27
27
|
internalEvents;
|
|
28
28
|
services = [];
|
|
29
|
+
pendingWaits = [];
|
|
29
30
|
incompleteServices = [];
|
|
30
31
|
unsupported = [];
|
|
31
32
|
expectedServices = ['180d', '1818', '1826', '6e40fec1'];
|
|
@@ -318,9 +319,19 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
318
319
|
this.off('device', onDevice);
|
|
319
320
|
if (timer)
|
|
320
321
|
clearTimeout(timer);
|
|
322
|
+
this.pendingWaits = this.pendingWaits.filter(w => w !== pending);
|
|
321
323
|
if (temporary || !wasDiscovering)
|
|
322
324
|
this.stopPeripheralScan().catch(() => { });
|
|
323
325
|
};
|
|
326
|
+
const pending = {
|
|
327
|
+
address: settings.address,
|
|
328
|
+
name: settings.name,
|
|
329
|
+
cancel: () => {
|
|
330
|
+
finish();
|
|
331
|
+
reject(new Error('peripheral wait cancelled'));
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
this.pendingWaits.push(pending);
|
|
324
335
|
const onDevice = (device) => {
|
|
325
336
|
if (device.address === settings.address) {
|
|
326
337
|
const peripheral = this.createPeripheralFromSettings(device);
|
|
@@ -345,11 +356,17 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
345
356
|
this.startPeripheralScan();
|
|
346
357
|
});
|
|
347
358
|
}
|
|
359
|
+
cancelWait(settings) {
|
|
360
|
+
this.pendingWaits
|
|
361
|
+
.filter(w => settings.address !== undefined ? w.address === settings.address : w.name === settings.name)
|
|
362
|
+
.forEach(w => w.cancel());
|
|
363
|
+
}
|
|
348
364
|
createDeviceSetting(service) {
|
|
349
365
|
const { peripheral } = service;
|
|
350
366
|
if (peripheral.address === undefined || peripheral.address === '')
|
|
351
367
|
peripheral.address = peripheral.id || peripheral.name;
|
|
352
|
-
|
|
368
|
+
const isZwiftFC82Controller = service.name === 'Zwift Ride' || service.name === 'Zwift Click';
|
|
369
|
+
if (isZwiftFC82Controller && service.serviceUUIDs.some(uuid => (0, utils_js_1.matches)(uuid, 'FC82'))) {
|
|
353
370
|
const protocol = 'zwift-play';
|
|
354
371
|
const { id, name, address } = (0, utils_js_1.getPeripheralInfo)(peripheral);
|
|
355
372
|
return { interface: BleInterface.INTERFACE_NAME, protocol, id, name, address };
|
|
@@ -668,8 +685,13 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
668
685
|
return false;
|
|
669
686
|
const found = service.serviceUUIDs.map(utils_js_1.parseUUID);
|
|
670
687
|
const expected = this.expectedServices.map(utils_js_1.parseUUID);
|
|
671
|
-
if (service.name.startsWith('Zwift'))
|
|
688
|
+
if (service.name.startsWith('Zwift')) {
|
|
689
|
+
if (isZwiftClickV2Right(service.manufacturerData)) {
|
|
690
|
+
this.logEvent({ message: 'Zwift Click v2 right side ignored', address: service.peripheral?.address });
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
672
693
|
return true;
|
|
694
|
+
}
|
|
673
695
|
const supported = found.filter(uuid => expected.includes(uuid)) ?? [];
|
|
674
696
|
if (!supported.length) {
|
|
675
697
|
this.logEvent({ message: 'peripheral not supported', name: service.name, uuids: service.serviceUUIDs });
|
|
@@ -839,3 +861,4 @@ class BleInterfaceFactory extends types_js_1.InterfaceFactory {
|
|
|
839
861
|
}
|
|
840
862
|
}
|
|
841
863
|
exports.BleInterfaceFactory = BleInterfaceFactory;
|
|
864
|
+
const isZwiftClickV2Right = (manufacturerData) => manufacturerData?.length >= 3 && manufacturerData[0] === 0x4a && manufacturerData[1] === 0x09 && manufacturerData[2] === 0x0a;
|
|
@@ -7,6 +7,15 @@ const utils_js_1 = require("../../../utils/utils.js");
|
|
|
7
7
|
const utils_js_2 = require("../../utils.js");
|
|
8
8
|
const node_events_1 = require("node:events");
|
|
9
9
|
const index_js_1 = require("../../../bindings/index.js");
|
|
10
|
+
const ZWIFT_DEVICE_TYPES = {
|
|
11
|
+
0x02: 'right',
|
|
12
|
+
0x03: 'left',
|
|
13
|
+
0x07: 'ride-right',
|
|
14
|
+
0x08: 'ride-left',
|
|
15
|
+
0x09: 'click',
|
|
16
|
+
0x0A: 'click-v2-right',
|
|
17
|
+
0x0B: 'click-v2-left',
|
|
18
|
+
};
|
|
10
19
|
class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
11
20
|
static profile = 'Controller';
|
|
12
21
|
static protocol = 'zwift-play';
|
|
@@ -132,25 +141,7 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
132
141
|
}
|
|
133
142
|
else if (this.peripheral?.getManufacturerData) {
|
|
134
143
|
const manufacturerData = this.getManufacturerData();
|
|
135
|
-
|
|
136
|
-
const typeVal = Number('0x' + manufacturerData.substring(2, 4));
|
|
137
|
-
if (typeVal === 9) {
|
|
138
|
-
this.deviceType = 'click';
|
|
139
|
-
this.encrypted = false;
|
|
140
|
-
}
|
|
141
|
-
else if (typeVal === 2) {
|
|
142
|
-
this.deviceType = 'right';
|
|
143
|
-
}
|
|
144
|
-
else if (typeVal === 3) {
|
|
145
|
-
this.deviceType = 'left';
|
|
146
|
-
}
|
|
147
|
-
else if (typeVal === 7) {
|
|
148
|
-
this.deviceType = 'ride-right';
|
|
149
|
-
}
|
|
150
|
-
else if (typeVal === 8) {
|
|
151
|
-
this.deviceType = 'ride-left';
|
|
152
|
-
}
|
|
153
|
-
}
|
|
144
|
+
this.setDeviceTypeFromManufacturerData(manufacturerData);
|
|
154
145
|
}
|
|
155
146
|
console.log('# [ZwiftPlay] device type ', this.deviceType, this.peripheral?.getInfo().name, this.peripheral?.getInfo().address);
|
|
156
147
|
if (!this.deviceType && !this.encryptedSupported()) {
|
|
@@ -477,7 +468,7 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
477
468
|
});
|
|
478
469
|
this.rideKeyPadStates.forEach((state, bit) => {
|
|
479
470
|
if (!currentPresses.has(bit) && state.pressed) {
|
|
480
|
-
const keyName = buttonNames.get(bit);
|
|
471
|
+
const keyName = this.getKeyName(buttonNames.get(bit));
|
|
481
472
|
const duration = Date.now() - state.timestamp;
|
|
482
473
|
this.logEvent({ message: 'key pressed', key: keyName, name, address, duration, deviceType: this.deviceType });
|
|
483
474
|
this.emit('key-pressed', { key: keyName, duration, deviceType: this.deviceType });
|
|
@@ -644,25 +635,7 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
644
635
|
}
|
|
645
636
|
else if (this.peripheral?.getManufacturerData) {
|
|
646
637
|
manufacturerData = this.getManufacturerData();
|
|
647
|
-
|
|
648
|
-
const typeVal = Number('0x' + manufacturerData.substring(2, 4));
|
|
649
|
-
if (typeVal === 9) {
|
|
650
|
-
this.deviceType = 'click';
|
|
651
|
-
this.encrypted = false;
|
|
652
|
-
}
|
|
653
|
-
else if (typeVal === 2) {
|
|
654
|
-
this.deviceType = 'right';
|
|
655
|
-
}
|
|
656
|
-
else if (typeVal === 3) {
|
|
657
|
-
this.deviceType = 'left';
|
|
658
|
-
}
|
|
659
|
-
else if (typeVal === 7) {
|
|
660
|
-
this.deviceType = 'ride-right';
|
|
661
|
-
}
|
|
662
|
-
else if (typeVal === 8) {
|
|
663
|
-
this.deviceType = 'ride-left';
|
|
664
|
-
}
|
|
665
|
-
}
|
|
638
|
+
this.setDeviceTypeFromManufacturerData(manufacturerData);
|
|
666
639
|
}
|
|
667
640
|
if (!this.deviceType && !this.encryptedSupported()) {
|
|
668
641
|
this.deviceType = 'click';
|
|
@@ -674,6 +647,9 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
674
647
|
if (this.isFM) {
|
|
675
648
|
message = Buffer.concat([Buffer.from('RideOn'), Buffer.from([0x02, 0x01])]);
|
|
676
649
|
}
|
|
650
|
+
else if (this.isClickV2()) {
|
|
651
|
+
message = Buffer.concat([Buffer.from('RideOn'), Buffer.from([0x02, 0x03])]);
|
|
652
|
+
}
|
|
677
653
|
else if (this.encrypted) {
|
|
678
654
|
const { publicKey, privateKey } = this.createKeyPair();
|
|
679
655
|
this.privateKey = this.privateKey ?? Buffer.from(privateKey);
|
|
@@ -697,6 +673,29 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
697
673
|
}
|
|
698
674
|
reset() {
|
|
699
675
|
}
|
|
676
|
+
setDeviceTypeFromManufacturerData(manufacturerData) {
|
|
677
|
+
if (!manufacturerData?.startsWith('4a09'))
|
|
678
|
+
return;
|
|
679
|
+
const deviceType = ZWIFT_DEVICE_TYPES[Number('0x' + manufacturerData.substring(4, 6))];
|
|
680
|
+
if (!deviceType)
|
|
681
|
+
return;
|
|
682
|
+
this.deviceType = deviceType;
|
|
683
|
+
if (deviceType === 'click')
|
|
684
|
+
this.encrypted = false;
|
|
685
|
+
}
|
|
686
|
+
getKeyName(rideKeyName) {
|
|
687
|
+
this.getDeviceType();
|
|
688
|
+
if (!this.isClickV2())
|
|
689
|
+
return rideKeyName;
|
|
690
|
+
if (rideKeyName === 'r-shift-up')
|
|
691
|
+
return 'up';
|
|
692
|
+
if (rideKeyName === 'l-shift-up')
|
|
693
|
+
return 'down';
|
|
694
|
+
return rideKeyName;
|
|
695
|
+
}
|
|
696
|
+
isClickV2() {
|
|
697
|
+
return this.deviceType === 'click-v2-left' || this.deviceType === 'click-v2-right';
|
|
698
|
+
}
|
|
700
699
|
getManufacturerData() {
|
|
701
700
|
const data = this.peripheral?.getManufacturerData?.();
|
|
702
701
|
if (typeof data === 'string')
|
|
@@ -23,6 +23,7 @@ export class BleInterface extends EventEmitter {
|
|
|
23
23
|
logDisabled;
|
|
24
24
|
internalEvents;
|
|
25
25
|
services = [];
|
|
26
|
+
pendingWaits = [];
|
|
26
27
|
incompleteServices = [];
|
|
27
28
|
unsupported = [];
|
|
28
29
|
expectedServices = ['180d', '1818', '1826', '6e40fec1'];
|
|
@@ -315,9 +316,19 @@ export class BleInterface extends EventEmitter {
|
|
|
315
316
|
this.off('device', onDevice);
|
|
316
317
|
if (timer)
|
|
317
318
|
clearTimeout(timer);
|
|
319
|
+
this.pendingWaits = this.pendingWaits.filter(w => w !== pending);
|
|
318
320
|
if (temporary || !wasDiscovering)
|
|
319
321
|
this.stopPeripheralScan().catch(() => { });
|
|
320
322
|
};
|
|
323
|
+
const pending = {
|
|
324
|
+
address: settings.address,
|
|
325
|
+
name: settings.name,
|
|
326
|
+
cancel: () => {
|
|
327
|
+
finish();
|
|
328
|
+
reject(new Error('peripheral wait cancelled'));
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
this.pendingWaits.push(pending);
|
|
321
332
|
const onDevice = (device) => {
|
|
322
333
|
if (device.address === settings.address) {
|
|
323
334
|
const peripheral = this.createPeripheralFromSettings(device);
|
|
@@ -342,11 +353,17 @@ export class BleInterface extends EventEmitter {
|
|
|
342
353
|
this.startPeripheralScan();
|
|
343
354
|
});
|
|
344
355
|
}
|
|
356
|
+
cancelWait(settings) {
|
|
357
|
+
this.pendingWaits
|
|
358
|
+
.filter(w => settings.address !== undefined ? w.address === settings.address : w.name === settings.name)
|
|
359
|
+
.forEach(w => w.cancel());
|
|
360
|
+
}
|
|
345
361
|
createDeviceSetting(service) {
|
|
346
362
|
const { peripheral } = service;
|
|
347
363
|
if (peripheral.address === undefined || peripheral.address === '')
|
|
348
364
|
peripheral.address = peripheral.id || peripheral.name;
|
|
349
|
-
|
|
365
|
+
const isZwiftFC82Controller = service.name === 'Zwift Ride' || service.name === 'Zwift Click';
|
|
366
|
+
if (isZwiftFC82Controller && service.serviceUUIDs.some(uuid => matches(uuid, 'FC82'))) {
|
|
350
367
|
const protocol = 'zwift-play';
|
|
351
368
|
const { id, name, address } = getPeripheralInfo(peripheral);
|
|
352
369
|
return { interface: BleInterface.INTERFACE_NAME, protocol, id, name, address };
|
|
@@ -665,8 +682,13 @@ export class BleInterface extends EventEmitter {
|
|
|
665
682
|
return false;
|
|
666
683
|
const found = service.serviceUUIDs.map(parseUUID);
|
|
667
684
|
const expected = this.expectedServices.map(parseUUID);
|
|
668
|
-
if (service.name.startsWith('Zwift'))
|
|
685
|
+
if (service.name.startsWith('Zwift')) {
|
|
686
|
+
if (isZwiftClickV2Right(service.manufacturerData)) {
|
|
687
|
+
this.logEvent({ message: 'Zwift Click v2 right side ignored', address: service.peripheral?.address });
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
669
690
|
return true;
|
|
691
|
+
}
|
|
670
692
|
const supported = found.filter(uuid => expected.includes(uuid)) ?? [];
|
|
671
693
|
if (!supported.length) {
|
|
672
694
|
this.logEvent({ message: 'peripheral not supported', name: service.name, uuids: service.serviceUUIDs });
|
|
@@ -834,3 +856,4 @@ export class BleInterfaceFactory extends InterfaceFactory {
|
|
|
834
856
|
return this.iface;
|
|
835
857
|
}
|
|
836
858
|
}
|
|
859
|
+
const isZwiftClickV2Right = (manufacturerData) => manufacturerData?.length >= 3 && manufacturerData[0] === 0x4a && manufacturerData[1] === 0x09 && manufacturerData[2] === 0x0a;
|
|
@@ -4,6 +4,15 @@ import { sleep } from "../../../utils/utils.js";
|
|
|
4
4
|
import { beautifyUUID, fullUUID } from "../../utils.js";
|
|
5
5
|
import { EventEmitter } from "node:events";
|
|
6
6
|
import { BindingsFactory } from "../../../bindings/index.js";
|
|
7
|
+
const ZWIFT_DEVICE_TYPES = {
|
|
8
|
+
0x02: 'right',
|
|
9
|
+
0x03: 'left',
|
|
10
|
+
0x07: 'ride-right',
|
|
11
|
+
0x08: 'ride-left',
|
|
12
|
+
0x09: 'click',
|
|
13
|
+
0x0A: 'click-v2-right',
|
|
14
|
+
0x0B: 'click-v2-left',
|
|
15
|
+
};
|
|
7
16
|
export class BleZwiftPlaySensor extends TBleSensor {
|
|
8
17
|
static profile = 'Controller';
|
|
9
18
|
static protocol = 'zwift-play';
|
|
@@ -129,25 +138,7 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
129
138
|
}
|
|
130
139
|
else if (this.peripheral?.getManufacturerData) {
|
|
131
140
|
const manufacturerData = this.getManufacturerData();
|
|
132
|
-
|
|
133
|
-
const typeVal = Number('0x' + manufacturerData.substring(2, 4));
|
|
134
|
-
if (typeVal === 9) {
|
|
135
|
-
this.deviceType = 'click';
|
|
136
|
-
this.encrypted = false;
|
|
137
|
-
}
|
|
138
|
-
else if (typeVal === 2) {
|
|
139
|
-
this.deviceType = 'right';
|
|
140
|
-
}
|
|
141
|
-
else if (typeVal === 3) {
|
|
142
|
-
this.deviceType = 'left';
|
|
143
|
-
}
|
|
144
|
-
else if (typeVal === 7) {
|
|
145
|
-
this.deviceType = 'ride-right';
|
|
146
|
-
}
|
|
147
|
-
else if (typeVal === 8) {
|
|
148
|
-
this.deviceType = 'ride-left';
|
|
149
|
-
}
|
|
150
|
-
}
|
|
141
|
+
this.setDeviceTypeFromManufacturerData(manufacturerData);
|
|
151
142
|
}
|
|
152
143
|
console.log('# [ZwiftPlay] device type ', this.deviceType, this.peripheral?.getInfo().name, this.peripheral?.getInfo().address);
|
|
153
144
|
if (!this.deviceType && !this.encryptedSupported()) {
|
|
@@ -474,7 +465,7 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
474
465
|
});
|
|
475
466
|
this.rideKeyPadStates.forEach((state, bit) => {
|
|
476
467
|
if (!currentPresses.has(bit) && state.pressed) {
|
|
477
|
-
const keyName = buttonNames.get(bit);
|
|
468
|
+
const keyName = this.getKeyName(buttonNames.get(bit));
|
|
478
469
|
const duration = Date.now() - state.timestamp;
|
|
479
470
|
this.logEvent({ message: 'key pressed', key: keyName, name, address, duration, deviceType: this.deviceType });
|
|
480
471
|
this.emit('key-pressed', { key: keyName, duration, deviceType: this.deviceType });
|
|
@@ -641,25 +632,7 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
641
632
|
}
|
|
642
633
|
else if (this.peripheral?.getManufacturerData) {
|
|
643
634
|
manufacturerData = this.getManufacturerData();
|
|
644
|
-
|
|
645
|
-
const typeVal = Number('0x' + manufacturerData.substring(2, 4));
|
|
646
|
-
if (typeVal === 9) {
|
|
647
|
-
this.deviceType = 'click';
|
|
648
|
-
this.encrypted = false;
|
|
649
|
-
}
|
|
650
|
-
else if (typeVal === 2) {
|
|
651
|
-
this.deviceType = 'right';
|
|
652
|
-
}
|
|
653
|
-
else if (typeVal === 3) {
|
|
654
|
-
this.deviceType = 'left';
|
|
655
|
-
}
|
|
656
|
-
else if (typeVal === 7) {
|
|
657
|
-
this.deviceType = 'ride-right';
|
|
658
|
-
}
|
|
659
|
-
else if (typeVal === 8) {
|
|
660
|
-
this.deviceType = 'ride-left';
|
|
661
|
-
}
|
|
662
|
-
}
|
|
635
|
+
this.setDeviceTypeFromManufacturerData(manufacturerData);
|
|
663
636
|
}
|
|
664
637
|
if (!this.deviceType && !this.encryptedSupported()) {
|
|
665
638
|
this.deviceType = 'click';
|
|
@@ -671,6 +644,9 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
671
644
|
if (this.isFM) {
|
|
672
645
|
message = Buffer.concat([Buffer.from('RideOn'), Buffer.from([0x02, 0x01])]);
|
|
673
646
|
}
|
|
647
|
+
else if (this.isClickV2()) {
|
|
648
|
+
message = Buffer.concat([Buffer.from('RideOn'), Buffer.from([0x02, 0x03])]);
|
|
649
|
+
}
|
|
674
650
|
else if (this.encrypted) {
|
|
675
651
|
const { publicKey, privateKey } = this.createKeyPair();
|
|
676
652
|
this.privateKey = this.privateKey ?? Buffer.from(privateKey);
|
|
@@ -694,6 +670,29 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
694
670
|
}
|
|
695
671
|
reset() {
|
|
696
672
|
}
|
|
673
|
+
setDeviceTypeFromManufacturerData(manufacturerData) {
|
|
674
|
+
if (!manufacturerData?.startsWith('4a09'))
|
|
675
|
+
return;
|
|
676
|
+
const deviceType = ZWIFT_DEVICE_TYPES[Number('0x' + manufacturerData.substring(4, 6))];
|
|
677
|
+
if (!deviceType)
|
|
678
|
+
return;
|
|
679
|
+
this.deviceType = deviceType;
|
|
680
|
+
if (deviceType === 'click')
|
|
681
|
+
this.encrypted = false;
|
|
682
|
+
}
|
|
683
|
+
getKeyName(rideKeyName) {
|
|
684
|
+
this.getDeviceType();
|
|
685
|
+
if (!this.isClickV2())
|
|
686
|
+
return rideKeyName;
|
|
687
|
+
if (rideKeyName === 'r-shift-up')
|
|
688
|
+
return 'up';
|
|
689
|
+
if (rideKeyName === 'l-shift-up')
|
|
690
|
+
return 'down';
|
|
691
|
+
return rideKeyName;
|
|
692
|
+
}
|
|
693
|
+
isClickV2() {
|
|
694
|
+
return this.deviceType === 'click-v2-left' || this.deviceType === 'click-v2-right';
|
|
695
|
+
}
|
|
697
696
|
getManufacturerData() {
|
|
698
697
|
const data = this.peripheral?.getManufacturerData?.();
|
|
699
698
|
if (typeof data === 'string')
|
|
@@ -23,6 +23,11 @@ export declare class BleInterface extends EventEmitter implements IBleInterface<
|
|
|
23
23
|
protected logDisabled: boolean;
|
|
24
24
|
protected internalEvents: EventEmitter;
|
|
25
25
|
protected services: Announcement[];
|
|
26
|
+
protected pendingWaits: Array<{
|
|
27
|
+
address?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
cancel: () => void;
|
|
30
|
+
}>;
|
|
26
31
|
protected incompleteServices: BlePeripheralAnnouncement[];
|
|
27
32
|
protected unsupported: BlePeripheralAnnouncement[];
|
|
28
33
|
protected expectedServices: string[];
|
|
@@ -74,6 +79,7 @@ export declare class BleInterface extends EventEmitter implements IBleInterface<
|
|
|
74
79
|
createPeripheral(announcement: BlePeripheralAnnouncement): IBlePeripheral;
|
|
75
80
|
createPeripheralFromSettings(settings: BleDeviceSettings): IBlePeripheral;
|
|
76
81
|
waitForPeripheral(settings: BleDeviceSettings): Promise<IBlePeripheral>;
|
|
82
|
+
cancelWait(settings: BleDeviceSettings): void;
|
|
77
83
|
createDeviceSetting(service: BlePeripheralAnnouncement): BleDeviceSettings;
|
|
78
84
|
protected reconnect(): Promise<void>;
|
|
79
85
|
protected startPeripheralScan(retry?: boolean, force?: boolean): Promise<void>;
|
|
@@ -13,7 +13,7 @@ type BleZwiftPlaySensorProps = {
|
|
|
13
13
|
logger?: EventLogger;
|
|
14
14
|
isTrainer?: boolean;
|
|
15
15
|
};
|
|
16
|
-
type DeviceType = 'left' | 'right' | 'click' | 'hub' | 'ride-left' | 'ride-right';
|
|
16
|
+
type DeviceType = 'left' | 'right' | 'click' | 'hub' | 'ride-left' | 'ride-right' | 'click-v2-left' | 'click-v2-right';
|
|
17
17
|
type PendingMeasurement = {
|
|
18
18
|
type: number;
|
|
19
19
|
buffer: Buffer;
|
|
@@ -87,6 +87,9 @@ export declare class BleZwiftPlaySensor extends TBleSensor {
|
|
|
87
87
|
read(characteristic: string, ignoreErrors?: boolean): Promise<Buffer | null>;
|
|
88
88
|
pair(): Promise<boolean>;
|
|
89
89
|
reset(): void;
|
|
90
|
+
protected setDeviceTypeFromManufacturerData(manufacturerData: string | undefined): void;
|
|
91
|
+
protected getKeyName(rideKeyName: string): string;
|
|
92
|
+
protected isClickV2(): boolean;
|
|
90
93
|
getManufacturerData(): string;
|
|
91
94
|
protected getCrypto(): ICryptoBinding;
|
|
92
95
|
protected encryptedSupported(): boolean;
|