Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Add more parsing clauses and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jj1bdx committed May 22, 2018
1 parent 6adc54a commit 74fa05b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/aprs_is_decode.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,25 @@ decode_header(D, {CPS, CPI, CPR}) ->

info_dispatch(Info) ->
<<Type:8, Rest/binary>> = Info,
info_dispatch_type({Type, Rest}).
info_dispatch_type(Type, Rest).

info_dispatch_type({$!, Field}) -> Field;
info_dispatch_type({_, Field}) -> Field, undefined.
info_dispatch_type($!, Field) ->
position_nomsg(binary:first(Field), Field);
info_dispatch_type($T, Field) -> {telemetry, Field};
info_dispatch_type($:, Field) -> {message, Field};
info_dispatch_type($?, Field) -> {query, Field};
info_dispatch_type($>, Field) -> {status, Field};
info_dispatch_type($;, Field) -> {object, Field};
info_dispatch_type($), Field) -> {item, Field};
info_dispatch_type($$, Field) -> {nmea, Field};
info_dispatch_type($,, Field) -> {test_data, Field};
info_dispatch_type($}, Field) -> {third_party, Field};
info_dispatch_type(_, Field) -> Field, undefined.

position_nomsg(T, Field) when $0 =< T, T =< $9 ->
% uncompressed position format
{position_uncompressed, Field};
position_nomsg($/, Field) ->
% compressed position format;
{position_compressed, Field};
position_nomsg(_, Field) -> {undefined, Field}.

0 comments on commit 74fa05b

Please sign in to comment.