Handle Read peripheral.readHandle(handle, callback(error, data)) Write value descriptor.writeValue(data) // data is a buffer Unsubscribe characteristic.unsubscribe() ĭiscover descriptors characteristic.discoverDescriptors()
Update RSSI peripheral.updateRssi() ĭiscover services peripheral.discoverServices() // any service UUID Peripheral Connect nnect() ĭisconnect or cancel pending connection peripheral.disconnect() noble.on('stateChange', callback(state)) can be used register for state change events. NOTE: noble.state must be poweredOn before scanning is started. Noble.startScanning(serviceUUIDs, allowDuplicates) // particular UUID's Noble.startScanning(, true) // any service UUID, allow duplicates
Install npm install nobleĪctions Start scanning noble.startScanning() // any service UUID, no duplicates You need to stop scanning before trying to connect in order to solve this issue. Intel Dual Band Wireless-AC 7260 (Intel Corporation Wireless 7260 (rev 73)) : Error: Connection Rejected due to Limited Resources (0xd)
Sena UD-100 (Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)) : Error: Command disallowed You will get the following messages when trying to connect :
Some BLE adapters cannot connect to a peripheral while they are scanning (examples below). This limit is imposed upon by the Bluetooth adapter hardware as well as it's firmware. See set up guide on Bluetooth LE with Node.js and Noble on Windows Notes Maximum simultaneous connections
Make sure you have read and write permissions on the /dev/usb/* device that corresponds to your Bluetooth adapter. Unload ng_ubt kernel module if already loaded: sudo kldunload ng_ubt Make sure you have GNU Make: sudo pkg install gmakeĭisable automatic loading of the default Bluetooth stack by putting nf into /usr/local/etc/devd/nf and restarting devd ( sudo service devd restart). See Configure Intel Edison for Bluetooth LE (Smart) Development FreeBSD
Ubuntu/Debian/Raspbian sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev Other platforms may be developed later on.
Note: macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only supported OSes. Want to implement a peripheral? Checkout bleno A Node.js BLE (Bluetooth Low Energy) central module.