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

Support for canboat's '-nv' option #79

Open
chacal opened this issue Jul 21, 2017 · 3 comments
Open

Support for canboat's '-nv' option #79

chacal opened this issue Jul 21, 2017 · 3 comments

Comments

@chacal
Copy link

chacal commented Jul 21, 2017

For some use cases (e.g. signalk-socketcan-device) it is useful to run canboat's analyzer with its -nv option that adds 'raw' values for various look-up style fields in PGNs in addition to normal human readable ones. Eg. field "COG Reference":"True" becomes "COG Reference":{"value":0,"name":"True"}.

This change in input naturally breaks n2k-signalk as it expects its input in the former form.

I'm planning on adding transparent support for the latter input format for n2k-signalk, but wanted to create this issue first to discuss the matter and gather ideas on implementation. The idea at the moment is to change the implementation for all PGNs that use these 'lookup' style fields in a way that the input format is detected automatically by first checking if the value is Object and if it is, using .name instead of the field itself.

The following PGNs use 'lookup' style fields and would thus need to be changed:

127488
127489
127505
129026
129029
129038
129040
129041
129283
129284
129291
129794
129810
130306
130311
130312
130577
130842
@keesverruijt
Copy link
Member

keesverruijt commented Jul 22, 2017 via email

@chacal
Copy link
Author

chacal commented Jul 23, 2017

I poked around with the code and came up with a solution that - albeit a bit hackily - adds support for the -nv style input transparently to all PGNs.

Commit is here: chacal@623cf6a

I also thought about how to add test cases for -nv style input and came up with something like this: chacal@6954076

What do you think? If this looks good, I can add tests for the other affected PGNs as well.

@chacal
Copy link
Author

chacal commented Jul 23, 2017

Added a small helper for constructing -nv style input fields for test JSON as I noticed that its quite error prone to write JSON strings by hand: chacal@00b6f05

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

No branches or pull requests

2 participants