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

Crash with uncaught exception of type Napi::Error #65

Closed desdoo closed 6 months ago

desdoo commented 6 months ago

Hey, When running my Node.js application that uses the @abandonware/noble library to interact with Bluetooth devices, the application crashes with the following error message:

libc++abi: terminating with uncaught exception of type Napi::Error
zsh: abort node getDTC.js

This occurs after successfully discovering a device and attempting to send a command to a characteristic.

/Relevant part of the code that leads to the crash

function sendCommand(characteristic, command) {
    const bufferCommand = Buffer.from(command, 'hex');
    characteristic.write(bufferCommand, false, (error) => {
            if (error) {
             console.error(Error writing command ${command} to characteristic ${characteristic.uuid}:, error);
              } else {
                console.log(Command ${command} sent to characteristic ${characteristic.uuid});
              }
    });
}

Any idea?

chrvadala commented 6 months ago

This isn't @abandonware/noble project :)