incyclist-devices 1.4.64 → 1.4.65

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.
@@ -55,9 +55,7 @@ class BleInterface extends ble_1.BleInterfaceClass {
55
55
  if (this.logger) {
56
56
  this.logger.logEvent(event);
57
57
  }
58
- if (process.env.BLE_DEBUG) {
59
- console.log('~~BLE:', event);
60
- }
58
+ console.log('~~BLE:', event);
61
59
  }
62
60
  onStateChange(state) {
63
61
  if (state !== ble_1.BleState.POWERED_ON) {
@@ -540,8 +538,8 @@ class BleInterface extends ble_1.BleInterfaceClass {
540
538
  if (fromCache)
541
539
  this.logEvent({ message: 'adding from Cache', peripheral: peripheral.address });
542
540
  else {
543
- const { id, name, address } = peripheral;
544
- this.logEvent({ message: 'BLE scan: found device', peripheral: { id, name, address } });
541
+ const { id, name, address, advertisement = {} } = peripheral;
542
+ this.logEvent({ message: 'BLE scan: found device', peripheral: { id, name, address, services: advertisement.serviceUuids } });
545
543
  }
546
544
  if (!peripheral || !peripheral.advertisement || !peripheral.advertisement.serviceUuids || peripheral.advertisement.serviceUuids.length === 0)
547
545
  return;
@@ -552,7 +550,11 @@ class BleInterface extends ble_1.BleInterfaceClass {
552
550
  return;
553
551
  peripheralsProcessed.push(peripheral.address);
554
552
  const characteristics = yield this.getCharacteristics(peripheral);
555
- const DeviceClasses = this.getDeviceClasses(peripheral, { profile });
553
+ const connector = this.getConnector(peripheral);
554
+ const connectedPeripheral = connector.getPeripheral();
555
+ const { id, name, address, advertisement = {} } = connectedPeripheral;
556
+ const DeviceClasses = this.getDeviceClasses(connectedPeripheral, { profile });
557
+ this.logEvent({ message: 'BLE scan: device connected', peripheral: { id, name, address, services: advertisement.serviceUuids, classes: DeviceClasses.map(c => c.prototype.constructor.name) } });
556
558
  let cntFound = 0;
557
559
  DeviceClasses.forEach((DeviceClass) => __awaiter(this, void 0, void 0, function* () {
558
560
  if (!DeviceClass)
@@ -32,4 +32,5 @@ export default class BlePeripheralConnector {
32
32
  getState(): string;
33
33
  getCharachteristics(): BleCharacteristic[];
34
34
  getServices(): string[];
35
+ getPeripheral(): BlePeripheral;
35
36
  }
@@ -181,5 +181,8 @@ class BlePeripheralConnector {
181
181
  getServices() {
182
182
  return this.services;
183
183
  }
184
+ getPeripheral() {
185
+ return this.peripheral;
186
+ }
184
187
  }
185
188
  exports.default = BlePeripheralConnector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-devices",
3
- "version": "1.4.64",
3
+ "version": "1.4.65",
4
4
  "dependencies": {
5
5
  "@serialport/parser-byte-length": "^9.0.1",
6
6
  "@serialport/parser-delimiter": "^9.0.1",