Skip to content

Serial transport - #54

Merged
jadamcrain merged 1 commit into
mainfrom
serial-transport
Oct 14, 2026
Merged

jadamcrain merged 1 commit into
mainfrom
serial-transport

Conversation

@jadamcrain

Copy link
Copy Markdown
Member

dnp3c can now connect to the device over a serial port instead of TCP, for every procedure of every revision. Set serial.enabled and serial.port; the character format is set by serial.baudRate, serial.dataBits, serial.parity and serial.stopBits. It uses jSerialComm 2.11.4, which is licensed Apache-2.0 or LGPL-3.0. Its native libraries are kept in the CLI jar.

  • SerialChannel reads against a deadline, in slices of 0.1 to 1 s, because jSerialComm rounds timeouts to tenths of a second and wraps those above 25.5 s on Linux. A write that makes no progress for 5 s fails.
  • It can assert RTS, and SerialSettings computes a character's bits on the line. The timed serial tests (8.12) will use both.
  • A port the bench can't open, a port that isn't set, or a read, write or RTS that fails is a BenchException. That aborts the run as a harness failure instead of failing the device. LocalBindException is now a BenchException too.
  • There's no packet capture over serial.
  • 3.1r1's 6.6.2-4 (No Inter-frame Gap) is for serial, so it now runs over serial too, with the confirm sent to another device's address.
  • New option type, choice, for serial.parity.

The tests run the channel over two pseudo-terminals that a Python script joins. They're skipped on hosts without Python 3 or ptys.

The 2.7 -describe output is unchanged.

dnp3c can connect to the DUT over a serial port instead of TCP, for every
procedure of every revision: serial.enabled, with serial.port and the
character format (serial.baudRate, serial.dataBits, serial.parity,
serial.stopBits). It uses jSerialComm (Apache-2.0 or LGPL-3.0).

- SerialChannel reads with a timeout and writes everything it's given; it
  can assert RTS, and SerialSettings gives a character's bits on the line,
  for the timed tests to come.
- A port the bench can't open, or one that isn't set, is a BenchException,
  which aborts the run as a harness failure; LocalBindException is one
  too.
- There's no packet capture over serial.
- 3.1r1's 6.6.2-4 (No Inter-frame Gap), which is for serial, runs over
  serial too, sending the confirm to another device's address.
- A choice option type, for serial.parity.

The tests run the channel over a pair of pseudo-terminals that a Python
script joins, where the host has them.
@jadamcrain
jadamcrain merged commit cfa3c42 into main Oct 14, 2026
5 checks passed
@jadamcrain
jadamcrain deleted the serial-transport branch October 14, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant