Hi devs,

I come from the PLC4X project (https://plc4x.apache.org) and we use netty 
as backbone for our drivers to communicate with PLCs.
But as some older PLCs are connected via Serial Ports we have the need to 
communicate with them as well.
There exist several java libraries out there, like jSerialComm 
(https://fazecast.github.io/jSerialComm/, 
https://github.com/Fazecast/jSerialComm).
In all our test it works quite nicely and can be used under Apache 2.0 
License so its a good fit.

There exist some projects which already introduced a bridge between netty 
and jSerialComm like https://github.com/Ziver/Netty-Transport-jSerialComm.
But it relies on the (now deprecated) Oio Classes (as this is the rather 
straightforward approach).

As solution I sat down and wrote a prototypic implementation of a Bridge 
between jSerialComm and Netty based on the Nio Classes.
The code can be found at [1].
JSerialComm provides an event based approach (I have no idea how it works 
internally) so it is really non blocking and does not need any polling or 
so.
But, of course quite some hacking is involved and currently i'm usure 
whether it compiles on newer JDKs as I do a bit of reflection to access 
(package) private fields from netty.
But today I hat the time to make a first round trip test with a real COM 
Port and to my astonishment it really worked.

I have two questions now.
First, I would of course like any comments on my work and if its done 
"okay" or if things could be improved.
Second, and most important, I'm unsure where to put that code. We can 
include it in the PLC4X project as we need it there.
But over time it will be hard to maintain it there as we have not that much 
people that know netty internals.

So one consideration was if the netty project would accept such a code 
donation and take it into the netty codebase and maintain it there.

What are your ideas or comments, I woudl really appreciate any feedback!

Julian

[1] 
https://github.com/JulianFeinauer/incubator-plc4x/tree/netty-serial-nio/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection

PS.: Before starting this I asked on SO (but was closed) so here are my 
initial thoughts 
https://stackoverflow.com/questions/57441261/is-there-a-better-way-to-implement-serialport-communication-over-netty-than-usin

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netty+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/f507b9d6-0dfa-4e33-92a8-cfac540b9244%40googlegroups.com.

Reply via email to