Skip to content

Noble (Node.js Bluetooth LE) with Windows 10 UWP bindings

License

Notifications You must be signed in to change notification settings

geovie/noble-uwp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Noble (Node.js Bluetooth LE) for Windows 10

So far, noble has required an alternate Bluetooth driver on Windows, due to lack of good BLE support in the Windows Bluetooth stack. But the Windows 10 Creators Update has finally improved the BLE support. This project is an attempt to implement bindings for noble using that newly available functionality in Windows 10.

System Requirements

  • Node.js v6 or later. (Node v4 might work, but is untested.)
  • Windows 10 build 10.0.15021 or later, currently available on the Windows Insider Preview Fast ring
  • Windows 10 SDK build 10.0.15021 or later, available from the Windows Insider Preview SDK page
    • Note the SDK build number changes frequently during the preview phase. You may need to update the WIN_SDK_VER variable in common.gypi to refer to the SDK build number that is installed. Try to use an SDK build that matches your Windows 10 preview build.

Usage

Simply require noble-uwp instead of noble:

const noble = require('noble-uwp');

Then use it in the same way as the regular noble. On non-Windows platforms, the benavior is unchanged from noble, while on Windows the UWP bindings are used instead of noble's Bluetooth HCI bindings.

Testing

So far, testing has been done with a TI SensorTag.

First, make sure you have the necessary prerequisites for building Node.js native modules. Then, make sure a SensorTag is powered on (light is blinking) and within range, and use the following commands to set up and run tests from Windows PowerShell:

git clone https://github.com/sandeepmistry/node-sensortag
cd node-sensortag
npm install
npm install noble-uwp
node -e "var fs = require('fs'), `
  f = 'node_modules/noble-device/lib/util.js'; `
  fs.writeFileSync(f, fs.readFileSync(f).toString().replace(`
    'require(\'noble\')', 'require(\'noble-uwp\')'))"
$env:DEBUG="noble-uwp"
node test.js

Notes:

  • The NodeRT adapter libraries may take a few minutes to build with node-gyp; please be patient.
  • The above string replacement in the noble-device source file is necessary to get it to use the noble-uwp package instead of regular noble.
  • The DEBUG environment variable setting is optional; set it if you want to see verbose console output from noble-uwp.

Implementation Status

The following functionality is working:

  • Device discovery
  • Device services discovery
  • Service included services discovery
  • Service characteristics discovery
  • Characteristic reading and writing
  • Characteristic change notifications
  • Descriptors (discovering, reading, writing)

The following functionality is not yet implemented:

  • Broadcast

About

Noble (Node.js Bluetooth LE) with Windows 10 UWP bindings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.1%
  • JavaScript 6.7%
  • Other 0.2%