incyclist-devices 1.4.59 → 1.4.62
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/ble/ble-interface.js +2 -2
- package/lib/ble/ble-peripheral.js +4 -3
- package/lib/ble/fm.js +8 -3
- package/lib/ble/pwr.js +3 -1
- package/lib/modes/power-meter.js +2 -2
- package/package.json +1 -1
package/lib/ble/ble-interface.js
CHANGED
|
@@ -462,7 +462,7 @@ class BleInterface extends ble_1.BleInterfaceClass {
|
|
|
462
462
|
}
|
|
463
463
|
scan(props) {
|
|
464
464
|
return __awaiter(this, void 0, void 0, function* () {
|
|
465
|
-
const { timeout = DEFAULT_SCAN_TIMEOUT, deviceTypes = [], requested } = props;
|
|
465
|
+
const { timeout = DEFAULT_SCAN_TIMEOUT, deviceTypes = [], requested, isBackgroundScan } = props;
|
|
466
466
|
let profile;
|
|
467
467
|
if (requested)
|
|
468
468
|
profile = requested instanceof ble_1.BleDeviceClass ?
|
|
@@ -479,7 +479,7 @@ class BleInterface extends ble_1.BleInterfaceClass {
|
|
|
479
479
|
}
|
|
480
480
|
const peripheralsProcessed = [];
|
|
481
481
|
const devicesProcessed = [];
|
|
482
|
-
this.logEvent({ message: 'scan()', props, scanState: this.scanState,
|
|
482
|
+
this.logEvent({ message: 'scan()', props: { timeout, isBackgroundScan }, scanState: this.scanState,
|
|
483
483
|
peripheralCache: this.peripheralCache.map(i => ({ address: i.address, ts: i.ts, name: i.peripheral ? i.peripheral.advertisement.localName : '' })),
|
|
484
484
|
deviceCache: this.devices.map(i => ({ address: i.device.address, profile: i.device.getProfile(), isConnected: i.isConnected }))
|
|
485
485
|
});
|
|
@@ -101,9 +101,10 @@ class BlePeripheralConnector {
|
|
|
101
101
|
c.on('data', (data, _isNotification) => {
|
|
102
102
|
this.onData((0, ble_1.uuid)(c.uuid), data);
|
|
103
103
|
});
|
|
104
|
-
if (callback)
|
|
104
|
+
if (callback) {
|
|
105
105
|
this.on((0, ble_1.uuid)(c.uuid), callback);
|
|
106
|
-
|
|
106
|
+
}
|
|
107
|
+
this.logEvent({ message: 'subscribe', peripheral: this.peripheral.address, characteristic: c.uuid, uuid: (0, ble_1.uuid)(c.uuid) });
|
|
107
108
|
if (this.state.subscribed.find(uuid => uuid === c.uuid) === undefined) {
|
|
108
109
|
try {
|
|
109
110
|
yield this.subscribe(c.uuid);
|
|
@@ -117,7 +118,7 @@ class BlePeripheralConnector {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
catch (err) {
|
|
120
|
-
|
|
121
|
+
this.logEvent({ message: 'error', fn: 'subscribeAll()', error: err.message || err, stack: err.stack });
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
this.state.isSubscribing = false;
|
package/lib/ble/fm.js
CHANGED
|
@@ -148,7 +148,7 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
|
|
|
148
148
|
}
|
|
149
149
|
catch (err) {
|
|
150
150
|
}
|
|
151
|
-
return Object.assign(Object.assign({}, this.data), { raw: data.toString('hex') });
|
|
151
|
+
return Object.assign(Object.assign({}, this.data), { raw: `2a37:${data.toString('hex')}` });
|
|
152
152
|
}
|
|
153
153
|
setCrr(crr) { this.crr = crr; }
|
|
154
154
|
getCrr() { return this.crr; }
|
|
@@ -215,7 +215,7 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
|
|
|
215
215
|
this.data.remainingTime = data.readUInt16LE(offset);
|
|
216
216
|
offset += 2;
|
|
217
217
|
}
|
|
218
|
-
return Object.assign(Object.assign({}, this.data), { raw: data.toString('hex') });
|
|
218
|
+
return Object.assign(Object.assign({}, this.data), { raw: `2ad2:${data.toString('hex')}` });
|
|
219
219
|
}
|
|
220
220
|
parseFitnessMachineStatus(_data) {
|
|
221
221
|
const data = Buffer.from(_data);
|
|
@@ -252,7 +252,7 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
|
|
|
252
252
|
default: break;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
return Object.assign(Object.assign({}, this.data), { raw: data.toString('hex') });
|
|
255
|
+
return Object.assign(Object.assign({}, this.data), { raw: `2ada:${data.toString('hex')}` });
|
|
256
256
|
}
|
|
257
257
|
getFitnessMachineFeatures() {
|
|
258
258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -286,6 +286,11 @@ class BleFitnessMachineDevice extends ble_device_1.BleDevice {
|
|
|
286
286
|
case '2ada':
|
|
287
287
|
res = this.parseFitnessMachineStatus(data);
|
|
288
288
|
break;
|
|
289
|
+
case '2a63':
|
|
290
|
+
case '2a5b':
|
|
291
|
+
case '347b0011-7635-408b-8918-8ff3949ce592':
|
|
292
|
+
this.logger.logEvent({ message: 'onBleData', raw: `uuid:${data.toString('hex')}` });
|
|
293
|
+
break;
|
|
289
294
|
default:
|
|
290
295
|
break;
|
|
291
296
|
}
|
package/lib/ble/pwr.js
CHANGED
|
@@ -111,6 +111,8 @@ class BleCyclingPowerDevice extends ble_device_1.BleDevice {
|
|
|
111
111
|
this.accTorque = data.readUInt16LE(offset);
|
|
112
112
|
offset += 2;
|
|
113
113
|
}
|
|
114
|
+
if (flags & 0x10) {
|
|
115
|
+
}
|
|
114
116
|
if (flags & 0x20) {
|
|
115
117
|
const crankData = {
|
|
116
118
|
revolutions: data.readUInt16LE(offset),
|
|
@@ -125,7 +127,7 @@ class BleCyclingPowerDevice extends ble_device_1.BleDevice {
|
|
|
125
127
|
catch (err) {
|
|
126
128
|
}
|
|
127
129
|
const { instantaneousPower, balance, accTorque, rpm, time } = this;
|
|
128
|
-
return { instantaneousPower, balance, accTorque, rpm, time, raw: data.toString('hex') };
|
|
130
|
+
return { instantaneousPower, balance, accTorque, rpm, time, raw: `2a63:${data.toString('hex')}` };
|
|
129
131
|
}
|
|
130
132
|
onData(characteristic, data) {
|
|
131
133
|
super.onData(characteristic, data);
|
package/lib/modes/power-meter.js
CHANGED
|
@@ -49,8 +49,8 @@ class PowerMeterCyclingMode extends power_base_1.default {
|
|
|
49
49
|
let power = bikeData.power || 0;
|
|
50
50
|
const slope = prevData.slope || 0;
|
|
51
51
|
const distanceInternal = prevData.distanceInternal || 0;
|
|
52
|
-
if (
|
|
53
|
-
|
|
52
|
+
if (power > 0) {
|
|
53
|
+
data.isPedalling = true;
|
|
54
54
|
}
|
|
55
55
|
const m = this.getWeight();
|
|
56
56
|
const t = this.getTimeSinceLastUpdate();
|