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
315 stars 46 forks source link

Listen for Beacons #1

Open pacmac opened 4 years ago

pacmac commented 4 years ago

Hi;

Very frustrated with noble so testing out your libraries.

I am able to discover my devices, but how would I use this to listen for beacon transmissions and read the device manufacturer's data ?

I don't see any method or property related to the manufacturer's data.

Id not want to connect to the device, but to simply read the raw data and decode it ?

Thanks

chrvadala commented 4 years ago

I know, I wrote this library because I was frustrated too by noble. :) This project is quite new, It will allow you to get advertised data, but today I can't provide you an official release date. I hope to start working on it soon.

dzek69 commented 3 years ago

@chrvadala hey, any update on your progress? because project seems to be dead currently :(

i was looking for alternative to noble too, still no stable library for node

trobstFairway commented 3 years ago

For anyone interested, I added the function below to node-ble/src/Device.js to receive manufacturing data (useful for reading data from Beacons):

async getManfData() { return this.helper.prop('ManufacturerData') }

which you can call like so:

const mdata = await device.getManfData()

This returns an object whose keys are the 16-bit Manufacturer ID. You may get the raw data by doing (for example):

const mdataRaw = m[Object.keys(m)[0]].value

Hope this helps!