From 6496afbf7d1cdf396c4528df3135acd85b5f998d Mon Sep 17 00:00:00 2001 From: kx1t Date: Mon, 16 Oct 2023 08:50:44 -0400 Subject: [PATCH] optionally allow name=Friendly_Name in mlat string for ULTRAFEEDER_CONFIG --- README.md | 5 ++-- rootfs/etc/s6-overlay/scripts/mlat-client | 31 +++++++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ac10cda..005dd08 100644 --- a/README.md +++ b/README.md @@ -289,7 +289,7 @@ The ULTRAFEEDER_CONFIG parameter can have multiple config strings, separated by ``` - To connect to an external ADSB (for input or output), UAT, or MLAT results source, use `- ULTRAFEEDER_CONFIG=adsb,host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]` -- To connect and send data to an MLAT Server, use `- ULTRAFEEDER_CONFIG=mlat,host,port[,return_port][,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,input_connect=remote-host:port,lat=xx.xxxx,lon=yy.yyyy,alt=zzz][,extra-arguments]`. For the optional parts in this structure, see [MLAT configuration](#mlat-configuration). Note - any MLAT results data received from the MLAT Server will automatically be aggregated in an [MLAT Hub](#configuring-the-built-in-mlat-hub) and shared with `tar1090` +- To connect and send data to an MLAT Server, use `- ULTRAFEEDER_CONFIG=mlat,host,port[,return_port][,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][name=Friendly_Name-123][,input_connect=remote-host:port,lat=xx.xxxx,lon=yy.yyyy,alt=zzz][,extra-arguments]`. For the optional parts in this structure, see [MLAT configuration](#mlat-configuration). Note - any MLAT results data received from the MLAT Server will automatically be aggregated in an [MLAT Hub](#configuring-the-built-in-mlat-hub) and shared with `tar1090` - To add MLAT results from additional MLAT Servers not configured with Ultrafeeder (for example, MLAT results from FlightRadar24 or FlightAware/piaware), use `- ULTRAFEEDER_CONFIG=mlathub,host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX][,extra-arguments]`. You can further configure this MLAT Hub as described in the section [Configuring the built-in MLAT Hub](#configuring-the-built-in-mlat-hub) In the above configuration strings: @@ -306,7 +306,8 @@ In the above configuration strings: - `sbs_out`: SBS-format output - `vrs_out`: SBS-format output - `uat_in`: "special" RAW format input as generated by the `dump978` container on port 30978. It is advisable to use this protocol and port to get UAT data from dump978, for example: `- ULTRAFEEDER_CONFIG=adsb,dump978,30978,uat_in` -- `uuid` is a Universally Unique Identifier. You can reuse the one you generated for AdsbExchange, or you can generate a new one with this Linux command: `cat /proc/sys/kernel/random/uuid`. If omitted, it will use the UUID environment parameter, or if that one doesn't exist, it will leave the field empty. +- `uuid` is a Universally Unique Identifier. You can reuse the one you generated for AdsbExchange, or you can generate a new one with this Linux command: `cat /proc/sys/kernel/random/uuid`. If omitted, it will use the `UUID` environment parameter, or if that one doesn't exist, it will leave the field empty. +- `name` is a friendly name (containing any character of the set \[A-Za-z0-9_-\]) that will be sent to the MLAT Server, used to identify the station by name. If omitted, it will use the `MLAT_USER` parameter, or if that one doesn't exist, it will leave the field empty. ##### Networking parameters diff --git a/rootfs/etc/s6-overlay/scripts/mlat-client b/rootfs/etc/s6-overlay/scripts/mlat-client index 416f84d..37a6354 100755 --- a/rootfs/etc/s6-overlay/scripts/mlat-client +++ b/rootfs/etc/s6-overlay/scripts/mlat-client @@ -120,6 +120,9 @@ do elif header="${params[i]:0:5}" && [[ "${header,,}" == "uuid=" ]]; then # It's a UUID uuid_arg="${params[i]#*=}" + elif header="${params[i]:0:5}" && [[ "${header,,}" == "name=" ]]; then + # It's a MLAT_NAME + name_arg="${params[i]#*=}" elif header="${params[i]:0:4}" && [[ "${header,,}" == "lat=" ]]; then # It's a latitude lat_arg="${params[i]#*=}" @@ -146,13 +149,13 @@ do servername=${params[0]} # add return port: - [ -n "${return_port_arg}" ] && MLAT_PARAM+=("--results beast,listen,${return_port_arg}") || true + [[ -n "${return_port_arg}" ]] && MLAT_PARAM+=("--results beast,listen,${return_port_arg}") || true # add input-connect to the param array: MLAT_PARAM+=(--input-connect "${input_connect_arg:-localhost:30005}") - if [ -n "${MLAT_USER}" ]; then - MLAT_PARAM+=(--user "${MLAT_USER}") + if [[ -n "${name_arg}" ]] || [[ -n "${MLAT_USER}" ]]; then + MLAT_PARAM+=(--user "${name_arg:-${MLAT_USER}}") else rnd="${RANDOM}" "${s6wrap[@]}" --args echo "WARNING: MLAT_USER is not set - using random number \"${rnd}\" as MLAT_USER" @@ -160,34 +163,34 @@ do fi # add LAT/LON/ALT to instance: - if [ -n "${lat_arg}" ]; then + if [[ -n "${lat_arg}" ]]; then MLAT_PARAM+=(--lat "${lat_arg}") - elif [ -n "${LAT}" ]; then + elif [[ -n "${LAT}" ]]; then MLAT_PARAM+=(--lat "${LAT}") - elif [ -n "${READSB_LAT}" ]; then + elif [[ -n "${READSB_LAT}" ]]; then MLAT_PARAM+=(--lat "${READSB_LAT}") fi - if [ -n "${lon_arg}" ]; then + if [[ -n "${lon_arg}" ]]; then MLAT_PARAM+=(--lon "${lon_arg}") - elif [ -n "${LONG}" ]; then + elif [[ -n "${LONG}" ]]; then MLAT_PARAM+=(--lon "${LONG}") - elif [ -n "${READSB_LON}" ]; then + elif [[ -n "${READSB_LON}" ]]; then MLAT_PARAM+=(--lon "${READSB_LON}") fi - if [ -n "${alt_arg}" ]; then + if [[ -n "${alt_arg}" ]]; then MLAT_PARAM+=(--alt "${alt_arg}") - elif [ -n "${ALT}" ]; then + elif [[ -n "${ALT}" ]]; then MLAT_PARAM+=(--alt "${ALT}") - elif [ -n "${READSB_ALT}" ]; then + elif [[ -n "${READSB_ALT}" ]]; then MLAT_PARAM+=(--alt "${READSB_ALT}") fi # Add UUID to instance - if [ -n "$uuid_arg" ]; then + if [[ -n "$uuid_arg" ]]; then MLAT_PARAM+=("--uuid ${uuid_arg}") - elif [ -n "${UUID}" ]; then + elif [[ -n "${UUID}" ]]; then MLAT_PARAM+=("--uuid ${UUID}") else "${s6wrap[@]}" --args echo "WARNING: UUID is not defined, proceeding without UUID"