incyclist-devices 3.0.18 → 3.0.20
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/adapter.js +1 -1
- package/lib/cjs/ble/base/interface.js +20 -2
- package/lib/cjs/ble/base/peripheral.js +22 -5
- package/lib/cjs/ble/base/sensor.js +7 -6
- package/lib/cjs/ble/fm/sensor.js +5 -0
- package/lib/esm/ble/base/adapter.js +1 -1
- package/lib/esm/ble/base/interface.js +20 -2
- package/lib/esm/ble/base/peripheral.js +22 -5
- package/lib/esm/ble/base/sensor.js +7 -6
- package/lib/esm/ble/fm/sensor.js +5 -0
- package/lib/types/ble/base/interface.d.ts +2 -1
- package/lib/types/ble/base/sensor.d.ts +2 -2
- package/lib/types/ble/fm/sensor.d.ts +1 -0
- package/package.json +1 -1
|
@@ -359,7 +359,7 @@ class BleAdapter extends adpater_js_1.default {
|
|
|
359
359
|
sensor.off('data', this.onDeviceDataHandler);
|
|
360
360
|
let connected = false;
|
|
361
361
|
if (sensor.isReconnectBusy()) {
|
|
362
|
-
connected = await sensor.reconnectSensor();
|
|
362
|
+
connected = await sensor.reconnectSensor(false);
|
|
363
363
|
}
|
|
364
364
|
if (connected) {
|
|
365
365
|
sensor.on('data', this.onDeviceDataHandler);
|
|
@@ -405,7 +405,12 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
405
405
|
}
|
|
406
406
|
const isWahoo = this.checkForWahooEnhancement(announcement);
|
|
407
407
|
if (isWahoo) {
|
|
408
|
-
this.
|
|
408
|
+
this.processEnrichedAnnouncement(announcement);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const isTacx = this.checkForTacxEnhancement(announcement);
|
|
412
|
+
if (isTacx) {
|
|
413
|
+
this.processEnrichedAnnouncement(announcement);
|
|
409
414
|
return;
|
|
410
415
|
}
|
|
411
416
|
this.addService(announcement);
|
|
@@ -419,7 +424,7 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
419
424
|
}
|
|
420
425
|
return false;
|
|
421
426
|
}
|
|
422
|
-
|
|
427
|
+
processEnrichedAnnouncement(announcement) {
|
|
423
428
|
if (this.isCompleting(announcement)) {
|
|
424
429
|
return;
|
|
425
430
|
}
|
|
@@ -429,6 +434,19 @@ class BleInterface extends node_events_1.EventEmitter {
|
|
|
429
434
|
this.addService(announcement);
|
|
430
435
|
});
|
|
431
436
|
}
|
|
437
|
+
checkForTacxEnhancement(announcement) {
|
|
438
|
+
const name = announcement?.name?.toUpperCase();
|
|
439
|
+
if (name.startsWith('TACX')) {
|
|
440
|
+
const supported = announcement.serviceUUIDs.map(s => (0, utils_js_1.beautifyUUID)(s));
|
|
441
|
+
const tacxService = (0, utils_js_1.beautifyUUID)('6E40FEC1-B5A3-F393-E0A9-E50E24DCCA9E');
|
|
442
|
+
const cp = (0, utils_js_1.beautifyUUID)('1818');
|
|
443
|
+
const fe = (0, utils_js_1.beautifyUUID)('1826');
|
|
444
|
+
if (supported.includes(cp) && !supported.includes(fe) && !supported.includes(tacxService)) {
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
432
450
|
buildAnnouncement(peripheral) {
|
|
433
451
|
return {
|
|
434
452
|
advertisement: peripheral.advertisement,
|
|
@@ -163,8 +163,9 @@ class BlePeripheral {
|
|
|
163
163
|
async _discoverServices() {
|
|
164
164
|
if (!this.getPeripheral())
|
|
165
165
|
return [];
|
|
166
|
+
const { name, address } = this.getInfo();
|
|
166
167
|
if (this.getPeripheral().discoverServicesAsync) {
|
|
167
|
-
this.logEvent({ message: 'discover services',
|
|
168
|
+
this.logEvent({ message: 'discover services', name, address });
|
|
168
169
|
const peripheral = this.getPeripheral();
|
|
169
170
|
let services = [];
|
|
170
171
|
if (peripheral?.discoverServicesAsync) {
|
|
@@ -172,14 +173,14 @@ class BlePeripheral {
|
|
|
172
173
|
.catch(() => []);
|
|
173
174
|
}
|
|
174
175
|
this.discoveredServiceUUIds = services.map(s => (0, utils_js_2.beautifyUUID)(s.uuid));
|
|
175
|
-
this.logEvent({ message: 'discover services result',
|
|
176
|
+
this.logEvent({ message: 'discover services result', name, address, services: this.discoveredServiceUUIds });
|
|
176
177
|
return services.map(s => s.uuid);
|
|
177
178
|
}
|
|
178
179
|
else {
|
|
179
|
-
this.logEvent({ message: 'discover services and characteristics',
|
|
180
|
+
this.logEvent({ message: 'discover services and characteristics', name, address });
|
|
180
181
|
const res = await this.getPeripheral().discoverSomeServicesAndCharacteristicsAsync([], []);
|
|
181
182
|
this.discoveredServiceUUIds = res.services.map(s => (0, utils_js_2.beautifyUUID)(s.uuid));
|
|
182
|
-
this.logEvent({ message: 'discover services result',
|
|
183
|
+
this.logEvent({ message: 'discover services result', name, address, services: this.discoveredServiceUUIds });
|
|
183
184
|
return res.services.map(s => s.uuid);
|
|
184
185
|
}
|
|
185
186
|
}
|
|
@@ -193,10 +194,12 @@ class BlePeripheral {
|
|
|
193
194
|
async _discoverCharacteristics(serviceUUID) {
|
|
194
195
|
if (!this.getPeripheral())
|
|
195
196
|
return [];
|
|
196
|
-
|
|
197
|
+
const { name, address } = this.getInfo();
|
|
198
|
+
this.logEvent({ message: 'discover services and characteristics', name, address, service: serviceUUID });
|
|
197
199
|
const res = await this.getPeripheral().discoverSomeServicesAndCharacteristicsAsync([serviceUUID], [])
|
|
198
200
|
.catch(() => ({ services: [], characteristics: [] }));
|
|
199
201
|
res.characteristics.forEach(c => this.characteristics[(0, utils_js_2.beautifyUUID)(c.uuid)] = c);
|
|
202
|
+
this.logEvent({ message: 'discover services and characteristics result', name, address, service: serviceUUID });
|
|
200
203
|
return res.characteristics.map(c => {
|
|
201
204
|
const { uuid, properties, name, _serviceUuid } = c;
|
|
202
205
|
return { uuid, properties, name, _serviceUuid };
|
|
@@ -318,6 +321,15 @@ class BlePeripheral {
|
|
|
318
321
|
if (!success)
|
|
319
322
|
retry.push(c);
|
|
320
323
|
}
|
|
324
|
+
else {
|
|
325
|
+
const uuid = (0, utils_js_2.beautifyUUID)(element);
|
|
326
|
+
if (c?.properties) {
|
|
327
|
+
this.logEvent({ message: 'cannot subscribe', uuid, reason: 'invalid type', properties: c.properties.join('|') });
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.logEvent({ message: 'cannot subscribe', uuid, reason: 'not found' });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
321
333
|
}
|
|
322
334
|
for (const element of retry) {
|
|
323
335
|
const c = element;
|
|
@@ -332,12 +344,17 @@ class BlePeripheral {
|
|
|
332
344
|
}
|
|
333
345
|
async discoverAllCharacteristics() {
|
|
334
346
|
try {
|
|
347
|
+
const { name, address } = this.getInfo();
|
|
348
|
+
this.logEvent({ message: 'discover all characteristics', name, address });
|
|
335
349
|
const res = await this.getPeripheral().discoverSomeServicesAndCharacteristicsAsync([], []);
|
|
336
350
|
const found = [];
|
|
351
|
+
const uuids = [];
|
|
337
352
|
res.characteristics.forEach(c => {
|
|
338
353
|
this.characteristics[(0, utils_js_2.beautifyUUID)(c.uuid)] = c;
|
|
339
354
|
found.push(c.uuid);
|
|
355
|
+
uuids.push((0, utils_js_2.beautifyUUID)(c.uuid));
|
|
340
356
|
});
|
|
357
|
+
this.logEvent({ message: 'discover all characteristics result', name, address, uuids: uuids.join('|') });
|
|
341
358
|
return found;
|
|
342
359
|
}
|
|
343
360
|
catch (err) {
|
|
@@ -112,18 +112,19 @@ class TBleSensor extends node_events_1.EventEmitter {
|
|
|
112
112
|
isReconnectBusy() {
|
|
113
113
|
return (this.reconnectPromise !== undefined);
|
|
114
114
|
}
|
|
115
|
-
async reconnectSensor() {
|
|
115
|
+
async reconnectSensor(connectionLost = true) {
|
|
116
116
|
if (this.reconnectPromise !== undefined) {
|
|
117
117
|
return await this.reconnectPromise;
|
|
118
118
|
}
|
|
119
|
-
this.reconnectPromise = this.doReconnectSensor();
|
|
119
|
+
this.reconnectPromise = this.doReconnectSensor(connectionLost);
|
|
120
120
|
const res = await this.reconnectPromise;
|
|
121
121
|
delete this.reconnectPromise;
|
|
122
122
|
return res;
|
|
123
123
|
}
|
|
124
|
-
async doReconnectSensor() {
|
|
124
|
+
async doReconnectSensor(connectionLost = true) {
|
|
125
125
|
this.onDisconnect();
|
|
126
|
-
this.
|
|
126
|
+
const { name, address } = this.peripheral?.getInfo() ?? {};
|
|
127
|
+
this.logEvent({ message: 'reconnect sensor', name, address, connectionLost });
|
|
127
128
|
let connected = false;
|
|
128
129
|
let subscribed = false;
|
|
129
130
|
let success = false;
|
|
@@ -143,8 +144,8 @@ class TBleSensor extends node_events_1.EventEmitter {
|
|
|
143
144
|
if (!success) {
|
|
144
145
|
await (0, utils_js_1.sleep)(1000);
|
|
145
146
|
}
|
|
146
|
-
if (!this.stopRequested)
|
|
147
|
-
this.logEvent({ message: 'reconnect sensor retry' });
|
|
147
|
+
if (!this.stopRequested && !success)
|
|
148
|
+
this.logEvent({ message: 'reconnect sensor retry', name, address });
|
|
148
149
|
} while (!success || this.stopRequested);
|
|
149
150
|
this.logEvent({ message: 'reconnect sensor completed', success, stopRequested: this.stopRequested });
|
|
150
151
|
return success;
|
package/lib/cjs/ble/fm/sensor.js
CHANGED
|
@@ -22,6 +22,7 @@ class BleFitnessMachineDevice extends sensor_js_1.TBleSensor {
|
|
|
22
22
|
windSpeed = 0;
|
|
23
23
|
wheelSize = 2100;
|
|
24
24
|
ftmsServiceData;
|
|
25
|
+
ftmsServiceDataAttempts = 0;
|
|
25
26
|
rowerDataTS;
|
|
26
27
|
rowerMaxPower;
|
|
27
28
|
constructor(peripheral, props) {
|
|
@@ -102,6 +103,7 @@ class BleFitnessMachineDevice extends sensor_js_1.TBleSensor {
|
|
|
102
103
|
}
|
|
103
104
|
onDisconnect() {
|
|
104
105
|
this.hasControl = false;
|
|
106
|
+
this.ftmsServiceDataAttempts = 0;
|
|
105
107
|
}
|
|
106
108
|
async requestControl() {
|
|
107
109
|
if (this.hasControl) {
|
|
@@ -472,11 +474,14 @@ class BleFitnessMachineDevice extends sensor_js_1.TBleSensor {
|
|
|
472
474
|
parseServiceData() {
|
|
473
475
|
if (this.ftmsServiceData)
|
|
474
476
|
return this.ftmsServiceData;
|
|
477
|
+
if (this.ftmsServiceDataAttempts > 3)
|
|
478
|
+
return this.ftmsServiceData;
|
|
475
479
|
try {
|
|
476
480
|
const peripheral = this.peripheral;
|
|
477
481
|
if (peripheral?.getServiceData === undefined)
|
|
478
482
|
return;
|
|
479
483
|
const bitSet = (value, bitNo) => (value & (0, utils_js_1.bit)(bitNo)) > 0;
|
|
484
|
+
this.ftmsServiceDataAttempts++;
|
|
480
485
|
const data = peripheral.getServiceData(consts_js_1.FTMS);
|
|
481
486
|
const dataLength = data?.length ?? 0;
|
|
482
487
|
if (dataLength >= 2) {
|
|
@@ -354,7 +354,7 @@ export default class BleAdapter extends IncyclistDevice {
|
|
|
354
354
|
sensor.off('data', this.onDeviceDataHandler);
|
|
355
355
|
let connected = false;
|
|
356
356
|
if (sensor.isReconnectBusy()) {
|
|
357
|
-
connected = await sensor.reconnectSensor();
|
|
357
|
+
connected = await sensor.reconnectSensor(false);
|
|
358
358
|
}
|
|
359
359
|
if (connected) {
|
|
360
360
|
sensor.on('data', this.onDeviceDataHandler);
|
|
@@ -402,7 +402,12 @@ export class BleInterface extends EventEmitter {
|
|
|
402
402
|
}
|
|
403
403
|
const isWahoo = this.checkForWahooEnhancement(announcement);
|
|
404
404
|
if (isWahoo) {
|
|
405
|
-
this.
|
|
405
|
+
this.processEnrichedAnnouncement(announcement);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const isTacx = this.checkForTacxEnhancement(announcement);
|
|
409
|
+
if (isTacx) {
|
|
410
|
+
this.processEnrichedAnnouncement(announcement);
|
|
406
411
|
return;
|
|
407
412
|
}
|
|
408
413
|
this.addService(announcement);
|
|
@@ -416,7 +421,7 @@ export class BleInterface extends EventEmitter {
|
|
|
416
421
|
}
|
|
417
422
|
return false;
|
|
418
423
|
}
|
|
419
|
-
|
|
424
|
+
processEnrichedAnnouncement(announcement) {
|
|
420
425
|
if (this.isCompleting(announcement)) {
|
|
421
426
|
return;
|
|
422
427
|
}
|
|
@@ -426,6 +431,19 @@ export class BleInterface extends EventEmitter {
|
|
|
426
431
|
this.addService(announcement);
|
|
427
432
|
});
|
|
428
433
|
}
|
|
434
|
+
checkForTacxEnhancement(announcement) {
|
|
435
|
+
const name = announcement?.name?.toUpperCase();
|
|
436
|
+
if (name.startsWith('TACX')) {
|
|
437
|
+
const supported = announcement.serviceUUIDs.map(s => beautifyUUID(s));
|
|
438
|
+
const tacxService = beautifyUUID('6E40FEC1-B5A3-F393-E0A9-E50E24DCCA9E');
|
|
439
|
+
const cp = beautifyUUID('1818');
|
|
440
|
+
const fe = beautifyUUID('1826');
|
|
441
|
+
if (supported.includes(cp) && !supported.includes(fe) && !supported.includes(tacxService)) {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
429
447
|
buildAnnouncement(peripheral) {
|
|
430
448
|
return {
|
|
431
449
|
advertisement: peripheral.advertisement,
|
|
@@ -160,8 +160,9 @@ export class BlePeripheral {
|
|
|
160
160
|
async _discoverServices() {
|
|
161
161
|
if (!this.getPeripheral())
|
|
162
162
|
return [];
|
|
163
|
+
const { name, address } = this.getInfo();
|
|
163
164
|
if (this.getPeripheral().discoverServicesAsync) {
|
|
164
|
-
this.logEvent({ message: 'discover services',
|
|
165
|
+
this.logEvent({ message: 'discover services', name, address });
|
|
165
166
|
const peripheral = this.getPeripheral();
|
|
166
167
|
let services = [];
|
|
167
168
|
if (peripheral?.discoverServicesAsync) {
|
|
@@ -169,14 +170,14 @@ export class BlePeripheral {
|
|
|
169
170
|
.catch(() => []);
|
|
170
171
|
}
|
|
171
172
|
this.discoveredServiceUUIds = services.map(s => beautifyUUID(s.uuid));
|
|
172
|
-
this.logEvent({ message: 'discover services result',
|
|
173
|
+
this.logEvent({ message: 'discover services result', name, address, services: this.discoveredServiceUUIds });
|
|
173
174
|
return services.map(s => s.uuid);
|
|
174
175
|
}
|
|
175
176
|
else {
|
|
176
|
-
this.logEvent({ message: 'discover services and characteristics',
|
|
177
|
+
this.logEvent({ message: 'discover services and characteristics', name, address });
|
|
177
178
|
const res = await this.getPeripheral().discoverSomeServicesAndCharacteristicsAsync([], []);
|
|
178
179
|
this.discoveredServiceUUIds = res.services.map(s => beautifyUUID(s.uuid));
|
|
179
|
-
this.logEvent({ message: 'discover services result',
|
|
180
|
+
this.logEvent({ message: 'discover services result', name, address, services: this.discoveredServiceUUIds });
|
|
180
181
|
return res.services.map(s => s.uuid);
|
|
181
182
|
}
|
|
182
183
|
}
|
|
@@ -190,10 +191,12 @@ export class BlePeripheral {
|
|
|
190
191
|
async _discoverCharacteristics(serviceUUID) {
|
|
191
192
|
if (!this.getPeripheral())
|
|
192
193
|
return [];
|
|
193
|
-
|
|
194
|
+
const { name, address } = this.getInfo();
|
|
195
|
+
this.logEvent({ message: 'discover services and characteristics', name, address, service: serviceUUID });
|
|
194
196
|
const res = await this.getPeripheral().discoverSomeServicesAndCharacteristicsAsync([serviceUUID], [])
|
|
195
197
|
.catch(() => ({ services: [], characteristics: [] }));
|
|
196
198
|
res.characteristics.forEach(c => this.characteristics[beautifyUUID(c.uuid)] = c);
|
|
199
|
+
this.logEvent({ message: 'discover services and characteristics result', name, address, service: serviceUUID });
|
|
197
200
|
return res.characteristics.map(c => {
|
|
198
201
|
const { uuid, properties, name, _serviceUuid } = c;
|
|
199
202
|
return { uuid, properties, name, _serviceUuid };
|
|
@@ -315,6 +318,15 @@ export class BlePeripheral {
|
|
|
315
318
|
if (!success)
|
|
316
319
|
retry.push(c);
|
|
317
320
|
}
|
|
321
|
+
else {
|
|
322
|
+
const uuid = beautifyUUID(element);
|
|
323
|
+
if (c?.properties) {
|
|
324
|
+
this.logEvent({ message: 'cannot subscribe', uuid, reason: 'invalid type', properties: c.properties.join('|') });
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
this.logEvent({ message: 'cannot subscribe', uuid, reason: 'not found' });
|
|
328
|
+
}
|
|
329
|
+
}
|
|
318
330
|
}
|
|
319
331
|
for (const element of retry) {
|
|
320
332
|
const c = element;
|
|
@@ -329,12 +341,17 @@ export class BlePeripheral {
|
|
|
329
341
|
}
|
|
330
342
|
async discoverAllCharacteristics() {
|
|
331
343
|
try {
|
|
344
|
+
const { name, address } = this.getInfo();
|
|
345
|
+
this.logEvent({ message: 'discover all characteristics', name, address });
|
|
332
346
|
const res = await this.getPeripheral().discoverSomeServicesAndCharacteristicsAsync([], []);
|
|
333
347
|
const found = [];
|
|
348
|
+
const uuids = [];
|
|
334
349
|
res.characteristics.forEach(c => {
|
|
335
350
|
this.characteristics[beautifyUUID(c.uuid)] = c;
|
|
336
351
|
found.push(c.uuid);
|
|
352
|
+
uuids.push(beautifyUUID(c.uuid));
|
|
337
353
|
});
|
|
354
|
+
this.logEvent({ message: 'discover all characteristics result', name, address, uuids: uuids.join('|') });
|
|
338
355
|
return found;
|
|
339
356
|
}
|
|
340
357
|
catch (err) {
|
|
@@ -109,18 +109,19 @@ export class TBleSensor extends EventEmitter {
|
|
|
109
109
|
isReconnectBusy() {
|
|
110
110
|
return (this.reconnectPromise !== undefined);
|
|
111
111
|
}
|
|
112
|
-
async reconnectSensor() {
|
|
112
|
+
async reconnectSensor(connectionLost = true) {
|
|
113
113
|
if (this.reconnectPromise !== undefined) {
|
|
114
114
|
return await this.reconnectPromise;
|
|
115
115
|
}
|
|
116
|
-
this.reconnectPromise = this.doReconnectSensor();
|
|
116
|
+
this.reconnectPromise = this.doReconnectSensor(connectionLost);
|
|
117
117
|
const res = await this.reconnectPromise;
|
|
118
118
|
delete this.reconnectPromise;
|
|
119
119
|
return res;
|
|
120
120
|
}
|
|
121
|
-
async doReconnectSensor() {
|
|
121
|
+
async doReconnectSensor(connectionLost = true) {
|
|
122
122
|
this.onDisconnect();
|
|
123
|
-
this.
|
|
123
|
+
const { name, address } = this.peripheral?.getInfo() ?? {};
|
|
124
|
+
this.logEvent({ message: 'reconnect sensor', name, address, connectionLost });
|
|
124
125
|
let connected = false;
|
|
125
126
|
let subscribed = false;
|
|
126
127
|
let success = false;
|
|
@@ -140,8 +141,8 @@ export class TBleSensor extends EventEmitter {
|
|
|
140
141
|
if (!success) {
|
|
141
142
|
await sleep(1000);
|
|
142
143
|
}
|
|
143
|
-
if (!this.stopRequested)
|
|
144
|
-
this.logEvent({ message: 'reconnect sensor retry' });
|
|
144
|
+
if (!this.stopRequested && !success)
|
|
145
|
+
this.logEvent({ message: 'reconnect sensor retry', name, address });
|
|
145
146
|
} while (!success || this.stopRequested);
|
|
146
147
|
this.logEvent({ message: 'reconnect sensor completed', success, stopRequested: this.stopRequested });
|
|
147
148
|
return success;
|
package/lib/esm/ble/fm/sensor.js
CHANGED
|
@@ -20,6 +20,7 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
20
20
|
windSpeed = 0;
|
|
21
21
|
wheelSize = 2100;
|
|
22
22
|
ftmsServiceData;
|
|
23
|
+
ftmsServiceDataAttempts = 0;
|
|
23
24
|
rowerDataTS;
|
|
24
25
|
rowerMaxPower;
|
|
25
26
|
constructor(peripheral, props) {
|
|
@@ -100,6 +101,7 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
100
101
|
}
|
|
101
102
|
onDisconnect() {
|
|
102
103
|
this.hasControl = false;
|
|
104
|
+
this.ftmsServiceDataAttempts = 0;
|
|
103
105
|
}
|
|
104
106
|
async requestControl() {
|
|
105
107
|
if (this.hasControl) {
|
|
@@ -470,11 +472,14 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
470
472
|
parseServiceData() {
|
|
471
473
|
if (this.ftmsServiceData)
|
|
472
474
|
return this.ftmsServiceData;
|
|
475
|
+
if (this.ftmsServiceDataAttempts > 3)
|
|
476
|
+
return this.ftmsServiceData;
|
|
473
477
|
try {
|
|
474
478
|
const peripheral = this.peripheral;
|
|
475
479
|
if (peripheral?.getServiceData === undefined)
|
|
476
480
|
return;
|
|
477
481
|
const bitSet = (value, bitNo) => (value & bit(bitNo)) > 0;
|
|
482
|
+
this.ftmsServiceDataAttempts++;
|
|
478
483
|
const data = peripheral.getServiceData(FTMS);
|
|
479
484
|
const dataLength = data?.length ?? 0;
|
|
480
485
|
if (dataLength >= 2) {
|
|
@@ -79,7 +79,8 @@ export declare class BleInterface extends EventEmitter implements IBleInterface<
|
|
|
79
79
|
protected discoverPeripherals(): Promise<void>;
|
|
80
80
|
protected onPeripheralFound(peripheral: BleRawPeripheral): void;
|
|
81
81
|
protected checkForWahooEnhancement(announcement: BlePeripheralAnnouncement): boolean;
|
|
82
|
-
protected
|
|
82
|
+
protected processEnrichedAnnouncement(announcement: BlePeripheralAnnouncement): void;
|
|
83
|
+
protected checkForTacxEnhancement(announcement: BlePeripheralAnnouncement): boolean;
|
|
83
84
|
protected buildAnnouncement(peripheral: BleRawPeripheral): BlePeripheralAnnouncement;
|
|
84
85
|
protected updateWithServices(announcement: BlePeripheralAnnouncement): Promise<BlePeripheralAnnouncement>;
|
|
85
86
|
protected discoverServices(announcement: BlePeripheralAnnouncement): Promise<string[]>;
|
|
@@ -28,8 +28,8 @@ export declare class TBleSensor extends EventEmitter implements IBleSensor {
|
|
|
28
28
|
subscribe(): Promise<boolean>;
|
|
29
29
|
stopSensor(): Promise<boolean>;
|
|
30
30
|
isReconnectBusy(): boolean;
|
|
31
|
-
reconnectSensor(): Promise<boolean>;
|
|
32
|
-
doReconnectSensor(): Promise<boolean>;
|
|
31
|
+
reconnectSensor(connectionLost?: boolean): Promise<boolean>;
|
|
32
|
+
doReconnectSensor(connectionLost?: boolean): Promise<boolean>;
|
|
33
33
|
reset(): void;
|
|
34
34
|
isConnected(): boolean;
|
|
35
35
|
isSubscribed(): boolean;
|
|
@@ -19,6 +19,7 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
19
19
|
protected windSpeed: number;
|
|
20
20
|
protected wheelSize: number;
|
|
21
21
|
protected ftmsServiceData: FtmsServiceData;
|
|
22
|
+
protected ftmsServiceDataAttempts: number;
|
|
22
23
|
protected rowerDataTS: number | undefined;
|
|
23
24
|
protected rowerMaxPower: number | undefined;
|
|
24
25
|
constructor(peripheral: IBlePeripheral, props?: any);
|