incyclist-devices 3.0.51 → 3.0.53
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/antv2/base/interface.js +17 -7
- package/lib/cjs/ble/base/adapter.js +41 -1
- package/lib/cjs/ble/fm/sensor.js +8 -3
- package/lib/cjs/ble/openbikecontrol/adapter.js +1 -26
- package/lib/cjs/ble/zwift/play/adapter.js +1 -26
- package/lib/esm/antv2/base/interface.js +17 -7
- package/lib/esm/ble/base/adapter.js +41 -1
- package/lib/esm/ble/fm/sensor.js +8 -3
- package/lib/esm/ble/openbikecontrol/adapter.js +1 -26
- package/lib/esm/ble/zwift/play/adapter.js +1 -26
- package/lib/types/antv2/base/interface.d.ts +1 -0
- package/lib/types/ble/base/adapter.d.ts +6 -0
- package/lib/types/ble/openbikecontrol/adapter.d.ts +0 -2
- package/lib/types/ble/zwift/play/adapter.d.ts +0 -2
- package/package.json +1 -1
|
@@ -152,6 +152,7 @@ class AntInterface extends node_events_1.EventEmitter {
|
|
|
152
152
|
this.connectPromise = null;
|
|
153
153
|
this.scanPromise = null;
|
|
154
154
|
this.connected = false;
|
|
155
|
+
this.channelsInUse = [];
|
|
155
156
|
return closed;
|
|
156
157
|
}
|
|
157
158
|
async terminate() {
|
|
@@ -350,23 +351,32 @@ class AntInterface extends node_events_1.EventEmitter {
|
|
|
350
351
|
try {
|
|
351
352
|
const started = await channel.startSensor(sensor);
|
|
352
353
|
if (!started) {
|
|
353
|
-
this.logEvent({ message: 'could not start sensor' });
|
|
354
|
+
this.logEvent({ message: 'could not start sensor', channelNo: channel.getChannelNo(), profile: sensor.getProfile(), deviceID: sensor.getDeviceID() });
|
|
354
355
|
channel.off('data', onData);
|
|
356
|
+
await this.releaseChannel(sensor, channel);
|
|
357
|
+
return false;
|
|
355
358
|
}
|
|
356
359
|
this.logEvent({ message: 'sensor started', channelNo: sensor.getChannel()?.getChannelNo(), profile: sensor.getProfile(), deviceID: sensor.getDeviceID() });
|
|
357
|
-
return
|
|
360
|
+
return true;
|
|
358
361
|
}
|
|
359
362
|
catch (err) {
|
|
360
363
|
this.logEvent({ message: 'could not start sensor', error: err.message, stack: err.stack });
|
|
361
364
|
channel.off('data', onData);
|
|
362
|
-
|
|
363
|
-
await channel.stopSensor(sensor);
|
|
364
|
-
}
|
|
365
|
-
catch { }
|
|
366
|
-
this.unblockChannel(channel);
|
|
365
|
+
await this.releaseChannel(sensor, channel);
|
|
367
366
|
return false;
|
|
368
367
|
}
|
|
369
368
|
}
|
|
369
|
+
async releaseChannel(sensor, channel) {
|
|
370
|
+
try {
|
|
371
|
+
channel.flush?.();
|
|
372
|
+
await (0, utils_js_1.waitWithTimeout)(channel.stopSensor(sensor), 2000, () => {
|
|
373
|
+
this.logEvent({ message: 'stopping sensor timed out', channelNo: channel.getChannelNo(), deviceID: sensor.getDeviceID() });
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
catch {
|
|
377
|
+
}
|
|
378
|
+
this.unblockChannel(channel);
|
|
379
|
+
}
|
|
370
380
|
blockChannel(channel, usage) {
|
|
371
381
|
this.channelsInUse.push({ channel: channel, usage });
|
|
372
382
|
}
|
|
@@ -243,6 +243,46 @@ class BleAdapter extends adpater_js_1.default {
|
|
|
243
243
|
isStarting() {
|
|
244
244
|
return this.startTask?.isRunning();
|
|
245
245
|
}
|
|
246
|
+
isExpectedStartFailure(err) {
|
|
247
|
+
const message = err?.message;
|
|
248
|
+
return message === 'peripheral wait cancelled' || message === 'peripheral not found';
|
|
249
|
+
}
|
|
250
|
+
keyPressedHandler;
|
|
251
|
+
async startControllerSensor(start) {
|
|
252
|
+
try {
|
|
253
|
+
const connected = await start();
|
|
254
|
+
if (connected)
|
|
255
|
+
this.forwardKeyPressed();
|
|
256
|
+
return connected;
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
if (this.isExpectedStartFailure(err))
|
|
260
|
+
this.logEvent({ message: 'start result: not found', reason: err.message, device: this.getName(), interface: this.getInterface() });
|
|
261
|
+
else
|
|
262
|
+
this.logEvent({ message: 'error', fn: 'startSensor', error: err.message, stack: err.stack });
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
forwardKeyPressed() {
|
|
267
|
+
const sensor = this.getSensor();
|
|
268
|
+
if (this.keyPressedHandler) {
|
|
269
|
+
sensor.off('key-pressed', this.keyPressedHandler);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
this.keyPressedHandler = this.onKeyPressed.bind(this);
|
|
273
|
+
}
|
|
274
|
+
sensor.on('key-pressed', this.keyPressedHandler);
|
|
275
|
+
}
|
|
276
|
+
onKeyPressed(event) {
|
|
277
|
+
this.emit('key-pressed', this.getSettings(), event);
|
|
278
|
+
}
|
|
279
|
+
logStartFailure(err) {
|
|
280
|
+
const logProps = { device: this.getName(), interface: this.getInterface(), protocol: this.getProtocolName() };
|
|
281
|
+
if (this.isExpectedStartFailure(err))
|
|
282
|
+
this.logEvent({ message: 'start result: not found', reason: err.message, ...logProps });
|
|
283
|
+
else
|
|
284
|
+
this.logEvent({ message: 'start result: error', error: err.message, ...logProps });
|
|
285
|
+
}
|
|
246
286
|
hasData() {
|
|
247
287
|
return this.dataMsgCount > 0;
|
|
248
288
|
}
|
|
@@ -344,7 +384,7 @@ class BleAdapter extends adpater_js_1.default {
|
|
|
344
384
|
return true;
|
|
345
385
|
}
|
|
346
386
|
catch (err) {
|
|
347
|
-
this.
|
|
387
|
+
this.logStartFailure(err);
|
|
348
388
|
this.started = false;
|
|
349
389
|
this.stopped = true;
|
|
350
390
|
const ble = this.getBle();
|
package/lib/cjs/ble/fm/sensor.js
CHANGED
|
@@ -550,9 +550,14 @@ class BleFitnessMachineDevice extends sensor_js_1.TBleSensor {
|
|
|
550
550
|
}
|
|
551
551
|
const buffer = data ? Buffer.from(data) : undefined;
|
|
552
552
|
try {
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
const discovered = this.peripheral?.getDiscoveredServices?.() ?? [];
|
|
554
|
+
const rawServices = this.peripheral?.services ?? [];
|
|
555
|
+
const services = [
|
|
556
|
+
...discovered,
|
|
557
|
+
...rawServices.map(s => typeof s === 'string' ? s : s.uuid)
|
|
558
|
+
];
|
|
559
|
+
let power = services.some(s => (0, utils_js_1.matches)(s, '1818'));
|
|
560
|
+
let heartrate = services.some(s => (0, utils_js_1.matches)(s, '180d'));
|
|
556
561
|
const dataLength = buffer?.length ?? 0;
|
|
557
562
|
const fitnessMachine = dataLength >= 4 ? buffer.readUInt32LE(0) : 0;
|
|
558
563
|
const targetSettings = dataLength >= 8 ? buffer.readUInt32LE(4) : 0;
|
|
@@ -11,7 +11,6 @@ const index_js_1 = require("../../types/index.js");
|
|
|
11
11
|
class OpenBikeControlAdapter extends adapter_js_1.default {
|
|
12
12
|
static INCYCLIST_PROFILE_NAME = 'Controller';
|
|
13
13
|
static CAPABILITIES = [index_js_1.IncyclistCapability.AppControl];
|
|
14
|
-
keyPressedHandler;
|
|
15
14
|
constructor(settings, props) {
|
|
16
15
|
super(settings, props);
|
|
17
16
|
this.logger = new gd_eventlog_1.EventLogger('OpenBikeControl');
|
|
@@ -22,31 +21,7 @@ class OpenBikeControlAdapter extends adapter_js_1.default {
|
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
async startSensor() {
|
|
25
|
-
|
|
26
|
-
let connected = await super.startSensor();
|
|
27
|
-
if (connected) {
|
|
28
|
-
const sensor = this.getSensor();
|
|
29
|
-
if (this.keyPressedHandler) {
|
|
30
|
-
sensor.off('key-pressed', this.keyPressedHandler);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.keyPressedHandler = this.onKeyPressed.bind(this);
|
|
34
|
-
}
|
|
35
|
-
sensor.on('key-pressed', this.keyPressedHandler);
|
|
36
|
-
}
|
|
37
|
-
return connected;
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
if (err.message === 'wifi device wait cancelled') {
|
|
41
|
-
this.logEvent({ message: err.message });
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
this.logEvent({ message: 'error', fn: 'startSensor', error: err.message, stack: err.stack });
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
onKeyPressed(event) {
|
|
49
|
-
this.emit('key-pressed', this.getSettings(), event);
|
|
24
|
+
return await this.startControllerSensor(() => super.startSensor());
|
|
50
25
|
}
|
|
51
26
|
isEqual(settings) {
|
|
52
27
|
return super.isEqual(settings) && settings.address == this.settings.address;
|
|
@@ -11,7 +11,6 @@ const index_js_1 = require("../../../types/index.js");
|
|
|
11
11
|
class ZwiftPlayAdapter extends adapter_js_1.default {
|
|
12
12
|
static INCYCLIST_PROFILE_NAME = 'Controller';
|
|
13
13
|
static CAPABILITIES = [index_js_1.IncyclistCapability.AppControl];
|
|
14
|
-
keyPressedHandler;
|
|
15
14
|
constructor(settings, props) {
|
|
16
15
|
super(settings, props);
|
|
17
16
|
this.logger = new gd_eventlog_1.EventLogger('ZwiftPlay');
|
|
@@ -22,31 +21,7 @@ class ZwiftPlayAdapter extends adapter_js_1.default {
|
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
async startSensor() {
|
|
25
|
-
|
|
26
|
-
let connected = await super.startSensor();
|
|
27
|
-
if (connected) {
|
|
28
|
-
const sensor = this.getSensor();
|
|
29
|
-
if (this.keyPressedHandler) {
|
|
30
|
-
sensor.off('key-pressed', this.keyPressedHandler);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.keyPressedHandler = this.onKeyPressed.bind(this);
|
|
34
|
-
}
|
|
35
|
-
sensor.on('key-pressed', this.keyPressedHandler);
|
|
36
|
-
}
|
|
37
|
-
return connected;
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
if (err.message === 'wifi device wait cancelled') {
|
|
41
|
-
this.logEvent({ message: err.message });
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
this.logEvent({ message: 'error', fn: 'startSensor', error: err.message, stack: err.stack });
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
onKeyPressed(event) {
|
|
49
|
-
this.emit('key-pressed', this.getSettings(), event);
|
|
24
|
+
return await this.startControllerSensor(() => super.startSensor());
|
|
50
25
|
}
|
|
51
26
|
isEqual(settings) {
|
|
52
27
|
const equal = super.isEqual(settings) &&
|
|
@@ -147,6 +147,7 @@ export default class AntInterface extends EventEmitter {
|
|
|
147
147
|
this.connectPromise = null;
|
|
148
148
|
this.scanPromise = null;
|
|
149
149
|
this.connected = false;
|
|
150
|
+
this.channelsInUse = [];
|
|
150
151
|
return closed;
|
|
151
152
|
}
|
|
152
153
|
async terminate() {
|
|
@@ -345,23 +346,32 @@ export default class AntInterface extends EventEmitter {
|
|
|
345
346
|
try {
|
|
346
347
|
const started = await channel.startSensor(sensor);
|
|
347
348
|
if (!started) {
|
|
348
|
-
this.logEvent({ message: 'could not start sensor' });
|
|
349
|
+
this.logEvent({ message: 'could not start sensor', channelNo: channel.getChannelNo(), profile: sensor.getProfile(), deviceID: sensor.getDeviceID() });
|
|
349
350
|
channel.off('data', onData);
|
|
351
|
+
await this.releaseChannel(sensor, channel);
|
|
352
|
+
return false;
|
|
350
353
|
}
|
|
351
354
|
this.logEvent({ message: 'sensor started', channelNo: sensor.getChannel()?.getChannelNo(), profile: sensor.getProfile(), deviceID: sensor.getDeviceID() });
|
|
352
|
-
return
|
|
355
|
+
return true;
|
|
353
356
|
}
|
|
354
357
|
catch (err) {
|
|
355
358
|
this.logEvent({ message: 'could not start sensor', error: err.message, stack: err.stack });
|
|
356
359
|
channel.off('data', onData);
|
|
357
|
-
|
|
358
|
-
await channel.stopSensor(sensor);
|
|
359
|
-
}
|
|
360
|
-
catch { }
|
|
361
|
-
this.unblockChannel(channel);
|
|
360
|
+
await this.releaseChannel(sensor, channel);
|
|
362
361
|
return false;
|
|
363
362
|
}
|
|
364
363
|
}
|
|
364
|
+
async releaseChannel(sensor, channel) {
|
|
365
|
+
try {
|
|
366
|
+
channel.flush?.();
|
|
367
|
+
await waitWithTimeout(channel.stopSensor(sensor), 2000, () => {
|
|
368
|
+
this.logEvent({ message: 'stopping sensor timed out', channelNo: channel.getChannelNo(), deviceID: sensor.getDeviceID() });
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
catch {
|
|
372
|
+
}
|
|
373
|
+
this.unblockChannel(channel);
|
|
374
|
+
}
|
|
365
375
|
blockChannel(channel, usage) {
|
|
366
376
|
this.channelsInUse.push({ channel: channel, usage });
|
|
367
377
|
}
|
|
@@ -238,6 +238,46 @@ export default class BleAdapter extends IncyclistDevice {
|
|
|
238
238
|
isStarting() {
|
|
239
239
|
return this.startTask?.isRunning();
|
|
240
240
|
}
|
|
241
|
+
isExpectedStartFailure(err) {
|
|
242
|
+
const message = err?.message;
|
|
243
|
+
return message === 'peripheral wait cancelled' || message === 'peripheral not found';
|
|
244
|
+
}
|
|
245
|
+
keyPressedHandler;
|
|
246
|
+
async startControllerSensor(start) {
|
|
247
|
+
try {
|
|
248
|
+
const connected = await start();
|
|
249
|
+
if (connected)
|
|
250
|
+
this.forwardKeyPressed();
|
|
251
|
+
return connected;
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
if (this.isExpectedStartFailure(err))
|
|
255
|
+
this.logEvent({ message: 'start result: not found', reason: err.message, device: this.getName(), interface: this.getInterface() });
|
|
256
|
+
else
|
|
257
|
+
this.logEvent({ message: 'error', fn: 'startSensor', error: err.message, stack: err.stack });
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
forwardKeyPressed() {
|
|
262
|
+
const sensor = this.getSensor();
|
|
263
|
+
if (this.keyPressedHandler) {
|
|
264
|
+
sensor.off('key-pressed', this.keyPressedHandler);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
this.keyPressedHandler = this.onKeyPressed.bind(this);
|
|
268
|
+
}
|
|
269
|
+
sensor.on('key-pressed', this.keyPressedHandler);
|
|
270
|
+
}
|
|
271
|
+
onKeyPressed(event) {
|
|
272
|
+
this.emit('key-pressed', this.getSettings(), event);
|
|
273
|
+
}
|
|
274
|
+
logStartFailure(err) {
|
|
275
|
+
const logProps = { device: this.getName(), interface: this.getInterface(), protocol: this.getProtocolName() };
|
|
276
|
+
if (this.isExpectedStartFailure(err))
|
|
277
|
+
this.logEvent({ message: 'start result: not found', reason: err.message, ...logProps });
|
|
278
|
+
else
|
|
279
|
+
this.logEvent({ message: 'start result: error', error: err.message, ...logProps });
|
|
280
|
+
}
|
|
241
281
|
hasData() {
|
|
242
282
|
return this.dataMsgCount > 0;
|
|
243
283
|
}
|
|
@@ -339,7 +379,7 @@ export default class BleAdapter extends IncyclistDevice {
|
|
|
339
379
|
return true;
|
|
340
380
|
}
|
|
341
381
|
catch (err) {
|
|
342
|
-
this.
|
|
382
|
+
this.logStartFailure(err);
|
|
343
383
|
this.started = false;
|
|
344
384
|
this.stopped = true;
|
|
345
385
|
const ble = this.getBle();
|
package/lib/esm/ble/fm/sensor.js
CHANGED
|
@@ -548,9 +548,14 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
548
548
|
}
|
|
549
549
|
const buffer = data ? Buffer.from(data) : undefined;
|
|
550
550
|
try {
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
|
|
551
|
+
const discovered = this.peripheral?.getDiscoveredServices?.() ?? [];
|
|
552
|
+
const rawServices = this.peripheral?.services ?? [];
|
|
553
|
+
const services = [
|
|
554
|
+
...discovered,
|
|
555
|
+
...rawServices.map(s => typeof s === 'string' ? s : s.uuid)
|
|
556
|
+
];
|
|
557
|
+
let power = services.some(s => matches(s, '1818'));
|
|
558
|
+
let heartrate = services.some(s => matches(s, '180d'));
|
|
554
559
|
const dataLength = buffer?.length ?? 0;
|
|
555
560
|
const fitnessMachine = dataLength >= 4 ? buffer.readUInt32LE(0) : 0;
|
|
556
561
|
const targetSettings = dataLength >= 8 ? buffer.readUInt32LE(4) : 0;
|
|
@@ -5,7 +5,6 @@ import { IncyclistCapability } from '../../types/index.js';
|
|
|
5
5
|
export class OpenBikeControlAdapter extends BleAdapter {
|
|
6
6
|
static INCYCLIST_PROFILE_NAME = 'Controller';
|
|
7
7
|
static CAPABILITIES = [IncyclistCapability.AppControl];
|
|
8
|
-
keyPressedHandler;
|
|
9
8
|
constructor(settings, props) {
|
|
10
9
|
super(settings, props);
|
|
11
10
|
this.logger = new EventLogger('OpenBikeControl');
|
|
@@ -16,31 +15,7 @@ export class OpenBikeControlAdapter extends BleAdapter {
|
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
async startSensor() {
|
|
19
|
-
|
|
20
|
-
let connected = await super.startSensor();
|
|
21
|
-
if (connected) {
|
|
22
|
-
const sensor = this.getSensor();
|
|
23
|
-
if (this.keyPressedHandler) {
|
|
24
|
-
sensor.off('key-pressed', this.keyPressedHandler);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this.keyPressedHandler = this.onKeyPressed.bind(this);
|
|
28
|
-
}
|
|
29
|
-
sensor.on('key-pressed', this.keyPressedHandler);
|
|
30
|
-
}
|
|
31
|
-
return connected;
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
if (err.message === 'wifi device wait cancelled') {
|
|
35
|
-
this.logEvent({ message: err.message });
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
this.logEvent({ message: 'error', fn: 'startSensor', error: err.message, stack: err.stack });
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
onKeyPressed(event) {
|
|
43
|
-
this.emit('key-pressed', this.getSettings(), event);
|
|
18
|
+
return await this.startControllerSensor(() => super.startSensor());
|
|
44
19
|
}
|
|
45
20
|
isEqual(settings) {
|
|
46
21
|
return super.isEqual(settings) && settings.address == this.settings.address;
|
|
@@ -5,7 +5,6 @@ import { IncyclistCapability } from '../../../types/index.js';
|
|
|
5
5
|
export class ZwiftPlayAdapter extends BleAdapter {
|
|
6
6
|
static INCYCLIST_PROFILE_NAME = 'Controller';
|
|
7
7
|
static CAPABILITIES = [IncyclistCapability.AppControl];
|
|
8
|
-
keyPressedHandler;
|
|
9
8
|
constructor(settings, props) {
|
|
10
9
|
super(settings, props);
|
|
11
10
|
this.logger = new EventLogger('ZwiftPlay');
|
|
@@ -16,31 +15,7 @@ export class ZwiftPlayAdapter extends BleAdapter {
|
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
async startSensor() {
|
|
19
|
-
|
|
20
|
-
let connected = await super.startSensor();
|
|
21
|
-
if (connected) {
|
|
22
|
-
const sensor = this.getSensor();
|
|
23
|
-
if (this.keyPressedHandler) {
|
|
24
|
-
sensor.off('key-pressed', this.keyPressedHandler);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this.keyPressedHandler = this.onKeyPressed.bind(this);
|
|
28
|
-
}
|
|
29
|
-
sensor.on('key-pressed', this.keyPressedHandler);
|
|
30
|
-
}
|
|
31
|
-
return connected;
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
if (err.message === 'wifi device wait cancelled') {
|
|
35
|
-
this.logEvent({ message: err.message });
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
this.logEvent({ message: 'error', fn: 'startSensor', error: err.message, stack: err.stack });
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
onKeyPressed(event) {
|
|
43
|
-
this.emit('key-pressed', this.getSettings(), event);
|
|
18
|
+
return await this.startControllerSensor(() => super.startSensor());
|
|
44
19
|
}
|
|
45
20
|
isEqual(settings) {
|
|
46
21
|
const equal = super.isEqual(settings) &&
|
|
@@ -53,6 +53,7 @@ export default class AntInterface extends EventEmitter implements IncyclistInter
|
|
|
53
53
|
protected stopDevices(detected: AntDeviceSettings[]): Promise<void>;
|
|
54
54
|
stopScan(): Promise<boolean>;
|
|
55
55
|
startSensor(sensor: ISensor, onDeviceData: (data: any) => void): Promise<boolean>;
|
|
56
|
+
private releaseChannel;
|
|
56
57
|
private blockChannel;
|
|
57
58
|
private unblockChannel;
|
|
58
59
|
stopSensor(sensor: ISensor): Promise<boolean>;
|
|
@@ -50,6 +50,12 @@ export default class BleAdapter<TDeviceData extends BleDeviceData, TDevice exten
|
|
|
50
50
|
start(startProps?: BleStartProperties): Promise<boolean>;
|
|
51
51
|
protected runStartTask(ble: IBleInterface<any>): Promise<boolean>;
|
|
52
52
|
protected isStarting(): boolean;
|
|
53
|
+
protected isExpectedStartFailure(err: any): boolean;
|
|
54
|
+
protected keyPressedHandler?: (event: any) => void;
|
|
55
|
+
protected startControllerSensor(start: () => Promise<boolean>): Promise<boolean>;
|
|
56
|
+
protected forwardKeyPressed(): void;
|
|
57
|
+
protected onKeyPressed(event: any): void;
|
|
58
|
+
protected logStartFailure(err: any): void;
|
|
53
59
|
protected hasData(): boolean;
|
|
54
60
|
protected shouldWaitForData(): boolean;
|
|
55
61
|
protected waitForInitialData(startupTimeout: any): Promise<void>;
|
|
@@ -7,11 +7,9 @@ import { BleDeviceSettings, IBlePeripheral } from '../types.js';
|
|
|
7
7
|
export declare class OpenBikeControlAdapter extends BleAdapter<BleDeviceData, BleOpenBikeControlSensor> {
|
|
8
8
|
protected static INCYCLIST_PROFILE_NAME: LegacyProfile;
|
|
9
9
|
protected static CAPABILITIES: IncyclistCapability[];
|
|
10
|
-
protected keyPressedHandler?: (event: any) => void;
|
|
11
10
|
constructor(settings: BleDeviceSettings, props?: DeviceProperties);
|
|
12
11
|
protected checkCapabilities(): Promise<void>;
|
|
13
12
|
startSensor(): Promise<boolean>;
|
|
14
|
-
protected onKeyPressed(event: any): void;
|
|
15
13
|
isEqual(settings: BleDeviceSettings): boolean;
|
|
16
14
|
isSame(adapter: IAdapter): boolean;
|
|
17
15
|
updateSensor(peripheral: IBlePeripheral): void;
|
|
@@ -7,11 +7,9 @@ import { BleDeviceSettings, IBlePeripheral } from '../../types.js';
|
|
|
7
7
|
export declare class ZwiftPlayAdapter extends BleAdapter<BleDeviceData, BleZwiftPlaySensor> {
|
|
8
8
|
protected static INCYCLIST_PROFILE_NAME: LegacyProfile;
|
|
9
9
|
protected static CAPABILITIES: IncyclistCapability[];
|
|
10
|
-
protected keyPressedHandler?: (event: any) => void;
|
|
11
10
|
constructor(settings: BleDeviceSettings, props?: DeviceProperties);
|
|
12
11
|
protected checkCapabilities(): Promise<void>;
|
|
13
12
|
startSensor(): Promise<boolean>;
|
|
14
|
-
protected onKeyPressed(event: any): void;
|
|
15
13
|
isEqual(settings: BleDeviceSettings): boolean;
|
|
16
14
|
isSame(adapter: IAdapter): boolean;
|
|
17
15
|
updateSensor(peripheral: IBlePeripheral): void;
|