Re: Support for Serial Port Communication in Netty 4

2019-08-14 Thread julian . feinauer
Hi Norman,

thanks for your (fast) response.

I understand your concern (and we have the same one so I tried to drop our 
code in your Project... : >).
So I think we will place and maintain it in PLC4X for now.

And regarding your offer to review: I will very happily accept it.
But then, let me finish up and document things a bit before you spend your 
time on it and then I'll repsond back here on the List to inform you.

Julian

Am Mittwoch, 14. August 2019 10:40:51 UTC+2 schrieb Norman Maurer:
>
> Hi there,
>
> Comments inline...
>
> On 13. Aug 2019, at 09:48, Julian Feinauer  > wrote:
>
> 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).
>
>
> Just to be clear Oio classes will only be removed in Netty 5 and 4.x will 
> be supported for some more time :)
>
>
> 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.
>
>
> Cool :)
>
>
> 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.
>
>
> I will try to review the code once I have some cycles but this may take 
> some time. I am -1 to merge it into Netty itself as one of the things that 
> we struggled with in the past is to have too much code in the main project. 
> One of the plans for Netty 5 is to remove some stuff which is not widely 
> used and so does not get enough attention. Having the code outside of Netty 
> sounds like the right thing to do for me.
>
>
> 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.
>
>
> See above.
>
>
> 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 ne...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netty/f507b9d6-0dfa-4e33-92a8-cfac540b9244%40googlegroups.com
>  
> 
> .
>
>
>

-- 
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/883ed3f1-b081-4775-9bdd-94ecaa50f58d%40googlegroups.com.


Re: Support for Serial Port Communication in Netty 4

2019-08-14 Thread 'Norman Maurer' via Netty discussions
Hi there,

Comments inline...

> On 13. Aug 2019, at 09:48, Julian Feinauer  wrote:
> 
> 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).

Just to be clear Oio classes will only be removed in Netty 5 and 4.x will be 
supported for some more time :)

> 
> 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.

Cool :)

> 
> 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.

I will try to review the code once I have some cycles but this may take some 
time. I am -1 to merge it into Netty itself as one of the things that we 
struggled with in the past is to have too much code in the main project. One of 
the plans for Netty 5 is to remove some stuff which is not widely used and so 
does not get enough attention. Having the code outside of Netty sounds like the 
right thing to do for me.

> 
> 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.

See above.

> 
> 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
>  
> .

-- 
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/A69DA130-9117-4C8C-BDD9-8421A1AAD0A8%40googlemail.com.


Support for Serial Port Communication in Netty 4

2019-08-14 Thread Julian Feinauer
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.