incyclist-devices 3.0.37 → 3.0.38
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/sensor.js +1 -1
- package/lib/cjs/ble/fm/sensor.js +14 -5
- package/lib/cjs/ble/zwift/play/sensor.js +60 -6
- package/lib/esm/ble/base/sensor.js +1 -1
- package/lib/esm/ble/fm/sensor.js +14 -5
- package/lib/esm/ble/zwift/play/sensor.js +60 -6
- package/lib/types/ble/fm/sensor.d.ts +1 -0
- package/lib/types/ble/zwift/play/sensor.d.ts +11 -0
- package/package.json +2 -2
|
@@ -105,11 +105,11 @@ class TBleSensor extends node_events_1.EventEmitter {
|
|
|
105
105
|
return res;
|
|
106
106
|
}
|
|
107
107
|
async stopSensor() {
|
|
108
|
+
this.stopRequested = true;
|
|
108
109
|
this.onDisconnect();
|
|
109
110
|
this.removeAllListeners();
|
|
110
111
|
if (!this.peripheral)
|
|
111
112
|
return true;
|
|
112
|
-
this.stopRequested = true;
|
|
113
113
|
return await this.peripheral.disconnect();
|
|
114
114
|
}
|
|
115
115
|
isReconnectBusy() {
|
package/lib/cjs/ble/fm/sensor.js
CHANGED
|
@@ -26,6 +26,7 @@ class BleFitnessMachineDevice extends sensor_js_1.TBleSensor {
|
|
|
26
26
|
rowerDataTS;
|
|
27
27
|
rowerMaxPower;
|
|
28
28
|
indoorBikeDataTruncationLogged = false;
|
|
29
|
+
hrmParseErrorLogged = false;
|
|
29
30
|
constructor(peripheral, props) {
|
|
30
31
|
super(peripheral, props);
|
|
31
32
|
this.reset();
|
|
@@ -180,16 +181,24 @@ class BleFitnessMachineDevice extends sensor_js_1.TBleSensor {
|
|
|
180
181
|
if (data.length == 0)
|
|
181
182
|
return { ...this.data, raw: '<empty>' };
|
|
182
183
|
try {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this.data.heartrate = data.readUInt8(1);
|
|
184
|
+
if (data.length === 1) {
|
|
185
|
+
this.data.heartrate = data.readUInt8(0);
|
|
186
186
|
}
|
|
187
187
|
else {
|
|
188
|
-
|
|
188
|
+
const flags = data.readUInt8(0);
|
|
189
|
+
if ((flags & 0x1) === 0) {
|
|
190
|
+
this.data.heartrate = data.readUInt8(1);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.data.heartrate = data.readUInt16LE(1);
|
|
194
|
+
}
|
|
189
195
|
}
|
|
190
196
|
}
|
|
191
197
|
catch (err) {
|
|
192
|
-
this.
|
|
198
|
+
if (!this.hrmParseErrorLogged) {
|
|
199
|
+
this.hrmParseErrorLogged = true;
|
|
200
|
+
this.logEvent({ message: 'error', fn: 'parseHrm()', error: err.message, stack: err.stack, raw: `2a37:${data.toString('hex')}` });
|
|
201
|
+
}
|
|
193
202
|
}
|
|
194
203
|
return { ...this.data, raw: `2a37:${data.toString('hex')}` };
|
|
195
204
|
}
|
|
@@ -12,6 +12,7 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
12
12
|
static services = ['0000000119ca465186e5fa29dcdd09d1'];
|
|
13
13
|
static characteristics = [];
|
|
14
14
|
static detectionPriority = 1;
|
|
15
|
+
static MEASUREMENT_REASSEMBLY_TIMEOUT = 250;
|
|
15
16
|
emitter;
|
|
16
17
|
isHubPairConfirmed;
|
|
17
18
|
encrypted;
|
|
@@ -33,6 +34,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
33
34
|
subscribePromise;
|
|
34
35
|
prevHubSettings;
|
|
35
36
|
prevcWax10000;
|
|
37
|
+
pendingMeasurement;
|
|
38
|
+
measurementReassemblyErrorLogged = false;
|
|
36
39
|
constructor(peripheral, props) {
|
|
37
40
|
if (props?.isTrainer && peripheral) {
|
|
38
41
|
const sensor = peripheral;
|
|
@@ -148,7 +151,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
148
151
|
await this.requestDataUpdate(512);
|
|
149
152
|
}
|
|
150
153
|
catch (err) {
|
|
151
|
-
|
|
154
|
+
const message = this.stopRequested ? 'warning' : 'error';
|
|
155
|
+
this.logger.logEvent({ message, fn: 'setSimulationData', data, error: err.message, stack: err.stack });
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
async setIncline(incline) {
|
|
@@ -180,7 +184,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
180
184
|
await this.requestDataUpdate(512);
|
|
181
185
|
}
|
|
182
186
|
catch (err) {
|
|
183
|
-
|
|
187
|
+
const message = this.stopRequested ? 'warning' : 'error';
|
|
188
|
+
this.logger.logEvent({ message, fn: 'setGearRatio', gearRatio, error: err.message, stack: err.stack });
|
|
184
189
|
}
|
|
185
190
|
return gearRatio;
|
|
186
191
|
}
|
|
@@ -194,8 +199,31 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
194
199
|
console.log('Invalid click measurement data', data.toString('hex'));
|
|
195
200
|
return false;
|
|
196
201
|
}
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
let type;
|
|
203
|
+
let message;
|
|
204
|
+
try {
|
|
205
|
+
if (this.pendingMeasurement) {
|
|
206
|
+
type = this.pendingMeasurement.type;
|
|
207
|
+
message = Buffer.concat([this.pendingMeasurement.buffer, data]);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
type = data.readUInt8(0);
|
|
211
|
+
message = data.subarray(1);
|
|
212
|
+
}
|
|
213
|
+
this.dispatchMeasurement(type, message);
|
|
214
|
+
this.clearPendingMeasurement();
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
if (err instanceof RangeError && err.message === 'premature EOF') {
|
|
218
|
+
this.bufferPendingMeasurement(type, message);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.clearPendingMeasurement();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
dispatchMeasurement(type, message) {
|
|
199
227
|
if (type === 0x37) {
|
|
200
228
|
this.onClickButtonMessage(message);
|
|
201
229
|
}
|
|
@@ -220,9 +248,26 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
220
248
|
else if (type === 0x15) {
|
|
221
249
|
}
|
|
222
250
|
else {
|
|
223
|
-
this.logEvent({ message: 'got hub notification', raw:
|
|
251
|
+
this.logEvent({ message: 'got hub notification', raw: message.toString('hex') });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
bufferPendingMeasurement(type, buffer) {
|
|
255
|
+
this.clearPendingMeasurement();
|
|
256
|
+
const timer = setTimeout(() => {
|
|
257
|
+
const pending = this.pendingMeasurement;
|
|
258
|
+
this.pendingMeasurement = undefined;
|
|
259
|
+
if (!this.measurementReassemblyErrorLogged) {
|
|
260
|
+
this.measurementReassemblyErrorLogged = true;
|
|
261
|
+
this.logEvent({ message: 'error', fn: 'onMeasurement', error: 'message reassembly timed out - incomplete message dropped', type: pending?.type, payload: pending?.buffer?.toString('hex') });
|
|
262
|
+
}
|
|
263
|
+
}, BleZwiftPlaySensor.MEASUREMENT_REASSEMBLY_TIMEOUT);
|
|
264
|
+
this.pendingMeasurement = { type, buffer, timer };
|
|
265
|
+
}
|
|
266
|
+
clearPendingMeasurement() {
|
|
267
|
+
if (this.pendingMeasurement) {
|
|
268
|
+
clearTimeout(this.pendingMeasurement.timer);
|
|
269
|
+
this.pendingMeasurement = undefined;
|
|
224
270
|
}
|
|
225
|
-
return true;
|
|
226
271
|
}
|
|
227
272
|
async initHubService(setSimulation = true) {
|
|
228
273
|
if (!this.isHubServiceActive && this.initHubServicePromise !== undefined) {
|
|
@@ -312,6 +357,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
312
357
|
this.logEvent({ message: 'trainer response received', unknown: data.unknown, text });
|
|
313
358
|
}
|
|
314
359
|
catch (err) {
|
|
360
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
361
|
+
throw err;
|
|
315
362
|
let payload = 'unknown';
|
|
316
363
|
try {
|
|
317
364
|
payload = m.toString('hex');
|
|
@@ -328,6 +375,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
328
375
|
this.logEvent({ message: 'riding data received', power: data.power, cadence: data.cadence, Speed: data.speedX100 / 100, heartrate: data.hR, unknown1: data.unknown1, unknown2: data.unknown2 });
|
|
329
376
|
}
|
|
330
377
|
catch (err) {
|
|
378
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
379
|
+
throw err;
|
|
331
380
|
this.logEvent({ message: 'Error', fn: 'onRidingData', error: err.message, stack: err.stack });
|
|
332
381
|
}
|
|
333
382
|
}
|
|
@@ -377,6 +426,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
377
426
|
});
|
|
378
427
|
}
|
|
379
428
|
catch (err) {
|
|
429
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
430
|
+
throw err;
|
|
380
431
|
this.logEvent({ message: 'Error', fn: 'onRideKeyPadStatus', error: err.message, stack: err.stack });
|
|
381
432
|
}
|
|
382
433
|
}
|
|
@@ -440,6 +491,8 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
440
491
|
this.prevClickMessage = messageStr;
|
|
441
492
|
}
|
|
442
493
|
catch (err) {
|
|
494
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
495
|
+
throw err;
|
|
443
496
|
this.logEvent({ message: 'error', fn: 'onButtonMessage', error: err.message, stack: err.stack });
|
|
444
497
|
}
|
|
445
498
|
}
|
|
@@ -621,6 +674,7 @@ class BleZwiftPlaySensor extends sensor_js_1.TBleSensor {
|
|
|
621
674
|
delete this.initHubServicePromise;
|
|
622
675
|
delete this.prevHubSettings;
|
|
623
676
|
this.rideKeyPadStates = new Map();
|
|
677
|
+
this.clearPendingMeasurement();
|
|
624
678
|
}
|
|
625
679
|
}
|
|
626
680
|
exports.BleZwiftPlaySensor = BleZwiftPlaySensor;
|
|
@@ -102,11 +102,11 @@ export class TBleSensor extends EventEmitter {
|
|
|
102
102
|
return res;
|
|
103
103
|
}
|
|
104
104
|
async stopSensor() {
|
|
105
|
+
this.stopRequested = true;
|
|
105
106
|
this.onDisconnect();
|
|
106
107
|
this.removeAllListeners();
|
|
107
108
|
if (!this.peripheral)
|
|
108
109
|
return true;
|
|
109
|
-
this.stopRequested = true;
|
|
110
110
|
return await this.peripheral.disconnect();
|
|
111
111
|
}
|
|
112
112
|
isReconnectBusy() {
|
package/lib/esm/ble/fm/sensor.js
CHANGED
|
@@ -24,6 +24,7 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
24
24
|
rowerDataTS;
|
|
25
25
|
rowerMaxPower;
|
|
26
26
|
indoorBikeDataTruncationLogged = false;
|
|
27
|
+
hrmParseErrorLogged = false;
|
|
27
28
|
constructor(peripheral, props) {
|
|
28
29
|
super(peripheral, props);
|
|
29
30
|
this.reset();
|
|
@@ -178,16 +179,24 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
178
179
|
if (data.length == 0)
|
|
179
180
|
return { ...this.data, raw: '<empty>' };
|
|
180
181
|
try {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.data.heartrate = data.readUInt8(1);
|
|
182
|
+
if (data.length === 1) {
|
|
183
|
+
this.data.heartrate = data.readUInt8(0);
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
186
|
-
|
|
186
|
+
const flags = data.readUInt8(0);
|
|
187
|
+
if ((flags & 0x1) === 0) {
|
|
188
|
+
this.data.heartrate = data.readUInt8(1);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.data.heartrate = data.readUInt16LE(1);
|
|
192
|
+
}
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
195
|
catch (err) {
|
|
190
|
-
this.
|
|
196
|
+
if (!this.hrmParseErrorLogged) {
|
|
197
|
+
this.hrmParseErrorLogged = true;
|
|
198
|
+
this.logEvent({ message: 'error', fn: 'parseHrm()', error: err.message, stack: err.stack, raw: `2a37:${data.toString('hex')}` });
|
|
199
|
+
}
|
|
191
200
|
}
|
|
192
201
|
return { ...this.data, raw: `2a37:${data.toString('hex')}` };
|
|
193
202
|
}
|
|
@@ -9,6 +9,7 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
9
9
|
static services = ['0000000119ca465186e5fa29dcdd09d1'];
|
|
10
10
|
static characteristics = [];
|
|
11
11
|
static detectionPriority = 1;
|
|
12
|
+
static MEASUREMENT_REASSEMBLY_TIMEOUT = 250;
|
|
12
13
|
emitter;
|
|
13
14
|
isHubPairConfirmed;
|
|
14
15
|
encrypted;
|
|
@@ -30,6 +31,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
30
31
|
subscribePromise;
|
|
31
32
|
prevHubSettings;
|
|
32
33
|
prevcWax10000;
|
|
34
|
+
pendingMeasurement;
|
|
35
|
+
measurementReassemblyErrorLogged = false;
|
|
33
36
|
constructor(peripheral, props) {
|
|
34
37
|
if (props?.isTrainer && peripheral) {
|
|
35
38
|
const sensor = peripheral;
|
|
@@ -145,7 +148,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
145
148
|
await this.requestDataUpdate(512);
|
|
146
149
|
}
|
|
147
150
|
catch (err) {
|
|
148
|
-
|
|
151
|
+
const message = this.stopRequested ? 'warning' : 'error';
|
|
152
|
+
this.logger.logEvent({ message, fn: 'setSimulationData', data, error: err.message, stack: err.stack });
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
async setIncline(incline) {
|
|
@@ -177,7 +181,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
177
181
|
await this.requestDataUpdate(512);
|
|
178
182
|
}
|
|
179
183
|
catch (err) {
|
|
180
|
-
|
|
184
|
+
const message = this.stopRequested ? 'warning' : 'error';
|
|
185
|
+
this.logger.logEvent({ message, fn: 'setGearRatio', gearRatio, error: err.message, stack: err.stack });
|
|
181
186
|
}
|
|
182
187
|
return gearRatio;
|
|
183
188
|
}
|
|
@@ -191,8 +196,31 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
191
196
|
console.log('Invalid click measurement data', data.toString('hex'));
|
|
192
197
|
return false;
|
|
193
198
|
}
|
|
194
|
-
|
|
195
|
-
|
|
199
|
+
let type;
|
|
200
|
+
let message;
|
|
201
|
+
try {
|
|
202
|
+
if (this.pendingMeasurement) {
|
|
203
|
+
type = this.pendingMeasurement.type;
|
|
204
|
+
message = Buffer.concat([this.pendingMeasurement.buffer, data]);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
type = data.readUInt8(0);
|
|
208
|
+
message = data.subarray(1);
|
|
209
|
+
}
|
|
210
|
+
this.dispatchMeasurement(type, message);
|
|
211
|
+
this.clearPendingMeasurement();
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
if (err instanceof RangeError && err.message === 'premature EOF') {
|
|
215
|
+
this.bufferPendingMeasurement(type, message);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.clearPendingMeasurement();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
dispatchMeasurement(type, message) {
|
|
196
224
|
if (type === 0x37) {
|
|
197
225
|
this.onClickButtonMessage(message);
|
|
198
226
|
}
|
|
@@ -217,9 +245,26 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
217
245
|
else if (type === 0x15) {
|
|
218
246
|
}
|
|
219
247
|
else {
|
|
220
|
-
this.logEvent({ message: 'got hub notification', raw:
|
|
248
|
+
this.logEvent({ message: 'got hub notification', raw: message.toString('hex') });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
bufferPendingMeasurement(type, buffer) {
|
|
252
|
+
this.clearPendingMeasurement();
|
|
253
|
+
const timer = setTimeout(() => {
|
|
254
|
+
const pending = this.pendingMeasurement;
|
|
255
|
+
this.pendingMeasurement = undefined;
|
|
256
|
+
if (!this.measurementReassemblyErrorLogged) {
|
|
257
|
+
this.measurementReassemblyErrorLogged = true;
|
|
258
|
+
this.logEvent({ message: 'error', fn: 'onMeasurement', error: 'message reassembly timed out - incomplete message dropped', type: pending?.type, payload: pending?.buffer?.toString('hex') });
|
|
259
|
+
}
|
|
260
|
+
}, BleZwiftPlaySensor.MEASUREMENT_REASSEMBLY_TIMEOUT);
|
|
261
|
+
this.pendingMeasurement = { type, buffer, timer };
|
|
262
|
+
}
|
|
263
|
+
clearPendingMeasurement() {
|
|
264
|
+
if (this.pendingMeasurement) {
|
|
265
|
+
clearTimeout(this.pendingMeasurement.timer);
|
|
266
|
+
this.pendingMeasurement = undefined;
|
|
221
267
|
}
|
|
222
|
-
return true;
|
|
223
268
|
}
|
|
224
269
|
async initHubService(setSimulation = true) {
|
|
225
270
|
if (!this.isHubServiceActive && this.initHubServicePromise !== undefined) {
|
|
@@ -309,6 +354,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
309
354
|
this.logEvent({ message: 'trainer response received', unknown: data.unknown, text });
|
|
310
355
|
}
|
|
311
356
|
catch (err) {
|
|
357
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
358
|
+
throw err;
|
|
312
359
|
let payload = 'unknown';
|
|
313
360
|
try {
|
|
314
361
|
payload = m.toString('hex');
|
|
@@ -325,6 +372,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
325
372
|
this.logEvent({ message: 'riding data received', power: data.power, cadence: data.cadence, Speed: data.speedX100 / 100, heartrate: data.hR, unknown1: data.unknown1, unknown2: data.unknown2 });
|
|
326
373
|
}
|
|
327
374
|
catch (err) {
|
|
375
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
376
|
+
throw err;
|
|
328
377
|
this.logEvent({ message: 'Error', fn: 'onRidingData', error: err.message, stack: err.stack });
|
|
329
378
|
}
|
|
330
379
|
}
|
|
@@ -374,6 +423,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
374
423
|
});
|
|
375
424
|
}
|
|
376
425
|
catch (err) {
|
|
426
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
427
|
+
throw err;
|
|
377
428
|
this.logEvent({ message: 'Error', fn: 'onRideKeyPadStatus', error: err.message, stack: err.stack });
|
|
378
429
|
}
|
|
379
430
|
}
|
|
@@ -437,6 +488,8 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
437
488
|
this.prevClickMessage = messageStr;
|
|
438
489
|
}
|
|
439
490
|
catch (err) {
|
|
491
|
+
if (err instanceof RangeError && err.message === 'premature EOF')
|
|
492
|
+
throw err;
|
|
440
493
|
this.logEvent({ message: 'error', fn: 'onButtonMessage', error: err.message, stack: err.stack });
|
|
441
494
|
}
|
|
442
495
|
}
|
|
@@ -618,5 +671,6 @@ export class BleZwiftPlaySensor extends TBleSensor {
|
|
|
618
671
|
delete this.initHubServicePromise;
|
|
619
672
|
delete this.prevHubSettings;
|
|
620
673
|
this.rideKeyPadStates = new Map();
|
|
674
|
+
this.clearPendingMeasurement();
|
|
621
675
|
}
|
|
622
676
|
}
|
|
@@ -23,6 +23,7 @@ export default class BleFitnessMachineDevice extends TBleSensor {
|
|
|
23
23
|
protected rowerDataTS: number | undefined;
|
|
24
24
|
protected rowerMaxPower: number | undefined;
|
|
25
25
|
protected indoorBikeDataTruncationLogged: boolean;
|
|
26
|
+
protected hrmParseErrorLogged: boolean;
|
|
26
27
|
constructor(peripheral: IBlePeripheral, props?: any);
|
|
27
28
|
get features(): IndoorBikeFeatures;
|
|
28
29
|
reset(): void;
|
|
@@ -14,12 +14,18 @@ type BleZwiftPlaySensorProps = {
|
|
|
14
14
|
isTrainer?: boolean;
|
|
15
15
|
};
|
|
16
16
|
type DeviceType = 'left' | 'right' | 'click' | 'hub' | 'ride-left' | 'ride-right';
|
|
17
|
+
type PendingMeasurement = {
|
|
18
|
+
type: number;
|
|
19
|
+
buffer: Buffer;
|
|
20
|
+
timer: ReturnType<typeof setTimeout>;
|
|
21
|
+
};
|
|
17
22
|
export declare class BleZwiftPlaySensor extends TBleSensor {
|
|
18
23
|
static readonly profile: LegacyProfile;
|
|
19
24
|
static readonly protocol: BleProtocol;
|
|
20
25
|
static readonly services: string[];
|
|
21
26
|
static readonly characteristics: any[];
|
|
22
27
|
static readonly detectionPriority = 1;
|
|
28
|
+
static readonly MEASUREMENT_REASSEMBLY_TIMEOUT = 250;
|
|
23
29
|
protected emitter: EventEmitter;
|
|
24
30
|
protected isHubPairConfirmed: boolean;
|
|
25
31
|
protected encrypted: boolean;
|
|
@@ -41,6 +47,8 @@ export declare class BleZwiftPlaySensor extends TBleSensor {
|
|
|
41
47
|
protected subscribePromise: Promise<boolean>;
|
|
42
48
|
protected prevHubSettings: DeviceSettingsSubContent | undefined;
|
|
43
49
|
protected prevcWax10000: number;
|
|
50
|
+
protected pendingMeasurement: PendingMeasurement | undefined;
|
|
51
|
+
protected measurementReassemblyErrorLogged: boolean;
|
|
44
52
|
constructor(peripheral: IBlePeripheral | TBleSensor, props?: BleZwiftPlaySensorProps);
|
|
45
53
|
reconnectSensor(): Promise<boolean>;
|
|
46
54
|
stopSensor(): Promise<boolean>;
|
|
@@ -53,6 +61,9 @@ export declare class BleZwiftPlaySensor extends TBleSensor {
|
|
|
53
61
|
setGearRatio(gearRatio: number): Promise<number>;
|
|
54
62
|
protected sendPlayCommand(id: number, command: Buffer): Promise<Buffer<ArrayBufferLike>>;
|
|
55
63
|
protected onMeasurement(d: Buffer): boolean;
|
|
64
|
+
protected dispatchMeasurement(type: number, message: Buffer): void;
|
|
65
|
+
protected bufferPendingMeasurement(type: number, buffer: Buffer): void;
|
|
66
|
+
protected clearPendingMeasurement(): void;
|
|
56
67
|
initHubService(setSimulation?: boolean): Promise<boolean>;
|
|
57
68
|
sendHubRequest(request: HubRequest): Promise<Buffer<ArrayBufferLike>>;
|
|
58
69
|
sendHubCommand(command: HubCommand): Promise<Buffer<ArrayBufferLike>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-devices",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.38",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"lint": "eslint . --ext .ts",
|
|
6
6
|
"build": "npm run build:esm && npm run build:cjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"protoc": "^33.6.0",
|
|
42
42
|
"ts-node": "^10.9.2",
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
|
-
"vitest": "^4.
|
|
44
|
+
"vitest": "^4.1.11"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"lib/"
|