incyclist-devices 1.4.61 → 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.
@@ -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
- this.logEvent({ message: 'subscribe', peripheral: this.peripheral.address, characteristic: c.uuid });
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
- console.log('~~~ error', err);
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);
@@ -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 (bikeData.pedalRpm === 0 || bikeData.isPedalling === false) {
53
- power = 0;
52
+ if (power > 0) {
53
+ data.isPedalling = true;
54
54
  }
55
55
  const m = this.getWeight();
56
56
  const t = this.getTimeSinceLastUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.61",
3
+ "version": "1.4.62",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",