Skip to content
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

Added some javadoc to S7 communication path and several todos that ma… #9

Merged
merged 2 commits into from
Aug 2, 2018

Conversation

JulianFeinauer
Copy link
Contributor

Hey all,

i went through the S7 Communication path to understand it for myself and by doing that I tried adding useful javadoc at several classes.
Furthermore, I added several TODOs where I observed possible problems.

I am not sure if all of this javadoc is right so before merging this PR someone should go through it carefully and check if the things I state are right.

@@ -52,6 +64,8 @@ public boolean equals(Object o) {
return false;
}
ReadRequestItem<?> that = (ReadRequestItem<?>) o;
// TODO 01.18.18 jf: we should also call the comparison of super at least otherwise this can lead to unwanted behavior.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we doing exactly this super check 4 lines above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, i really completely missed that... you're right.

Copy link
Contributor

@chrisdutz chrisdutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial feedback ...

@@ -52,6 +64,8 @@ public boolean equals(Object o) {
return false;
}
ReadRequestItem<?> that = (ReadRequestItem<?>) o;
// TODO 01.18.18 jf: we should also call the comparison of super at least otherwise this can lead to unwanted behavior.
// Perhaps we should generate a UUID or something for each ReadRequest to have a good equality comparison
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generation of UUIDs takes a lot of CPU and consumes Memory

@@ -60,6 +66,7 @@ public boolean equals(Object o) {
return false;
}
ReadResponseItem<?> that = (ReadResponseItem<?>) o;
// TODO 01.08.18 jf: should we also use a UUID here or at least a check for equal request as this could lead to effects due to unwanted equality (same for hashCode).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generation of UUIDs takes a lot of CPU and consumes Memory

* This layer transforms between {@link PlcRequestContainer}s {@link S7Message}s.
* And stores all "in-flight" requests in an internal structure ({@link Plc4XS7Protocol#requests}).
*
* TODO 01.08.18, jf: is a Cleanup of the requests map necessary? Can it occur that for a request no response is generated that leads to success or failure?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should have some housekeeping mechanism in place that handles timeouts and connection problems. The driver implementation we are using in the Enthernet/IP driver (https://github.com/digitalpetri/ethernet-ip) has been a great inspiration on how to do this. We just haven't done it yet. Perhaps it would be a good idea to create a Jira for this?

* Also contains {@link VarParameter#items} that hold detailed information on the "Command", e.g.,
* addresses to read or to write to.
*
* TODO 01.08.18 jf: Could this be renamed to Something like Command as this seems to be the command message pattern?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These classes are driver-internal classes. No user should ever deal with them. The naming is correlated to names used in some of the documentation of the S7 protocol. So even if I agree that the correct name for this class from a pattern point of view might be different, I would suggest to keep it the way it is, because this way there is the correlation to the informal specs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the correlation makes sense.
But its good to know that my assumption was right.
It simply helped my understanding of the process to see them as that.

@asfgit asfgit merged commit a919e94 into apache:master Aug 2, 2018
@JulianFeinauer JulianFeinauer deleted the s7-communication-documentation branch August 2, 2018 09:22
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.

3 participants