Skip to content

Commit

Permalink
remove adsbexchange hardcoding
Browse files Browse the repository at this point in the history
to send uuid, use beast_reduce_plus_out with uuid in net-connector
or use beast_reduce_plus_out with --uuid-file
  • Loading branch information
wiedehopf committed Nov 4, 2024
1 parent 15823dd commit c67e671
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ Selectively forwards beast messages if the received data hasn't been forwarded i
Data not related to the physical aircraft state are only forwarded every 500 ms (4 * `--net-beast-reduce-interval`).The messages of
this output are normal beast messages and compatible with every program able to receive beast messages.

This is used by some aggregators to aggregate ADS-B data, an example net connector would be:
```
--net-connector=feed.airplanes.live,30004,beast_reduce_plus_out,uuid=0033062d-e17e-4389-91a9-79ebb967fb4c
```
The uuid is optional, if none is given, the uuid from --uuid-file is used, if that isn't present no uuid is sent.
The beast_reduce_out net-connector will never send an uuid.
The aggregator enables --net-receiver-id and --net-ingest on their readsb server, it's made to work with beast_reduce_plus_out.

### Debian package

- Build package with no additional receiver library dependencies: `dpkg-buildpackage -b`.
Expand Down Expand Up @@ -121,9 +129,9 @@ For that purpose it's used in conjunction with tar1090 with some extra options t
Websites using this software:

- https://adsb.lol/
- https://globe.adsbexchange.com/
- https://globe.airplanes.live/
- https://globe.adsb.fi/
- https://globe.adsbexchange.com/

Projects that use or have used data generated by this software:

Expand Down
2 changes: 1 addition & 1 deletion help.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static struct argp_option optionsViewadsb[] = {
{"quiet", OptQuiet, 0, 0, "Disable output (default)", 1},
{"debug", OptDebug, "<flags>", 0, "Debug mode (verbose), n: network, P: CPR, S: speed check", 1},
{0,0,0,0, "Network options:", 2},
{"net-connector", OptNetConnector, "<ip,port,protocol>", 0, "Establish connection, can be specified multiple times (viewadsb default: --net-connector 127.0.0.1,30005,beast_in viewadsb first usage overrides default, second usage adds another input/output) 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, uat_in, uat_replay_out, planefinder_in, asterix_in, asterix_out (one failover ip/address,port can be specified: primary-address,primary-port,protocol,failover-address,failover-port) (any position in the comma separated list can also be either silent_fail or uuid=<uuid>)", 2},
{"net-connector", OptNetConnector, "<ip,port,protocol>", 0, "Establish connection, can be specified multiple times (viewadsb default: --net-connector 127.0.0.1,30005,beast_in viewadsb first usage overrides default, second usage adds another input/output) Protocols: beast_out, beast_reduce_out, beast_reduce_plus_out, beast_in, raw_out, raw_in, sbs_in, sbs_in_jaero, sbs_out, sbs_out_jaero, vrs_out, json_out, gpsd_in, uat_in, uat_replay_out, planefinder_in, asterix_in, asterix_out (one failover ip/address,port can be specified: primary-address,primary-port,protocol,failover-address,failover-port) (any position in the comma separated list can also be either silent_fail or uuid=<uuid>)", 2},
{0,0,0,0, "Help options:", 100},
{ 0 }
};
Expand Down
13 changes: 4 additions & 9 deletions net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,23 +371,19 @@ static struct client *createSocketClient(struct net_service *service, int fd) {

static int sendUUID(struct client *c, int64_t now) {
struct net_connector *con = c->con;
// sending UUID if hostname matches adsbexchange or for beast_reduce_plus output
// sending UUID for beast_reduce_plus output
char uuid[150];
uuid[0] = '\0';
if ((c->sendq && c->sendq_len + 256 < c->sendq_max) && con
&& (con->enable_uuid_ping || (strstr(con->address, "feed") && strstr(con->address, ".adsbexchange.com")) || Modes.debug_ping || Modes.debug_send_uuid)) {
&& (con->enable_uuid_ping || Modes.debug_ping || Modes.debug_send_uuid)) {

int res = -1;

if (con->uuid) {
strncpy(uuid, con->uuid, 135);
res = strlen(uuid);
} else {
} else if (Modes.uuidFile) {
int fd = open(Modes.uuidFile, O_RDONLY);
// try legacy / adsbexchange image path as hardcoded fallback
if (fd == -1) {
fd = open("/boot/adsbx-uuid", O_RDONLY);
}
if (fd != -1) {
res = read(fd, uuid, 128);
close(fd);
Expand All @@ -408,9 +404,8 @@ static int sendUUID(struct client *c, int64_t now) {
strncpy(c->sendq + c->sendq_len, uuid, res);
c->sendq_len += 36;
} else {
fprintf(stderr, "ERROR: Not a valid UUID: '%s' (to generate a valid uuid use this command: cat /proc/sys/kernel/random/uuid)\n", uuid);
uuid[0] = '\0';
fprintf(stderr, "ERROR: Not a valid UUID: %s\n", Modes.uuidFile);
fprintf(stderr, "Use this command to fix: sudo uuidgen > %s\n", Modes.uuidFile);
}

// enable ping stuff
Expand Down
1 change: 0 additions & 1 deletion readsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ static void configSetDefaults(void) {
Modes.net_output_flush_interval_beast_reduce = -1; // default to net_output_flush_interval after config parse if not configured
Modes.netReceiverId = 0;
Modes.netIngest = 0;
Modes.uuidFile = strdup("/usr/local/share/adsbexchange/adsbx-uuid");
Modes.json_trace_interval = 20 * 1000;
Modes.state_write_interval = 1 * HOURS;
Modes.heatmap_current_interval = -15;
Expand Down
4 changes: 4 additions & 0 deletions track.c
Original file line number Diff line number Diff line change
Expand Up @@ -2620,6 +2620,10 @@ struct aircraft *trackUpdateFromMessage(struct modesMessage *mm) {
}
}

if (0 && a->addr == Modes.cpr_focus && mm->cpr_valid) {
displayModesMessage(mm);
}

if (cpr_new) {
a->last_cpr_type = mm->cpr_type;
}
Expand Down

0 comments on commit c67e671

Please sign in to comment.