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

ASTERIX #34

Open
wants to merge 40 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
db8fd37
first attempt at asterix output
k2fc Mar 29, 2023
e8500ad
add send asterix output
k2fc Mar 29, 2023
23c37ad
fix squawk, add MOPS
k2fc Apr 4, 2023
26d7173
Merge branch 'dev' into asterix
k2fc Apr 4, 2023
35a854d
WIP redoing how the bytes are written
k2fc Apr 4, 2023
bfc3ad8
Asterix CAT021 mostly working
k2fc Apr 5, 2023
ebface6
Add met status, add asterix_reduce_out, prepare options for asterix_in
k2fc Apr 6, 2023
c996e05
change asterix_reduce_out to be more like --net-sbs-reduce option
k2fc Apr 6, 2023
eb75da0
Decode BDS4,4 Meteorological routine air report
k2fc Apr 8, 2023
4851017
Merge branch 'dev' into asterix
k2fc Apr 8, 2023
2830073
Beginnings of working ASTERIX in. Stuff is still broken, but it does…
k2fc Apr 22, 2023
541ecdc
Check for valid baro alt
k2fc Apr 22, 2023
b4b067a
try to send geom data using offset
k2fc Apr 22, 2023
0204c7b
fix error in decoding groundspeed
k2fc Apr 22, 2023
66ddf30
merge dev into asterix
k2fc Apr 22, 2023
ddbd6aa
fix indenting
k2fc Apr 22, 2023
1d8ea75
possibly properly interperet quality indicators
k2fc Apr 22, 2023
840ca97
assign values
k2fc Apr 23, 2023
bd7b82a
Add receiver ID
k2fc Apr 23, 2023
7460ae4
switch to using 24-bit position
k2fc Apr 23, 2023
bb12646
fix indenting
k2fc Apr 23, 2023
92c145b
send time when using 24-bit position also
k2fc Apr 23, 2023
05296e9
Fix indenting
k2fc Apr 23, 2023
8826143
Merge branch 'asterix' of github.com:k2fc/readsb into asterix
k2fc Apr 23, 2023
f9c01bd
send ASTERIX position from SBS data, too
k2fc Apr 23, 2023
02bd08a
add asterix_in to net_connectors
k2fc Apr 23, 2023
a50a1e4
add asterix_in and asterix_out to net_connector args
k2fc Apr 23, 2023
b2b4aa9
add asterix options to README.md
k2fc Apr 23, 2023
df9a948
correct item numbers
k2fc Apr 23, 2023
1e2cfaf
Merge branch 'asterix' of github.com:k2fc/readsb into asterix
k2fc Apr 23, 2023
fcf9e72
accidentally deleted json_out, and misspelled asterix
k2fc Apr 23, 2023
2440482
Correctly input/output Emitter Category
k2fc Apr 25, 2023
534c302
input address type
k2fc Apr 26, 2023
0c01620
don't try to use invalid asterix message
k2fc Apr 26, 2023
4aa7790
input/output I021/146, Selected Altitude
k2fc Apr 26, 2023
6cfeeec
undo free mm if invalid. seems to be incorrect
k2fc Apr 28, 2023
01d2f33
try to get address types working right
k2fc Apr 30, 2023
2fc71d0
Merge branch 'dev' into asterix
k2fc Apr 30, 2023
222c13f
Merge branch 'dev' into asterix
k2fc Jul 26, 2023
8bcbdac
Merge branch 'dev' into asterix
k2fc Aug 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ Don't write recent(1), full(2), either(3) traces
Establish connection, can be specified multiple
times (e.g. 127.0.0.1,23004,beast_out) Protocols:
beast_out, beast_in, raw_out, raw_in, sbs_in,
sbs_in_jaero, sbs_out, sbs_out_jaero, vrs_out,
json_out, gpsd_in (one failover ip/address,port
can be specified:
sbs_in_jaero, sbs_out, sbs_out_jaero, sbs_out_prio
vrs_out, json_out, asterix_out, asterix_in,
gpsd_in (one failover ip/address,port can be specified:
primary-address,primary-port,protocol,failover-address,failover-port)
--net-connector-delay=<seconds>
Outbound re-connection delay (default: 30)
Expand Down Expand Up @@ -319,6 +319,10 @@ TCP json position output: include aircraft without
--net-sbs-port=<ports> TCP BaseStation output listen ports (default: 0)
--net-sbs-reduce Apply beast reduce logic and interval to SBS
outputs
--net-ao-port=<ports> TCP ASTERIX output listen ports (default: 0)
--net-ai-port=<ports> TCP ASTERIX input listen ports (default: 0)
--net-asterix-reduce Apply beast reduce logic and interval to ASTERIX
outputs
--net-verbatim Forward messages unchanged
--net-vrs-interval=<seconds>
TCP VRS json output interval (default: 5.0)
Expand Down
141 changes: 140 additions & 1 deletion comm_b.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static int decodeBDS30(struct modesMessage *mm, bool store);
static int decodeBDS40(struct modesMessage *mm, bool store);
static int decodeBDS50(struct modesMessage *mm, bool store);
static int decodeBDS60(struct modesMessage *mm, bool store);
static int decodeBDS44(struct modesMessage *mm, bool store);

static CommBDecoderFn comm_b_decoders[] = {
&decodeEmptyResponse,
Expand All @@ -44,7 +45,8 @@ static CommBDecoderFn comm_b_decoders[] = {
&decodeBDS17,
&decodeBDS40,
&decodeBDS50,
&decodeBDS60
&decodeBDS60,
&decodeBDS44
};

void decodeCommB(struct modesMessage *mm) {
Expand Down Expand Up @@ -820,3 +822,140 @@ static int decodeBDS60(struct modesMessage *mm, bool store) {

return score;
}

// BDS 4,4 Meteorological routine air report

static int decodeBDS44(struct modesMessage *mm, bool store) {
unsigned char *msg = mm->MB;

unsigned source = getbits(msg, 1, 4);

unsigned wind_valid = getbit(msg, 5);
unsigned wind_speed_raw = getbits(msg, 6, 14);
unsigned wind_direction_raw = getbits(msg, 15, 23);

unsigned temperature_sign = getbit(msg, 24);
unsigned static_air_temperature_raw = getbits(msg, 25, 34);

unsigned pressure_valid = getbit(msg, 35);
unsigned static_pressure_raw = getbits(msg, 36, 46);

unsigned turbulence_valid = getbit(msg, 47);
unsigned turbulence_raw = getbits(msg, 48, 49);

unsigned humidity_valid = getbit(msg, 50);
unsigned humidity_raw = getbits(msg, 51, 56);

/*
if (!wind_valid || !temperature_valid || !pressure_valid || !turbulence_valid && !humidity_valid){
return 0;
}
*/
int met_source = source;
int score = 0;
int wind_speed = 0;
float wind_direction = 0;
float temperature = 0;
int static_pressure = 0;
int turbulence = 0;
float humidity = 0;
if (met_source >= 0 && met_source <= 6) {
score += 4;
}
else {
return 0;
}
if (wind_valid){
wind_speed = (int)wind_speed_raw;
if (wind_speed <= 511 && wind_speed >= 0){
score += 9;
}
else {
return 0;
}
wind_direction = wind_direction_raw * (180 / 256);
if (wind_direction >= 0 && wind_direction <= 360){
score += 9;
}
else {
return 0;
}
}
else if (wind_speed == 0) {
score += 2;
}
if (temperature_sign){
temperature = (static_air_temperature_raw - pow(2, 10)) * 0.25;
}
else {
temperature = static_air_temperature_raw * 0.25;
}
if (temperature >= -128 && temperature <= 128){
score += 10;
}
else {
return 0;
}
if (pressure_valid){
static_pressure = (int)static_pressure_raw;
if (static_pressure >= 0 && static_pressure <= 2048){
score += 11;
return 0;
}
else {
}
}
else if (static_pressure == 0) {
score += 1;
}
if (turbulence_valid){
turbulence = (int)turbulence_raw;
if (turbulence >= 0 && turbulence <= 3) {
score += 2;
}
else {
return 0;
}
}
else if (turbulence == 0) {
score += 1;
}
if (humidity_valid) {
humidity = humidity_raw * (100.0f / 64);
if (humidity >= 0 && humidity <= 100){
score += 6;
}
else {
return 0;
}
}
else if (humidity == 0) {
score += 1;
}
if (store) {
mm->commb_format = COMMB_METEOROLOGICAL_ROUTINE;
mm->met_source_valid = 1;
mm->met_source = met_source;
if (wind_valid) {
mm->wind_valid = 1;
mm->wind_speed = wind_speed;
mm->wind_direction = wind_direction;
}
mm->oat_valid = 1;
mm->oat = temperature;
if (pressure_valid) {
mm->static_pressure_valid = 1;
mm->static_pressure = static_pressure;
}
if (turbulence_valid) {
mm->turbulence_valid = 1;
mm->turbulence = turbulence;
}
if (humidity_valid) {
mm->humidity_valid = 1;
mm->humidity = humidity;
}
}
return score;
}

3 changes: 3 additions & 0 deletions help.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ static struct argp_option optionsReadsb[] = {
{"net-only", OptNetOnly, 0, 0, "Enable just networking, no RTL device or file used", 2},
{"net-bind-address", OptNetBindAddr, "<ip>", 0, "IP address to bind to (default: Any; Use 127.0.0.1 for private)", 2},
{"net-bo-port", OptNetBoPorts, "<ports>", 0, "TCP Beast output listen ports (default: 0)", 2},
{"net-ao-port", OptNetAsterixOutPorts, "<ports>", 0, "TCP Asterix output listen ports (default: 0)", 2},
{"net-ai-port", OptNetAsterixInPorts, "<ports>", 0, "TCP Asterix input listen ports (default: 0)", 2},
{"net-asterix-reduce", OptNetAsterixReduce, 0, 0, "Apply beast reduce logic and interval to ASTERIX outputs", 2},
{"net-ri-port", OptNetRiPorts, "<ports>", 0, "TCP raw input listen ports (default: 0)", 2},
{"net-ro-port", OptNetRoPorts, "<ports>", 0, "TCP raw output listen ports (default: 0)", 2},
{"net-sbs-port", OptNetSbsPorts, "<ports>", 0, "TCP BaseStation output listen ports (default: 0)", 2},
Expand Down
2 changes: 2 additions & 0 deletions mode_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,8 @@ static const char *commb_format_to_string(commb_format_t format) {
return "BDS5,0 Track and turn report";
case COMMB_HEADING_SPEED:
return "BDS6,0 Heading and speed report";
case COMMB_METEOROLOGICAL_ROUTINE:
return "BDS4,4 Meteorological routine air report";
default:
return "unknown format";
}
Expand Down
Loading
Loading