noble-winrt
is a small UWP-to-noble bridge based on the web-bluetooth-polyfill project. It supports BLE connectivity on Windows without the need for a dongle and complicated driver set-up. It is similar to noble-uwp but may work better for some build processes.
Install with npm or yarn:
npm install --save noble-winrt
Then simply use in place of noble
:
const noble = require('noble-winrt');
noble-winrt
will perform exactly the same as noble
on non-Windows systems. However, it will use the WinRT bindings on Windows instead of noble
's default Bluetooth HCI bindings.
If you'd like to use this library to work with the Web Bluetooth api through bleat, you will have to replace noble
to noble-winrt
. Running the following command in a powershell terminal in the directory containing your project's node_modules
should take care of that:
node -e "var fs = require('fs'), `
f = 'node_modules/bleat/dist/adapter.noble.js'; `
fs.writeFileSync(f, fs.readFileSync(f).toString().replace(`
'require(\'noble\')', 'require(\'noble-winrt\')'))"