All Projects → loginov-rocks → bluetooth-terminal

loginov-rocks / bluetooth-terminal

Licence: MIT license
ES6 class for serial communication with your own Bluetooth Low Energy (Smart) devices

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to bluetooth-terminal

Web Bluetooth Terminal
Progressive Web Application for serial communication with your own Bluetooth Low Energy (Smart) devices
Stars: ✭ 130 (+202.33%)
Mutual labels:  serial, communication, bluetooth, ble, bluetooth-low-energy
bluetooth-manager
Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Stars: ✭ 75 (+74.42%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-smart
arduino-ble-gadget
Create your own Do-It-Yourself BLE enabled sensor gadget on the ESP32 platform.
Stars: ✭ 31 (-27.91%)
Mutual labels:  communication, bluetooth, ble
Blueborne Scanner
Bluetooth scanner for local devices that may be vulnerable to Blueborne exploit
Stars: ✭ 125 (+190.7%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Node Bluetooth Serial Port
Serial I/O over bluetooth for NodeJS
Stars: ✭ 444 (+932.56%)
Mutual labels:  serial, communication, bluetooth
Bluetooth
Cross-platform Bluetooth API for Go and TinyGo.
Stars: ✭ 246 (+472.09%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Extendable
Blocks Based Bluetooth LE Connectivity framework for iOS/watchOS/tvOS/OSX. Quickly configure centrals & peripherals, perform read/write operations, and respond characteristic updates.
Stars: ✭ 88 (+104.65%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Easyble
Android BLE framework
Stars: ✭ 155 (+260.47%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
JDY-08
JDY-08 Bluetooth transparent transmission module, with resource for KiCAD
Stars: ✭ 48 (+11.63%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Reactivebeacons
Android library scanning BLE beacons nearby with RxJava
Stars: ✭ 171 (+297.67%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
H Ble
Android Ble类库,基于回调,暴露搜索、连接、发送、接收、断开连接等接口,无需关心细节操作即可进行Ble通信。
Stars: ✭ 171 (+297.67%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Arduino Robust Serial
A simple and robust serial communication protocol. It was designed for Arduino but can be used for other purposes (e.g. bluetooth, sockets). Implementation in C Arduino, C++, Python and Rust.
Stars: ✭ 83 (+93.02%)
Mutual labels:  serial, communication, bluetooth
Rxbluetoothkit
iOS & OSX Bluetooth library for RxSwift
Stars: ✭ 1,213 (+2720.93%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Rxbluetoothkotlin
Bluetooth low energy reactive framework for Android written in Kotlin
Stars: ✭ 68 (+58.14%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Nimble Arduino
A fork of the NimBLE library structured for compilation with Ardruino, designed for use with ESP32.
Stars: ✭ 108 (+151.16%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Ios Pods Dfu Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 349 (+711.63%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Ble.net
Cross-platform Bluetooth Low Energy (BLE) library for Android, iOS, and UWP
Stars: ✭ 137 (+218.6%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
IOS-DFU-Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 400 (+830.23%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
IoT-iBeacon
An Ionic app for indoor localization and navigation using BLE iBeacons.
Stars: ✭ 39 (-9.3%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
Node Ble
Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus
Stars: ✭ 159 (+269.77%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy

bluetooth-terminal

npm CI CD Coverage Status

BluetoothTerminal is a class written in ES6 for serial communication with Bluetooth Low Energy (Smart) devices from the web using Web Bluetooth API.

With this class you can communicate bidirectionally with your own device through the one General Attribute Profile characteristic that only offered by DIY modules.

Please check out the Web-Bluetooth-Terminal repository to see implementation details in a real life example.

Quick Start

Install

You can use the script directly or install it using npm and require in your code.

npm install bluetooth-terminal

Use

// Obtain configured instance.
let terminal = new BluetoothTerminal();

// Override `receive` method to handle incoming data as you want.
terminal.receive = function(data) {
  alert(data);
};

// Request the device for connection and get its name after successful connection.
terminal.connect().then(() => {
  alert(terminal.getDeviceName() + ' is connected!');
});

// Send something to the connected device.
terminal.send('Simon says: Hello, world!');

// Disconnect from the connected device.
terminal.disconnect();

API

BluetoothTerminal

Bluetooth Terminal class.

Kind: global class


new BluetoothTerminal([serviceUuid], [characteristicUuid], [receiveSeparator], [sendSeparator], [onConnected], [onDisconnected])

Create preconfigured Bluetooth Terminal instance.

Parameter Type Default Description
[serviceUuid] number | string 0xFFE0 Service UUID
[characteristicUuid] number | string 0xFFE1 Characteristic UUID
[receiveSeparator] string '\n' Receive separator
[sendSeparator] string '\n' Send separator
[onConnected] Function | undefined undefined Listener for connected event
[onDisconnected] Function | undefined undefined Listener for disconnected event

setServiceUuid(uuid)

Set number or string representing service UUID used.

Kind: instance method of BluetoothTerminal

Parameter Type Description
uuid number | string Service UUID

setCharacteristicUuid(uuid)

Set number or string representing characteristic UUID used.

Kind: instance method of BluetoothTerminal

Parameter Type Description
uuid number | string Characteristic UUID

setReceiveSeparator(separator)

Set character representing separator for data coming from the connected device, end of line for example.

Kind: instance method of BluetoothTerminal

Parameter Type Description
separator string Receive separator with length equal to one

setSendSeparator(separator)

Set string representing separator for data coming to the connected device, end of line for example.

Kind: instance method of BluetoothTerminal

Parameter Type Description
separator string Send separator

setOnConnected(listener)

Set a listener to be called after a device is connected.

Kind: instance method of BluetoothTerminal

Parameter Type Description
listener Function | undefined Listener for connected event

setOnDisconnected(listener)

Set a listener to be called after a device is disconnected.

Kind: instance method of BluetoothTerminal

Parameter Type Description
listener Function | undefined Listener for disconnected event

connect()Promise

Launch Bluetooth device chooser and connect to the selected device.

Kind: instance method of BluetoothTerminal

Returns: Promise - Promise which will be fulfilled when notifications will be started or rejected if something went wrong


disconnect()

Disconnect from the connected device.

Kind: instance method of BluetoothTerminal


receive(data)

Data receiving handler which called whenever the new data comes from the connected device, override it to handle incoming data.

Kind: instance method of BluetoothTerminal

Parameter Type Description
data string Data

send(data)Promise

Send data to the connected device.

Kind: instance method of BluetoothTerminal

Returns: Promise - Promise which will be fulfilled when data will be sent or rejected if something went wrong

Parameter Type Description
data string Data

getDeviceName()string

Get the connected device name.

Kind: instance method of BluetoothTerminal

Returns: string - Device name or empty string if not connected

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].