chrvadala / node-ble

Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus
https://www.npmjs.com/package/node-ble
MIT License
310 stars 45 forks source link

Characteristiic throwing error org.bluez.Error.InProgress #26

Open RobsonRojas opened 3 years ago

RobsonRojas commented 3 years ago

I have tested the readValue to a readable characteristic and it worked fine:

  const characteristic1 = await service1.getCharacteristic(TEST_CHARACTERISTIC_WRITE)
  const buffer = await characteristic1.readValue()
  console.log('read', buffer, buffer.toString())

But, when I try to execute writeValue in an writable characteristic with the following code, it is throwing the exception:

  const characteristic2 = await service1.getCharacteristic(TEST_CHARACTERISTIC_WRITE)

  await characteristic2.writeValue(Buffer.from('s'))

The error:

{ DBusError: In Progress
    at _methodReturnHandlers.(anonymous function) (/home/ica/git/ica/fecon_beta/node-ble/node_modules/dbus-next/lib/bus.js:337:27)
    at handleMessage (/home/ica/git/ica/fecon_beta/node-ble/node_modules/dbus-next/lib/bus.js:96:11)
    at EventEmitter.MessageBus.conn.on (/home/ica/git/ica/fecon_beta/node-ble/node_modules/dbus-next/lib/bus.js:146:9)
    at EventEmitter.emit (events.js:182:13)
    at /home/ica/git/ica/fecon_beta/node-ble/node_modules/dbus-next/lib/connection.js:116:14
    at Socket.<anonymous> (/home/ica/git/ica/fecon_beta/node-ble/node_modules/dbus-next/lib/message.js:63:9)
    at Socket.emit (events.js:182:13)
    at emitReadable_ (_stream_readable.js:540:12)
    at process._tickCallback (internal/process/next_tick.js:174:19)
  name: 'DBusError',
  type: 'org.bluez.Error.InProgress',
  text: 'In Progress',
  reply: 
   Message {
     type: 3,
     _sent: false,
     _serial: 2677,
     path: undefined,
     interface: undefined,
     member: undefined,
     errorName: 'org.bluez.Error.InProgress',
     replySerial: 37,
     destination: ':1.165',
     sender: ':1.12',
     signature: 's',
     body: [ 'In Progress' ],
     flags: 1 } }

Could someone help me to solve this? Any sugestion or idea?

EricHier commented 3 years ago

Hi there! I've got the same problem - did you find a solution?