node-bluetooth-hci-socket
Bluetooth HCI socket binding for Node.js
NOTE: Currently only supports Linux.
Install
npm install bluetooth-hci-socket
Usage
var BluetoothHciSocket = require('bluetooth-hci-socket');
Actions
Create
var bluetoothHciSocket = new BluetoothHciSocket();
Set Filter
var filter = new Buffer(14);
bluetoothHciSocket.setFilter(filter);
Bind
bluetoothHciSocket.bind();
Is Device Up
Query the device state. Note: must be called after bind
.
bluetoothHciSocket.isDevUp(); // returns: true or false
Start/stop
Start or stop event handling:
bluetoothHciSocket.start();
bluetoothHciSocket.stop();
Write
var data = new Buffer();
bluetoothHciSocket.write(data);
Events
Data
bluetoothHciSocket.on('data', function(data) {
});
Error
bluetoothHciSocket.on('error', function(error) {
});
Examples
See examples folder for code examples.