incyclist-devices 2.3.25 → 2.3.26
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/antv2/fe/adapter.js
CHANGED
|
@@ -43,14 +43,7 @@ class AntFEAdapter extends adapter_1.default {
|
|
|
43
43
|
if (this.promiseStop)
|
|
44
44
|
return;
|
|
45
45
|
if (this.promiseSendUpdate) {
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
throw new Error();
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
stack = err.stack;
|
|
52
|
-
}
|
|
53
|
-
this.logEvent({ message: 'send bike update skipped', device: this.getName(), request, reason: 'busy', stack });
|
|
46
|
+
this.logEvent({ message: 'send bike update skipped', device: this.getName(), request, reason: 'busy' });
|
|
54
47
|
return;
|
|
55
48
|
}
|
|
56
49
|
let isReset = request.reset && Object.keys(request).length === 1;
|
package/lib/ble/fm/sensor.js
CHANGED
|
@@ -267,16 +267,20 @@ class BleFitnessMachineDevice extends sensor_1.TBleSensor {
|
|
|
267
267
|
}
|
|
268
268
|
getFitnessMachineFeatures() {
|
|
269
269
|
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
var _a;
|
|
270
271
|
if (this._features)
|
|
271
272
|
return this._features;
|
|
272
273
|
try {
|
|
273
274
|
const data = yield this.read('2acc');
|
|
274
275
|
const buffer = data ? Buffer.from(data) : undefined;
|
|
276
|
+
const services = ((_a = this.peripheral) === null || _a === void 0 ? void 0 : _a.services) || [];
|
|
277
|
+
let power = services.some(s => (0, utils_1.matches)(s.uuid, '1818'));
|
|
278
|
+
let heartrate = services.some(s => (0, utils_1.matches)(s.uuid, '180d'));
|
|
275
279
|
if (buffer) {
|
|
276
280
|
const fitnessMachine = buffer.readUInt32LE(0);
|
|
277
281
|
const targetSettings = buffer.readUInt32LE(4);
|
|
278
|
-
|
|
279
|
-
|
|
282
|
+
power = power || (fitnessMachine & consts_2.FitnessMachineFeatureFlag.PowerMeasurementSupported) !== 0;
|
|
283
|
+
heartrate = heartrate || (fitnessMachine & consts_2.FitnessMachineFeatureFlag.HeartRateMeasurementSupported) !== 0;
|
|
280
284
|
const cadence = (fitnessMachine & consts_2.FitnessMachineFeatureFlag.CadenceSupported) !== 0;
|
|
281
285
|
const setSlope = (targetSettings & consts_2.TargetSettingFeatureFlag.IndoorBikeSimulationParametersSupported) !== 0
|
|
282
286
|
|| (targetSettings & consts_2.TargetSettingFeatureFlag.InclinationTargetSettingSupported) !== 0;
|
|
@@ -66,9 +66,14 @@ class DirectConnectInterface extends events_1.default {
|
|
|
66
66
|
return peripheral_1.DirectConnectPeripheral.create(announcement);
|
|
67
67
|
}
|
|
68
68
|
createDeviceSetting(service) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
try {
|
|
70
|
+
const name = service.name;
|
|
71
|
+
const protocol = this.getProtocol(service);
|
|
72
|
+
return { interface: DirectConnectInterface.INTERFACE_NAME, name, protocol };
|
|
73
|
+
}
|
|
74
|
+
catch (_a) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
78
|
createPeripheralFromSettings(settings) {
|
|
74
79
|
const info = this.getAll().find(a => a.service.name === settings.name);
|
|
@@ -228,7 +233,10 @@ class DirectConnectInterface extends events_1.default {
|
|
|
228
233
|
});
|
|
229
234
|
}
|
|
230
235
|
emitDevice(service) {
|
|
231
|
-
|
|
236
|
+
const device = this.createDeviceSetting(service);
|
|
237
|
+
if (!device)
|
|
238
|
+
return;
|
|
239
|
+
this.emit('device', device, service);
|
|
232
240
|
}
|
|
233
241
|
buildDeviceSettings(matching = []) {
|
|
234
242
|
return matching.map((name) => ({ interface: DirectConnectInterface.INTERFACE_NAME, name }));
|