probe-web / @probe-web/ui / ProbeSerialMonitor
Class: ProbeSerialMonitor
Defined in: packages/ui/src/serial-monitor.ts:23
<probe-serial-monitor>: a WebSerial console (baud picker, send line with a chosen line ending, RTS reset pulse, clear) in an xterm.js terminal. For boards whose console is a UART bridge rather than RTT. The first previously granted port is preselected.
Fires
serial-line: One per complete line received.detailis the line (a string, without its line ending).serial-state: The port was opened or closed.detailis{ connected: boolean, reason?: string };reasonsays why it closed.
Extends
LitElement
Constructors
Constructor
new ProbeSerialMonitor(): ProbeSerialMonitor;Defined in: node_modules/@lit/reactive-element/development/reactive-element.d.ts:527
Returns
ProbeSerialMonitor
Inherited from
LitElement.constructorProperties
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
port | SerialPortLike | null | null | The port to use; set it, or let the user pick one with Choose port…. | packages/ui/src/serial-monitor.ts:40 |
baudRate | number | 115200 | Baud rate used by ProbeSerialMonitor.connect. | packages/ui/src/serial-monitor.ts:42 |
lineEnding | LineEnding | 'crlf' | Line ending appended by ProbeSerialMonitor.send: 'none', 'lf', 'cr' or 'crlf'. | packages/ui/src/serial-monitor.ts:44 |
Methods
choosePort()
choosePort(): Promise<void>;Defined in: packages/ui/src/serial-monitor.ts:85
Open the browser's port chooser (needs a user gesture) and select the chosen port.
Returns
Promise<void>
connect()
connect(): Promise<void>;Defined in: packages/ui/src/serial-monitor.ts:95
Open ProbeSerialMonitor.port at ProbeSerialMonitor.baudRate and start showing its output; fires serial-state.
Returns
Promise<void>
disconnect()
disconnect(): Promise<void>;Defined in: packages/ui/src/serial-monitor.ts:117
Close the port; serial-state fires once it has closed.
Returns
Promise<void>
send()
send(text): Promise<void>;Defined in: packages/ui/src/serial-monitor.ts:129
Send a line with the selected line ending.
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
Promise<void>