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
319 stars 47 forks source link

How to create a peripheral? #17

Closed alexcastillo closed 2 years ago

alexcastillo commented 3 years ago

Thank you so much for this project!

I was wondering if it is possible to create a ble peripheral that can advertise some static data?

Something similar to bleno's example.

bleno.startAdvertising(name, serviceUuids[, callback(error)]);

// or

bleno.startAdvertisingIBeacon(uuid, major, minor, measuredPower[, callback(error)]);
chrvadala commented 3 years ago

Hi @alexcastillo, this capability it isn't still available, but might be added in a future version.

alexcastillo commented 3 years ago

Good to know, @chrvadala.

Thank you for the update, and keep up the good work!

SimonGAndrews commented 3 years ago

AdvertCreation01

Ive got a project WIP that may help this along, happy to share as I go.

the project is an 'Alexa Gadget' based on raspberry pi, with Node.js . The gadget will be a peripheral to an Alexa dot , communicating over bluetooth as per https://developer.amazon.com/en-US/docs/alexa/alexa-gadgets-toolkit/understand-alexa-gadgets-toolkit.html .

The work is based on mostly python examples, im converting to JS using dbus-next. eg

https://punchthrough.com/creating-a-ble-peripheral-with-bluez/ ,

https://github.com/dbusjs/node-dbus-next/blob/959c0b1f2453346c17b509d1870820913a32b8a6/test/integration/configured-service.test.js and https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-advertisement

Will publish on github eventually. Here is notes (above) on advertising with dbus-next and bluez. Working on the server GATT service publish next. Im having to learn alot as I go on the whole stack here (literally) so its taking a while :).

alexcastillo commented 3 years ago

@SimonGAndrews,

This is awesome! Thank you so much for sharing.

I'll be happy to be one of your first testers once your publish your server GATT service.

Please keep me posted.