Coder Social home page Coder Social logo

noble-winrt's Introduction

Noble (Node.js Bluetooth LE) Bindings for Windows

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.

Getting Started

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.

Integrating with bleat

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\')'))"

noble-winrt's People

Contributors

chiefbiiko avatar dependabot[bot] avatar jdpigeon avatar urish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

noble-winrt's Issues

Can not find services

Hello i used the noble module in my Linux environment and it works very well, so i tried this one on my Window envronment but i can not find the same services of the same device...

stateChange is always poweredOn

Hi! I would like to ask if there's a way to check bluetooth state is on or off?
I try switching the windows bluetooth on and off, but it's always stay in the state of "poweredOn".
Even when i try relaunching with bluetooth state off, it's still detect as "poweredOn".

noble.on('stateChange', function(state) {
console.log(state);
if (state === 'poweredOn') {
noble.startScanning();
} else {
noble.stopScanning();
}
});

Spawn ENOENT when running in installed Windows app

Dealing with an issue that's only popping up on Windows 10 and the release version of an electron app that's been installed into system programs.

Uncaught Error: spawn C:\Users\jdpig\AppData\Local\Programs\BrainWaves\resources\app.asar\node_modules\noble-winrt\prebuilt\BLEServer.exe ENOENT

I've confirmed that BLEServer.exe exists at that path and that the app has read/write access to that file. I've also tried running the app as administrator and using cross-spawn instead of child-process.

I see a lot of issues out there about running spawn in Node.js successfully on Windows. However, none of the provided solutions seem to be working: nodejs/node-v0.x-archive#2318

Device Connection Issue

Hey , really helpfull package , am trying to port this in dart ,
but stuck at one point , its not connecting to my ble device

Start Scan , Discover ScanResult , Stop Scan
these methods works Fine

but when i call Connect device , nothing happens on my ble device

here are few logs am printing

{ cmd: 'connect', address: 'd559393bb359', _id: 0 }
{ _type: 'Start' }
StateChange : poweredOn
{
_type: 'response',
_id: 0,
result: 'BluetoothLE#BluetoothLE30:c9๐Ÿ†Žf0:77:e2-d5:59:39:3b:b3:59'
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.