Published Bluetooth LE Module

September 11, 2013

Well, I published my Node.js module for Bluetooth LE, btle.js (pronounced "Beetle Juice") to npm. Even though it's labeled version 0.1.0, it's got most of the functionality that's necessary for Bluetooth LE - reading attributes, writing commands and requests, and listening for notifications. I'm hoping to add more functionality over the next few weeks/months.

The main reason I was doing this was to get my TI SensorTag working with my Raspberry Pi and Bluetooth LE dongle, which it now does. I've even got the beginnings of a Node.js module for the sensortag, sensortag.js, which is built on top of btle.js. I've got everything working except the Barometric Pressure sensor readings and the Gyroscope readings.

The nice thing about btle.js is that it's purely native C++ code, talking directly to the Linux Bluetooth stack - it's not having to shell out to run gatttool, for instance, which is pretty nice.

For anyone wanting to write some Bluetooth LE code for Linux in a non-Node.js environment, I extracted the low-level I/O code from the Bluez project, removing the dependency on glib so that it's a true, low-level Linux I/O package. The higher-level code is dependant on libuv, of course - I couldn't figure out any good way to separate them - but it shouldn't be too difficult to extract what you need from there as well.

Jack Lund

Jack Lund

comments powered by Disqus