Noble (Node.js Bluetooth LE) with Windows 10 UWP bindings
npm install @iotize/noble-uwpnoble has required an
noble using that newly available
noble-uwp instead of noble:
javascript
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.
Building for electron
Currently using electron-rebuild does not work.
In order to build this module for electron it has to be rebuilt using the following command:
`powershell
npm rebuild --runtime=electron --target=1.7.1 --arch=x64 --rebuild --disturl=https://atom.io/download/electron --build_from_source=true
`
adjust the target version to the version of electron you are running (1.7.1 works for electron 1.7.0 and up)
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:
`powershell
git clone https://github.com/sandeepmistry/node-sensortag
cd node-sensortag
npm install
npm install noble-uwp
node -e "var fs = require('fs'),
fs.writeFileSync(f, fs.readFileSync(f).toString().replace(
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`.