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

Message 21 name + name_ext concatenation #161

Closed
jwheare opened this issue Jan 20, 2025 · 2 comments
Closed

Message 21 name + name_ext concatenation #161

jwheare opened this issue Jan 20, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jwheare
Copy link

jwheare commented Jan 20, 2025

It would be nice to pre-concatenate name_ext onto name when decoding message type 21, perhaps on an attribute full_name: https://github.com/biiont/gpsd/blob/master/www/AIVDM.txt#L3690-L3693

The name field is up to 20 characters of 6-bit ASCII. If this field
is full (has no trailing @ characters) the decoder should interpret
the Name Extension field later in the message (no more than 14 6-bit
characters) and concatenate it to this one to obtain the full name.

Or at least provide a method that returns the full name.

e.g. in this example full_name would be NNG-OSS-S OFFSHORE WINDFARM

!AIVDM,1,1,,B,E>jHDL1W73nWaanah7S39T7a2h;wror=@5nL`A2AISd002CQ1PDS@0,4*39

print(pyais.decode('!AIVDM,1,1,,B,E>jHDL1W73nWaanah7S39T7a2h;wror=@5nL`A2AISd002CQ1PDS@0,4*39').to_json())

{
    "msg_type": 21,
    "repeat": 0,
    "mmsi": 992351344,
    "aid_type": 3,
    "name": "NNG-OSS-S OFFSHORE W",
    "accuracy": true,
    "lon": -2.239765,
    "lat": 56.243582,
    "to_bow": 17,
    "to_stern": 18,
    "to_port": 11,
    "to_starboard": 12,
    "epfd": 7,
    "second": 24,
    "off_position": false,
    "reserved_1": 0,
    "raim": false,
    "virtual_aid": false,
    "assigned": false,
    "spare_1": "AA==",
    "name_ext": "INDFARM"
}
@M0r13n
Copy link
Owner

M0r13n commented Jan 26, 2025

Hey @jwheare,

that is a neat idea. Thank you for bringing this up. I have added a (cached) property, full_name, to message type 21 in v2.8.4 which should now be available on PyPi.

All the best,
Leon

@M0r13n M0r13n closed this as completed Jan 26, 2025
@M0r13n M0r13n added the enhancement New feature or request label Jan 26, 2025
@M0r13n M0r13n self-assigned this Jan 26, 2025
@jwheare
Copy link
Author

jwheare commented Jan 26, 2025

Brilliant, thank you!

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

No branches or pull requests

2 participants