npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

bionic-bt-serial

v0.0.3

Published

Send data between bluetooth devices using a serial like interface

Readme

bionic-bt-serial

Send data between bluetooth devices using a serial like interface

Install

npm install bionic-bt-serial
npx cap sync

API

addListener(PluginEvents, ...)

addListener(eventName: PluginEvents, callback: EventCallback) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ------------------------------------------------------- | | eventName | PluginEvents | | callback | EventCallback |

Returns: Promise<PluginListenerHandle>


addListener('discoveryState', ...)

addListener(eventName: 'discoveryState', callback: (result: { starting?: boolean; completed?: boolean; }) => void) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ------------------------------------------------------------------------------ | | eventName | 'discoveryState' | | callback | (result: { starting?: boolean; completed?: boolean; }) => void |

Returns: Promise<PluginListenerHandle>


addListener('discovered', ...)

addListener(eventName: 'discovered', callback: (result: BTDevice) => void) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ------------------------------------------------------------------ | | eventName | 'discovered' | | callback | (result: BTDevice) => void |

Returns: Promise<PluginListenerHandle>


addListener('rawData', ...)

addListener(eventName: 'rawData', callback: (result: RawDataResult) => void) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ---------------------------------------------------------------------------- | | eventName | 'rawData' | | callback | (result: RawDataResult) => void |

Returns: Promise<PluginListenerHandle>


addListener('connected', ...)

addListener(eventName: 'connected', callback: (result: BTDevice) => void) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ------------------------------------------------------------------ | | eventName | 'connected' | | callback | (result: BTDevice) => void |

Returns: Promise<PluginListenerHandle>


addListener('connectionFailed', ...)

addListener(eventName: 'connectionFailed', callback: (result: BTDevice) => void) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ------------------------------------------------------------------ | | eventName | 'connectionFailed' | | callback | (result: BTDevice) => void |

Returns: Promise<PluginListenerHandle>


addListener('connectionLost', ...)

addListener(eventName: 'connectionLost', callback: (result: BTDevice) => void) => Promise<PluginListenerHandle>

| Param | Type | | --------------- | ------------------------------------------------------------------ | | eventName | 'connectionLost' | | callback | (result: BTDevice) => void |

Returns: Promise<PluginListenerHandle>


getBondedDevices()

getBondedDevices() => Promise<{ result: BTDevice[]; }>

Gets a list of the bonded (paired) devices.

Returns: Promise<{ result: BTDevice[]; }>


startListening(...)

startListening(_options: {}, callback: ListenCallback) => Promise<void>

Start listening for incoming connections

| Param | Type | | -------------- | --------------------------------------------------------- | | _options | {} | | callback | ListenCallback |


stopListening()

stopListening() => Promise<void>

Stops listening for incoming connections.


isListening()

isListening() => Promise<{ result: boolean; }>

True if listening for an accepting incoming connections. A device acting as a server should be listening.

Returns: Promise<{ result: boolean; }>


connect(...)

connect(options: { macAddress: string; }) => Promise<void>

Connect to another device acting as a server that is in listening mode. Should already be paired?

| Param | Type | | ------------- | ------------------------------------ | | options | { macAddress: string; } |


isConnected(...)

isConnected(options: { macAddress: string; }) => Promise<{ result: boolean; }>

True if there is an active connection to the provided macAddress false otherwise.

| Param | Type | | ------------- | ------------------------------------ | | options | { macAddress: string; } |

Returns: Promise<{ result: boolean; }>


getConnectedDevices()

getConnectedDevices() => Promise<{ result: BTDevice[]; }>

Gets a list of the connected devices.

Returns: Promise<{ result: BTDevice[]; }>


disconnect(...)

disconnect(options: { macAddress: string; }) => Promise<{ result: boolean; }>

Disconnects specified connection.

| Param | Type | | ------------- | ------------------------------------ | | options | { macAddress: string; } |

Returns: Promise<{ result: boolean; }>


disconnectAll()

disconnectAll() => Promise<void>

Disconnects all connections (incomming and outgoing).


write(...)

write(options: { macAddress: string; data: number[]; }) => Promise<{ result: boolean; }>

Write data to specified macAddress

| Param | Type | | ------------- | ---------------------------------------------------- | | options | { macAddress: string; data: number[]; } |

Returns: Promise<{ result: boolean; }>


isEnabled()

isEnabled() => Promise<{ result: boolean; }>

True if device has bluetooth enabled, false otherwise

Returns: Promise<{ result: boolean; }>


enableAdapter()

enableAdapter() => Promise<void>

Prompt the user to enable bluetooth. Resolved if bluetooth is enabled, rejects otherwise.


disableAdapter()

disableAdapter() => Promise<void>

Prompt the user to enable bluetooth. Resolved if bluetooth is enabled, rejects otherwise.


showBluetoothSettings()

showBluetoothSettings() => Promise<void>

Open the bluetooth settings screen for the user.


startDiscovery(...)

startDiscovery(_options: {}, callback: DiscoveryCallback) => Promise<void>

Starts discovery process, sends info about found devices to the callback. Scans for about 12 seconds.

| Param | Type | | -------------- | --------------------------------------------------------------- | | _options | {} | | callback | DiscoveryCallback |


cancelDiscovery()

cancelDiscovery() => Promise<void>

Stops any running discovery process.


setName(...)

setName(options: { name: string; }) => Promise<void>

Sets the name of the bluetooth adapter. Name is what paired devices will see when they connect.

| Param | Type | | ------------- | ------------------------------ | | options | { name: string; } |


getName()

getName() => Promise<{ result: string; }>

Gets the name of the bluetooth adapter.

Returns: Promise<{ result: string; }>


setDiscoverable(...)

setDiscoverable(options: { durationSec?: number; }) => Promise<void>

Ensure bluetooth is enabled and the device is discoverable to remote scanners. Default durationSec is 120 is not provided. Max is 300 seconds.

| Param | Type | | ------------- | -------------------------------------- | | options | { durationSec?: number; } |


Interfaces

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Type Aliases

EventCallback

(info: any, err?: any): void

BTDevice

{name:string, macAddress:string, class:number}

RawDataResult

{bytes:number[], from:BTDevice}

ListenCallback

(device: BTDevice, err?: any): void

DiscoveryCallback

(device: BTDevice, err?: any): void

Enums

PluginEvents

| Members | Value | | ---------------------- | ------------------------------- | | discovered | "discovered" | | discoveryState | "discoveryState" | | rawData | "rawData" | | connected | "connected" | | connectionFailed | "connectionFailed" | | connectionLost | "connectionLost" |