incyclist-devices 2.3.0-beta.17 → 2.3.0-beta.19

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.
@@ -195,8 +195,10 @@ class BleInterface extends events_1.default {
195
195
  pauseLogging() {
196
196
  this.logEvent({ message: 'pausing logging' });
197
197
  this.logDisabled = true;
198
+ this.getBinding().pauseLogging();
198
199
  }
199
200
  resumeLogging() {
201
+ this.getBinding().resumeLogging();
200
202
  this.logDisabled = false;
201
203
  this.logEvent({ message: 'resuming logging' });
202
204
  }
@@ -238,7 +240,7 @@ class BleInterface extends events_1.default {
238
240
  const { peripheral } = service;
239
241
  if (peripheral.address === undefined || peripheral.address === '')
240
242
  peripheral.address = peripheral.id || peripheral.name;
241
- const protocol = this.getAdapterFactory().getProtocol(service.advertisement.serviceUuids);
243
+ const protocol = this.getAdapterFactory().getProtocol(service.serviceUUIDs);
242
244
  const { id, name, address } = (0, utils_1.getPeripheralInfo)(peripheral);
243
245
  return { interface: BleInterface.INTERFACE_NAME, protocol, id, name, address };
244
246
  }
@@ -122,7 +122,6 @@ class BleFmAdapter extends adapter_1.default {
122
122
  return;
123
123
  this.setConstants();
124
124
  yield this.establishControl();
125
- this.setConstants();
126
125
  yield this.sendInitialRequest();
127
126
  });
128
127
  }
@@ -8,4 +8,5 @@ export default class BleWahooAdapter extends BleFmAdapter {
8
8
  isSame(device: IAdapter): boolean;
9
9
  getProfile(): LegacyProfile;
10
10
  updateSensor(peripheral: IBlePeripheral): void;
11
+ protected checkCapabilities(): Promise<void>;
11
12
  }
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -28,6 +37,11 @@ class BleWahooAdapter extends fm_1.BleFmAdapter {
28
37
  updateSensor(peripheral) {
29
38
  this.device = new sensor_1.default(peripheral, { logger: this.logger });
30
39
  }
40
+ checkCapabilities() {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ this.logEvent({ message: 'device capabilities updated', name: this.getSettings().name, interface: this.getSettings().interface, capabilities: this.capabilities });
43
+ });
44
+ }
31
45
  }
32
46
  BleWahooAdapter.INCYCLIST_PROFILE_NAME = 'Smart Trainer';
33
47
  exports.default = BleWahooAdapter;
@@ -43,11 +43,8 @@ class BleWahooDevice extends sensor_1.default {
43
43
  return [consts_2.INDOOR_BIKE_DATA, consts_2.FTMS_STATUS, consts_2.CSP_MEASUREMENT, consts_2.HR_MEASUREMENT];
44
44
  }
45
45
  onData(characteristic, data) {
46
- const hasData = super.onData(characteristic, data);
47
- if (!hasData)
48
- return false;
49
- const uuid = characteristic.toLowerCase();
50
- let res = undefined;
46
+ const uuid = (0, utils_1.beautifyUUID)(characteristic).toLowerCase();
47
+ let res;
51
48
  switch (uuid) {
52
49
  case consts_2.CSP_MEASUREMENT:
53
50
  res = this.parsePower(data);
@@ -62,7 +59,7 @@ class BleWahooDevice extends sensor_1.default {
62
59
  res = this.parseFitnessMachineStatus(data);
63
60
  break;
64
61
  default:
65
- this.logEvent({ message: 'data', uuid, data: data.toString('hex') });
62
+ this.logEvent({ message: 'data', uuid, data: Buffer.from(data).toString('hex') });
66
63
  break;
67
64
  }
68
65
  if (res) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "2.3.0-beta.17",
3
+ "version": "2.3.0-beta.19",
4
4
  "dependencies": {
5
5
  "@serialport/bindings-interface": "^1.2.2",
6
6
  "@serialport/parser-byte-length": "^9.0.1",