node-web-bluetooth not listing BLE devices in Mac Book. Please help

(Harish Kumar K) #1

When the given code is executed in my Mac OSx Machine Mojave 10.14.3, it is not listing any BLE devices which was ON nearby. The list is empty to select and pair. But in chrome browser the similiar navigator.bluetooth is showing the device correctly.

It is simply showing node-web-bluetooth - Pair with device: alone

Code is given below:

const Bluetooth = require(‘node-web-bluetooth’);

let deviceInfoServiceUudi = ‘0000180a-0000-1000-8000-00805f9b34fb’;
let remoteControlServiceUuid = ‘b31e89de-ea00-4784-b19c-61b7baa5f8b4’;
let peripheralServiceUuid = ‘b31e89de-ca00-4784-b19c-61b7baa5f8b4’;
let securityServiceUuid = ‘b31e89de-aa00-4784-b19c-61b7baa5f8b4’;

async function connect() {
const device = await Bluetooth.requestDevice({
filters: [
{services: [deviceInfoServiceUudi, remoteControlServiceUuid, peripheralServiceUuid, securityServiceUuid]}
]
});
const server = await device.gatt.connect();

const service = await server.getPrimaryService(securityServiceUuid);
let CHARACTERISTIC_AUTHORIZATION_UUID = "b31e89de-aa01-4784-b19c-61b7baa5f8b4";
const char = await service.getCharacteristic(CHARACTERISTIC_AUTHORIZATION_UUID);
await char.startNotifications();
char.on('characteristicvaluechanged', (data) => {
  
    console.log(data);
});

}

connect();

(John Gee) #2

(You might get an answer here, but because this forum is focused on npm, you might want to ask your question somewhere that targets experts with your package. I have moved your topic to #community:javascript)