node-ble
node-ble copied to clipboard
Throwing NotPermitted error when try to call startNotifications
Hello guys
I had try to call startNotifications and got this error:
DBusError: Write not permitted
at _methodReturnHandlers.<computed> (/home/ricardo/Documentos/testes/scannerBlue/node_modules/dbus-next/lib/bus.js:339:27)
at handleMessage (/home/ricardo/Documentos/testes/scannerBlue/node_modules/dbus-next/lib/bus.js:98:11)
at EventEmitter.<anonymous> (/home/ricardo/Documentos/testes/scannerBlue/node_modules/dbus-next/lib/bus.js:147:9)
at EventEmitter.emit (events.js:314:20)
at /home/ricardo/Documentos/testes/scannerBlue/node_modules/dbus-next/lib/connection.js:112:14
at Socket.<anonymous> (/home/ricardo/Documentos/testes/scannerBlue/node_modules/dbus-next/lib/message.js:63:9)
at Socket.emit (events.js:314:20)
at emitReadable_ (_stream_readable.js:567:12)
at processTicksAndRejections (internal/process/task_queues.js:79:21) {
type: 'org.bluez.Error.NotPermitted',
text: 'Write not permitted',
reply: Message {
type: 3,
_sent: false,
_serial: 5364,
path: undefined,
interface: undefined,
member: undefined,
errorName: 'org.bluez.Error.NotPermitted',
replySerial: 171,
destination: ':1.401',
sender: ':1.5',
signature: 's',
body: [ 'Write not permitted' ],
flags: 1
}
}
I'm using ubuntu 20.04, mi band 4 and node-ble 1.2.0. Trying to get Heart Rate Measure.
This is the code I had use:
await device.connect();
const rssi = await device.getRSSI();
const gattServer = await device.gatt();
const service = await gattServer.getPrimaryService('0000180d-0000-1000-8000-00805f9b34fb');
const characteristic = await service.getCharacteristic('00002a37-0000-1000-8000-00805f9b34fb');
const flags = await characteristic.getFlags();
characteristic.on('valuechanged', buffer => {
console.log(buffer);
device.disconnect();
});
await characteristic.startNotifications();
Can anyone tells me why it is throwing this error ?
Same here, anybody?
This seems something related with the device that you're using. Closing for now, feel free to create a new issue attaching some steps to reproduce it.
I'm facing this issue now. May I know what is the root cause of it?