-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/alternate plc4 x 108 #59
Conversation
- Renamed the PlcConnection "parse" method to "prepareField" - Added a "ping" method to the PlcConnection (which returns a CompletableFuture<Void>) - Removed the getInetSocketAddress method
- Fixed two broken driver implementations (Dummy and Mock Driver)
- Implemented the "ping" method for different base types.
@chrisdutz thank you for the PR! I will try to review it this week and start some tests with our S7 PLC here, to see if it works. |
@Override | ||
public CompletableFuture<Void> ping() { | ||
CompletableFuture<Void> future = new CompletableFuture<>(); | ||
future.completeExceptionally(new PlcUnsupportedOperationException("The connection does not support pinging")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to use https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/CompletableFuture.html#failedFuture(java.lang.Throwable) here if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh ... was looking for something like that ... strangely I must have missed it :-) ... of course ... will update that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! ... I knew there was something ... if I used the failedFuture method, we would have to bump up the Java level to 9 which I wasn't planning on doing just for this one convenience method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough. :)
Hi,
in this alternate implementation, I added a "ping" method to the default API and moved the code for the TCP ping into the classes actually involved in TCP (with options for other base types - serial, udp, raw-socket, test, ...).
Please review.