Optionaloptions: SerialClientOptionsOptional configuration options for the serial port connection. If not provided, default values will be used (9600 baud, 8 data bits, etc.)
A new SerialClient instance
SerialError with code SerialErrorCode.BROWSER_NOT_SUPPORTED if the browser doesn't support Web Serial API
// Create a client with default settings (9600 baud)
const client = createSerialClient();
// Create a client with custom settings
const client = createSerialClient({
baudRate: 115200,
dataBits: 8,
stopBits: 1,
parity: 'none',
filters: [{ usbVendorId: 0x1234 }],
});
// Check browser support before creating a client
import { isBrowserSupported } from '@gurezo/web-serial-rxjs';
if (!isBrowserSupported()) {
console.error('Web Serial API is not supported');
} else {
const client = createSerialClient();
}
Create a new SerialClient instance for interacting with serial ports.
This is the main entry point for creating a serial client. The client provides a reactive RxJS-based API for connecting to serial ports and reading/writing data.