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

Commit

Permalink
Add more types
Browse files Browse the repository at this point in the history
  • Loading branch information
jj1bdx committed May 22, 2018
1 parent 74fa05b commit aed8153
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/aprs_is_decode.erl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ info_dispatch(Info) ->

info_dispatch_type($!, Field) ->
position_nomsg(binary:first(Field), Field);
info_dispatch_type($=, Field) ->
position_msg(binary:first(Field), Field);
info_dispatch_type($/, Field) ->
position_time_nomsg(binary:first(Field), Field);
info_dispatch_type($@, Field) ->
position_time_msg(binary:first(Field), Field);
info_dispatch_type($T, Field) -> {telemetry, Field};
info_dispatch_type($:, Field) -> {message, Field};
info_dispatch_type($?, Field) -> {query, Field};
Expand All @@ -33,12 +39,36 @@ 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.
info_dispatch_type(_, Field) -> {undefined, Field}.

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

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

position_time_nomsg(T, Field) when $0 =< T, T =< $9 ->
% uncompressed position_time format
{position_time, no_message, {uncompressed, Field}};
position_time_nomsg($/, Field) ->
% compressed position_time format;
{position_time, no_message, {compressed, Field}};
position_time_nomsg(_, Field) -> {undefined, Field}.

position_time_msg(T, Field) when $0 =< T, T =< $9 ->
% uncompressed position_time format
{position_time, message, {uncompressed, Field}};
position_time_msg($/, Field) ->
% compressed position_time format;
{position_time, message, {compressed, Field}};
position_time_msg(_, Field) -> {undefined, Field}.

0 comments on commit aed8153

Please sign in to comment.