webserial-core
Version:
A strongly-typed, event-driven, abstract TypeScript library for the Web Serial API with custom parsers, command queue, handshake validation, and auto-reconnect.
20 lines (19 loc) • 697 B
TypeScript
import { SerialProvider } from '../../types/index.js';
/**
* Creates a {@link SerialProvider} that uses the Web Bluetooth API
* to communicate with Nordic UART Service (NUS) devices.
*
* Pass the returned provider to `AbstractSerialDevice.setProvider()` before
* calling `connect()`.
*
* @returns A `SerialProvider` backed by the Web Bluetooth API.
* @throws {Error} If `navigator.bluetooth` is not available in the current environment.
*
* @example
* ```ts
* import { createBluetoothProvider, AbstractSerialDevice } from 'webserial-core';
*
* AbstractSerialDevice.setProvider(createBluetoothProvider());
* ```
*/
export declare function createBluetoothProvider(): SerialProvider;