-
Notifications
You must be signed in to change notification settings - Fork 224
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
Ensure that AIS fixed strings are ITU-R M.1371-1 compliant #390
Conversation
Hi Temo, Is there an action item for me here? It looks like the build is failing but as far as I can tell this has to do with a git permission error. /usr/bin/git push origin gh-pages |
It is Timo! Remember also change version in library.properties! Setter AIS string comments like on line 4290 should be "Call Sign - Max. 7 chars will be used. Input string will be converted to contain only SixBit ASCII character set (see. ITU-R M.1371-1)" I succested to create function for conversion under N2kMessages module not to tN2kMsg class. tN2kMsg contain mainly functions for N2k data formats and AIS message is not specific DF in N2k. On the other hand naturally it would be more efficient to do conversion on tN2kMsg, but on the other hand it increases size of class for users who does not need AIS. Linker unfortunately does not leave away unused class functions. Current solution increases the size and also makes double copy by using temporary buffer for conversion. Hopefully few bytes more does not matter, so AddAISStr could be. void tN2kMsg::AddAISStr(const char *str, int len) { len=min(len,MaxDataLen-DataLen); |
I like the idea of having AddAISStr in the tN2kMsg class since it makes the code in N2kMessages cleaner. I will make the requested changes and resubmit the PR. |
hello timo, updated PR with the requested changes. Updated library.properties and library.json. still not understanding why getting build errors in pull request... Push the commit or tag |
Better to remove #include and just use simple Did you test changed code? |
Hi Timo, the version that has been tested and is now in production is the previous pull where //***************************************************************************** This has been tested for fill and illegal characters and it works. What has not been tested are your suggested changes that address concerns for code space in small embedded systems. Personally I like my implementation of AddAISStr where a separate buffer is used to build the filtered string before passing it to AddStr(). I like it because
On the surface your suggested changes look good and have low risk of breaking anything... But... we are not inclined to test it since it's not our intention to use it. so my suggestion is to revert back to the double buffering version or write code to spot check your version or maybe get someone with an Arduino to test it. Let me know what you would like me to do on my end. --Luis |
What do you mean with "we are not inclined to test it since it's not our intention to use it." |
Hi Timo, we keep our own fork of the project with many modifications. So we have not incorporated these changes void tN2kMsg::AddAISStr(const char *str, int len) { len=min(len,MaxDataLen-DataLen); and don't plan to given that we like the alternate implementation better. And we have it in production and it's a big deal and inconvenience to get new code to our testers in the field and receive feedback. so this small change is not worth pursuing for us. summing up... this has been tested... //***************************************************************************** but this void tN2kMsg::AddAISStr(const char *str, int len) { len=min(len,MaxDataLen-DataLen); has not and we don't intend to test. Let me know if I can be of further assistance. --Luis --luis |
In your tested code:
Have to confess that I noticed some time ago that either AddStr has not been tested completely and it may write over Data array. That was one reason for rewriting AddAISStr. |
Hi Timo, well this is where len comes in.. in my code I make sure that Len is set correctly for 794,809, and 810 void SetN2kPGN129794(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, uint32_t UserID, so the above works... as long as the User passes in strings that are not longer than 21 characters... as we do in our code. But yes.. you are correct the loop terminator should be i < sizeof(AISStr) -1; to be safe... thanks for pointing that out. now if you don't trust AddStr() well then that is a different story! I will go look at that. here is the pertinent code... so as long as len is correct and DataLen is not exceeded then all is fine.. So..this should really be fixed. } else { so... I think it would be better to fix AddStr() (should be fixed anyway) than have code repetition in both AddStr and AddAISStr()... |
I'll fix AddStr(). It is currently only problematic with some PGNs, if one adds repeating fields too many times.
|
Hi Timo, Not sure what this means. Can you reset PR request, so that there will be only last change. Otherwise all changes will be seen as changes. I made the change and resubmitted the pull request. |
If I merge PR now, then all changes will be pulled to main library. This means that version 4.21.1 is not previous. Instead one has to go down several pulls. Somewhere was way to reset that to last one so that on library one sees only one pull between 4.21.2 and 4.21.1.
|
since it is 6 commit ahead, the command should be |
thanks for the pointer.. I will do the rebase now... Do I need to cancel the pull request and submit again? I will push some buttons here to see what happens... |
(char *)->(const char *) for AIS set functions) Ensure that AIS strings are ITU-R M.1371-1 compliant streamline N2kMsg::AddAISStr to reduce memory footprint. update comments for PGN129794/809/810 remote dependency on std::min updated comment bump library version
so I have rebased everything into a single commit and the commit looks good. There is another commit that somehow got in there authored by timo that creates a conflict on the library version number... not sure how that got in there. and not sure how to fix that. |
Check and modify content of fixed strings passed to AIS library to ensure the are ITU-R M.1371-1.