web-serial-rxjs API Documentation
    Preparing search index...

    Interface SerialSessionOptions

    Options for creating a SerialSession via createSerialSession.

    Composes Partial<SerialConnectionOptions> (W3C connection parameters passed to port.open) with SerialSessionFeatureOptions (library-specific session features). All fields are optional; omitted values fall back to DEFAULT_SERIAL_SESSION_OPTIONS.

    Minimal usage typically only needs baudRate:

    const session = createSerialSession({ baudRate: 115200 });
    

    Full example:

    const session = createSerialSession({
    baudRate: 115200,
    dataBits: 8,
    stopBits: 1,
    parity: 'none',
    flowControl: 'none',
    filters: [{ usbVendorId: 0x1234, usbProductId: 0x5678 }],
    });

    Boundary semantics for numeric limits:

    • undefined — apply the default from DEFAULT_SERIAL_SESSION_OPTIONS
    • baudRate / bufferSize — must be safe integers > 0 (rejected otherwise)
    • terminalBuffer / lineBuffer limits — safe integers >= 0; 0 means unlimited
    interface SerialSessionOptions {
        baudRate?: number;
        bufferSize?: number;
        dataBits?: 8 | 7;
        filters?: SerialPortFilter[];
        flowControl?: FlowControlType;
        lineBuffer?: LineBufferOptions;
        parity?: ParityType;
        stopBits?: 1 | 2;
        terminalBuffer?: TerminalBufferOptions;
    }

    Hierarchy (View Summary)

    Index
    baudRate?: number
    bufferSize?: number
    dataBits?: 8 | 7
    filters?: SerialPortFilter[]

    Filters for port selection when requesting a port.

    When specified, the port selection dialog will only show devices matching these filters. Each filter can specify usbVendorId and/or usbProductId. Not passed to port.open.

    flowControl?: FlowControlType
    lineBuffer?: LineBufferOptions

    Limits for the incomplete line tail held by SerialSession.lines$ framing. When exceeded, leading characters are discarded and a non-fatal SerialErrorCode.LINE_BUFFER_OVERFLOW is emitted on SerialSession.errors$. Character counts use UTF-16 string length.

    Pass 0 for maxChars to disable the limit (unlimited). Negative values, non-integers, NaN, and Infinity are rejected at factory time.

    { maxChars: 1048576 } (see DEFAULT_SERIAL_SESSION_OPTIONS)

    parity?: ParityType
    stopBits?: 1 | 2
    terminalBuffer?: TerminalBufferOptions

    Limits for SerialSession.terminalText$ display memory. Oldest completed lines and leading characters are dropped when exceeded. Character counts use UTF-16 string length (JavaScript .length).

    Pass 0 for maxLines or maxChars to disable that limit (unlimited). Negative values, non-integers, NaN, and Infinity are rejected at factory time.

    { maxLines: 10000, maxChars: 1048576, stripAnsi: true } (see DEFAULT_SERIAL_SESSION_OPTIONS)