readsb: new package

This package is based on dump1090-fa with many modifications. A big
advantage over dump1090-fa is that it can connect to multiple services
like adsbexchange, piaware or fr24feed.

As the idea for this package is mostly to feed other services, the HTML
files to serve via a webserver have not been included. The service(s)
that will be fed by readsb can offer such a webpage instead.

Finally, the init script does not use local variables, as local is
undefined in POSIX.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
This commit is contained in:
Stijn Tintel
2020-05-03 23:21:52 +03:00
parent e1f607af94
commit 02f3892eb2
4 changed files with 313 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
config readsb main
option enabled '0'
option beast_crc_off '0'
option beast_df045_on '0'
option beast_df1117_on '0'
option beast_fec_off '0'
option beast_mlat_off '0'
option beast_modeac '0'
option beast_serial ''
option dcfilter '0'
option debug ''
option device ''
option device_type ''
option enable_agc '0'
option enable_biastee '0'
option fix '1'
option freq ''
option forward_mlat '0'
option gain ''
option gnss '0'
option json_location_accuracy ''
option lat ''
option lon ''
option max_range ''
option metric '0'
option mlat '0'
option modeac '0'
option net '1'
option net_beast_reduce_interval ''
option net_beast_reduce_out_port ''
option net_bi_port ''
option net_bind_address ''
option net_bo_port ''
option net_buffer ''
list net_connector ''
option net_only '0'
option net_verbatim '0'
option no_crc_check '0'
option no_modeac_auto '0'
option onlyaddr '0'
option ppm ''
option stats '0'
option stats_every ''
option stats_range '0'
option write_json ''
option write_json_every ''
+105
View File
@@ -0,0 +1,105 @@
#!/bin/sh /etc/rc.common
START=90
STOP=10
USE_PROCD=1
append_bool() {
config_get_bool tbool "$1" "$2"
v=$(echo "$2" | sed 's/_/-/g')
[ -z "$tbool" ] && tbool="$3"
[ "$tbool" -eq 1 ] && procd_append_param command "--${v}"
}
append_bool_no() {
config_get_bool tbool "$1" "$2"
v=$(echo "$2" | sed 's/_/-/g')
[ -z "$tbool" ] && tbool="$3"
[ "$tbool" -eq 0 ] && procd_append_param command "--no-${v}"
[ "$tbool" -eq 1 ] && procd_append_param command "--${v}"
}
append_param() {
config_get tparam "$1" "$2"
name=$(echo "$2" | sed 's/_/-/g')
[ -n "$tparam" ] && procd_append_param command "--${name}=${tparam}"
}
start_instance() {
cfg=$1
config_get_bool enabled "$cfg" "enabled" 0
[ "$enabled" -eq 1 ] || return 0
procd_open_instance "$cfg"
procd_set_param command /usr/bin/readsb
procd_append_param command "--quiet"
procd_set_param respawn
procd_set_param stderr "1"
procd_set_param stdout "1"
append_bool "$cfg" beast_crc_off 0
append_bool "$cfg" beast_df045_on 0
append_bool "$cfg" beast_df1117_on 0
append_bool "$cfg" beast_fec_off 0
append_bool "$cfg" beast_mlat_off 0
append_bool "$cfg" beast_modeac 0
append_bool "$cfg" dcfilter 0
append_bool "$cfg" enable_agc 0
append_bool "$cfg" enable_biastee 0
append_bool "$cfg" forward_mlat 0
append_bool "$cfg" gnss 0
append_bool "$cfg" metric 0
append_bool "$cfg" mlat 0
append_bool "$cfg" modeac 0
append_bool "$cfg" net 1
append_bool "$cfg" net_only 0
append_bool "$cfg" net_verbatim 0
append_bool "$cfg" no_crc_check 0
append_bool "$cfg" no_modeac_auto 0
append_bool "$cfg" onlyaddr 0
append_bool "$cfg" stats 0
append_bool "$cfg" stats_range 0
append_bool_no "$cfg" fix 1
for param in \
beast_serial \
debug \
device \
device_type \
freq \
gain \
json_location_accuracy \
lat \
lon \
max_range \
net_beast_reduce_interval \
net_beast_reduce_out_port \
net_bi_port \
net_bind_address \
net_bo_port \
net_buffer \
ppm \
stats_every \
write_json \
write_json_every
do
append_param "$cfg" "$param"
done
config_get net_connector "$cfg" "net_connector"
[ -z "$net_connector" ] || {
for conn in $net_connector; do
procd_append_param command --net-connector="$conn"
done
}
procd_close_instance
}
start_service() {
config_load readsb
config_foreach start_instance readsb
}