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

[RP]: Remove internal static pgn request protocol list #285

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

GwnDaan
Copy link
Member

@GwnDaan GwnDaan commented Jul 4, 2023

Like with the DiagnosticProtocol's static list removal in #281, this PR removes the static list in the ParameterGroupNumberRequestProtocol and instead let the application handle the objects themselves.

Though a drawback of this approach I found, is that every other interface that requires "pgn requests" support (e.g. the LanguageInterface/DiagnosticProtocol) need to be fed with a shared_ptr to a ParameterGroupNumberRequestProtocol object. We could instead house the list of ParameterGroupNumberRequestProtocol inside the CANNetworkManager or assign to each InternalControlFunction an optionally dedicated ParameterGroupNumberRequestProtocol object (that get's automatically constructed/deconstructed when needed)?

On the other hand, we can also just leave it as is, but then we keep a difference between the interfaces/protocols. Any thoughts on all this are more than welcome

@GwnDaan GwnDaan added the enhancement New feature or request label Jul 4, 2023
@GwnDaan GwnDaan requested a review from ad3154 July 4, 2023 14:27
@GwnDaan GwnDaan self-assigned this Jul 4, 2023
@GwnDaan GwnDaan temporarily deployed to Integrate Pull Request July 4, 2023 14:27 — with GitHub Actions Inactive
@GwnDaan GwnDaan temporarily deployed to Integrate Pull Request July 28, 2023 08:17 — with GitHub Actions Inactive
@GwnDaan GwnDaan force-pushed the remove-pgn-request-protocol-list branch from 457bcf4 to 39c90ee Compare July 28, 2023 08:18
@GwnDaan GwnDaan temporarily deployed to Integrate Pull Request July 28, 2023 08:19 — with GitHub Actions Inactive
@ad3154
Copy link
Member

ad3154 commented Jul 28, 2023

Apologies for my lateness on reviewing this - I will try to review this weekend!

@ad3154
Copy link
Member

ad3154 commented Jul 30, 2023

I have a few thoughts after reading this, let me know what you think.

PGN requests are a very important part of participating on both an ISO11783 and J1939 bus, and the standards are very strongly worded with such things like:

  • A NACK is required if the PGN is not supported.
  • A response is always required from a specified destination

And since we have to send messages as responses, even if the user of the stack doesn't do any PGN requests themselves, I think we have some opportunities here to make this whole thing less weird and more automatic.

My initial thinking is that maybe each Internal Control function should create a dedicated PGN request object, and we could just have a getter on the ICF to retrieve it (maybe a weak ptr makes the most sense here? It will only rarely be accessed by those other objects like Diagnostic Protocol...)

I think this might make the most sense, as then all those other objects that need it can simply get it from the ICF that is passed into them at construction time, and it ensures all ICFs will respond properly without the user configuring it. It also continues to allow the network manager access to them to call update via the internalControlFunctions list.

Does that make sense? Looking forward to your/anyone's opinion.

@GwnDaan
Copy link
Member Author

GwnDaan commented Jul 30, 2023

I agree I think housing it inside the internal control function makes the most sense as well, I'll go ahead and make that change

@GwnDaan GwnDaan temporarily deployed to Integrate Pull Request July 30, 2023 21:31 — with GitHub Actions Inactive
@GwnDaan
Copy link
Member Author

GwnDaan commented Jul 30, 2023

What do you think about this f705d28 @ad3154?

@GwnDaan GwnDaan force-pushed the remove-pgn-request-protocol-list branch from f705d28 to d2bfc47 Compare July 31, 2023 09:37
@GwnDaan GwnDaan temporarily deployed to Integrate Pull Request July 31, 2023 09:37 — with GitHub Actions Inactive
@sonarcloud
Copy link

sonarcloud bot commented Aug 1, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

68.2% 68.2% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Member

@ad3154 ad3154 left a comment

Choose a reason for hiding this comment

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

Yeah, looking good I think. I'd like to test a on a real bus but it looks like it'll work.

I'll try an run a couple manual tests and as long as they work I'll merge!

@ad3154 ad3154 merged commit 91fd491 into main Aug 2, 2023
5 of 6 checks passed
@ad3154 ad3154 deleted the remove-pgn-request-protocol-list branch August 2, 2023 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants