I have added JSON output to libacars. All decoded fields are now available as JSON keys.This patch extends acarsdec JSON output with this data. Whenever libacars has decoded a message, a new "libacars" key is added to the JSON message produced by acarsdec and everything is stored there.
For example, the following media advisory message:
[#1 (F:131.725 L:-27 E:0) 25/01/2020 17:47:23.936 --------------------------------
Mode : G Label : SA Id : 9 Nak
Aircraft reg: A7-BAI Flight id: QR0001
No: S26A
0LS174722V
Media Advisory, version 0:
Link Default SATCOM lost at 17:47:22 UTC
Available links: VHF ACARS
I had to enlarge the JSON buffer from 500 to 1400 bytes, because many messages simply didn't fit and the resulting JSON string got truncated. But it's still not 100% bulletproof solution - for example this beast encoded as JSON won't fit in 1400 bytes:
A better option would be to drop the pkt buffer altogether and write the contents of jsonbuf to the socket directly. jsonbuf is 30000 bytes long, so this should be more than enough. What do you think?
Hi Thierry,
I have added JSON output to libacars. All decoded fields are now available as JSON keys.This patch extends acarsdec JSON output with this data. Whenever libacars has decoded a message, a new "libacars" key is added to the JSON message produced by acarsdec and everything is stored there.
For example, the following media advisory message:
produces the following JSON output:
Example ADS-C message:
gives this:
I had to enlarge the JSON buffer from 500 to 1400 bytes, because many messages simply didn't fit and the resulting JSON string got truncated. But it's still not 100% bulletproof solution - for example this beast encoded as JSON won't fit in 1400 bytes:
A better option would be to drop the
pkt
buffer altogether and write the contents ofjsonbuf
to the socket directly.jsonbuf
is 30000 bytes long, so this should be more than enough. What do you think?