Skip to content

Protocol architecture ​

Application → JSD application API → frame + CRC → JSD queue → serial-core session → serialport → hardware Hardware → delimiter parser → frame validation → application routing → typed event

Layer responsibilities ​

JSD implements framing, protocol acknowledgements, response routing, and domain operations. serial-core implements port discovery, connection, handshake, reconnection, and its write queue. serialport provides native serial access.

RS232 framing ​

Frames use 0xC0 delimiters, a transport code, packet ID, application payload, and CRC16. Escaping maps 0xC0 → 0xDB 0xDC and 0xDB → 0xDB 0xDD. DATA includes little-endian length, application ID, and opcode headers followed by comma-delimited ASCII arguments.

A matching ACK removes the command from JSD's queue. DATA is acknowledged and routed to Vision, licensing, manifest, or MDB. NACK is emitted without immediately dequeueing the command. Invalid frames produce serial:jsd-error.

TCP/IP framing option: current scope ​

{ transport: 'tcpip' } changes outgoing packet construction to a little-endian length/application/opcode header without the RS232 wrapper. The current client still uses SerialService, a default serial delimiter parser, and the RS232-style response validator; it does not open a network socket or implement a complete TCP receive pipeline. Do not treat this option as ready-made TCP connectivity.

Ordering and correlation ​

Commands are serialized in the JSD queue and identified by packet ID. Default ACK timeout is 500 ms after successful write/drain, with up to three resends in the same session. Write failure, disconnect, or stop clears the JSD queue; unfinished operations are not replayed in a new session. Application data normally carries its application ID; missing IDs fall back to the last submitted application code. The framing strategy's IDs wrap, so avoid bypassing the queue.

Application promises do not universally represent device completion. Follow the events guide when connecting a workflow to real hardware.

Explicit protocol, typed events, isolated transport.