Socket
Book a DemoInstallSign in
Socket

@danielgjackson/ble-uart

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danielgjackson/ble-uart

Bluetooth BLE Nordic UART Client (Node.js, using noble)

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Bluetooth BLE Nordic UART Client

BLE UART client using noble.

To use the package:

npm i -s @danielgjackson/ble-uart

Example code for demo.mjs (substitute A1:B2:C3:D4:E5:F6 with your device's address):

import BleUart from '@danielgjackson/ble-uart'

async function demo(address) {

    console.log('Scanning...')
    const bleUart = await BleUart.scanForBleUart(address)

    bleUart.addLineReader((line) => {
        console.log(`Received: ${line}`)
    })

    console.log('Connecting...')
    await bleUart.connect()

    console.log('Connected!')
    bleUart.write('connected\n')
}

demo('A1:B2:C3:D4:E5:F6')

To run the example:

sudo $(which node) demo.mjs

To run this without needing sudo access each time, you can give the current node binary permission to use Bluetooth at a low level (and this must be repeated if you change the node version, e.g. with nvm):

sudo setcap cap_net_raw+eip $(eval readlink -f $(which node))

...after which, you should be able to run using:

node demo.mjs

Keywords

UART

FAQs

Package last updated on 17 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.