robotastic / ble-ancs

A NodeJS library for Apple Notification Center Service over BLE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encrypt change called before Accept

PaulBGD opened this issue · comments

Here's what it looks like in console:

~/Documents/Coding/ble-ancs master 
❯ sudo node examples/test.js 
on -> stateChange: poweredOn
on -> advertisingStart: success
able encryptChange!!!
/home/paul/Documents/Coding/ble-ancs/index.js:45
  this._peripheral.findServiceAndCharacteristics(SERVICE_UUID, [], function(error, services, characteristics) {
                  ^

TypeError: Cannot read property 'findServiceAndCharacteristics' of undefined
    at BleAncs.discoverServicesAndCharacteristics (/home/paul/Documents/Coding/ble-ancs/index.js:45:19)
    at BleAncs.onEncryptChange (/home/paul/Documents/Coding/ble-ancs/index.js:233:12)
    at emitNone (events.js:86:13)
    at Able.emit (events.js:185:7)
    at Able.onEncryptChange (/home/paul/Documents/Coding/ble-ancs/lib/able.js:90:10)
    at emitNone (events.js:86:13)
    at AbleBindings.emit (events.js:185:7)
    at AbleBindings.onEncryptChange (/home/paul/Documents/Coding/ble-ancs/lib/hci-socket/bindings.js:370:10)
    at emitTwo (events.js:106:13)
    at Hci.emit (events.js:191:7)

this._peripheral isn't set because the accept event hasn't been called yet.

+1 I'm experiencing this issue as well. I've been poking around the code but I have yet to figure it out.

Side note, I'm using a Raspberry Pi Zero, which isn't listed as a supported device for noble so that might be my issue.

Same issue on Ubuntu 17.04 with a supported adapter, so it looks like a common issue.