You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently rewriting Apache PLC4X from scratch. Part of that work is also rewriting the transports. The Serial transport is one of them. While it's easy to write tests for TCP and UDP transports for serial it's problematic. I stumbled over "socat" (Mac & Linux).
In my test-cases I am using that to sort of generate virtual serial ports and do IO via these ... possibly this could help with your work on Modbus RTU/ASCII (Again ... in PLC4X we also have support for those ... also doing Modbus RTU via TCP and stuff like that)
@BeforeEach
void setUp() throws Exception {
if (!System.getProperty("os.name").toLowerCase().contains("win")) {
process = new ProcessBuilder("socat","-d","-d",
"pty,raw,echo=0,link=/tmp/ttyV0",
"pty,raw,echo=0,link=/tmp/ttyV1").start();
// Give socat a moment to create links; optionally read its stderr for "N PTY is ..."
Thread.sleep(500);
}
}
....
@AfterEach
void tearDown() throws Exception {
if (process != null) {
process.destroy();
}
}
Just thought I'd leave this here as you mentioned wanting to work on Modbus RTU.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently rewriting Apache PLC4X from scratch. Part of that work is also rewriting the transports. The Serial transport is one of them. While it's easy to write tests for TCP and UDP transports for serial it's problematic. I stumbled over "socat" (Mac & Linux).
In my test-cases I am using that to sort of generate virtual serial ports and do IO via these ... possibly this could help with your work on Modbus RTU/ASCII (Again ... in PLC4X we also have support for those ... also doing Modbus RTU via TCP and stuff like that)
Just thought I'd leave this here as you mentioned wanting to work on Modbus RTU.
Beta Was this translation helpful? Give feedback.
All reactions