Optionaloptions: SerialSessionOptionsSession options. Only filters is consulted by
connect$ today (forwarded to navigator.serial.requestPort); the
remaining fields are passed to port.open using defaults when omitted.
A SerialSession instance.
Create a v2 SerialSession.
This release wires the internal read pump (#202) and the internal send queue (#203) into the session so that
connect$,disconnect$,receive$, andsend$all operate end-to-end. Error handling is centralised through a singlereportErrorhelper (#204) so every failure path normalises through normalizeSerialError and emits on the oneerrors$channel.Key behaviors:
isBrowserSupported()returns whethernavigator.serialis available.state$replays the current lifecycle state driven by SessionStateMachine.connect$()opens a user-selected port, starts the internal read pump, and transitionsidle -> connecting -> connected.disconnect$()stops the read pump, closes the port, and transitionsconnected -> disconnecting -> idle.receive$emits UTF-8 decoded text chunks pushed by the pump. It is not subscription-lazy - the pump is started byconnect$and decoded text is multicast to all subscribers; late subscribers see only new data.lines$emits the same decoded stream split into line-terminated segments (\n,\r\n); a trailing line without a terminator is buffered. It is also not subscription-lazy relative to the pump.send$enqueues each payload on an internal FIFO queue so concurrent subscribers are written to the port in call order. String payloads are UTF-8 encoded through a sharedTextEncoder.errors$multiplexes every SerialError produced by the session. Connect / read / close failures are treated as fatal and also drivestate$to'error'; write failures are non-fatal and do not mutatestate$because a real connection loss will be observed by the read pump on the next tick anyway.