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

Error while parsing PHGR #83

Open
mprilepok opened this issue Jul 31, 2023 · 1 comment
Open

Error while parsing PHGR #83

mprilepok opened this issue Jul 31, 2023 · 1 comment

Comments

@mprilepok
Copy link

I got error during parsing PHG parameter with letter on the end of the value

APRS Packet: b'PA0AGO-11>APRS,TCPIP*,qAC,FOURTH:@072239z5150.54N/00441.71E#PHG1230I/A=000012 RX ONLY! RAZ IGATE'
Traceback (most recent call last):
File "/home/pi/test.py", line 61, in
AIS.consumer(on_message)
File "/home/pi/.local/lib/python3.9/site-packages/aprslib/inet.py", line 185, in consumer
callback(self._parse(line))
File "/home/pi/.local/lib/python3.9/site-packages/aprslib/parsing/init.py", line 134, in parse
_try_toparse_body(packet_type, body, parsed)
File "/home/pi/.local/lib/python3.9/site-packages/aprslib/parsing/init.py", line 209, in _try_toparse_body
body, result = parse_position(packet_type, body)
File "/home/pi/.local/lib/python3.9/site-packages/aprslib/parsing/position.py", line 76, in parse_position
parse_comment(body, parsed)
File "/home/pi/.local/lib/python3.9/site-packages/aprslib/parsing/common.py", line 118, in parse_comment
body, result = parse_data_extentions(body)
File "/home/pi/.local/lib/python3.9/site-packages/aprslib/parsing/common.py", line 196, in parse_data_extentions
parsed.update({'phg_rate': int(phgr[0], 16)}) # as decimal
ValueError: invalid literal for int() with base 16: 'I'

@wb2osz
Copy link

wb2osz commented Feb 16, 2024

This is rather obscure, but it is valid.
Usually PHG is followed by exactly 4 digits.
There is a new form ( http://www.aprs.org/aprs12/probes.txt ) , that I don't think I ever observed before, where and an additional digit or upper case letter AND a slash can be added.
This specific example raises an interesting question. Would the following altitude be recognized?
PHG9999X/ would require the / to know that another character should be processed after the usual 4 digits.
We would not want the / to appear in the comment presented to the application user.
it seems to me that the following A=999999 would not be recognized as an altitude and would be considered part of the comment text.

Unfortunately the tocall field is "APRS" so we have no clue what generated this packet.

73,
John WB2OSZ

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