mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Initial prototype for finding nearby Winlink stations
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Author : Gaston
|
||||
# Date : 30 November 2025
|
||||
# Purpose : Finds Winlink RMS stations by channel near a given location
|
||||
set -e
|
||||
set -o pipefail
|
||||
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
|
||||
trap 'echo -e "${RED}\"${last_command}\" command failed with exit code $?.${NC}"' ERR
|
||||
|
||||
source /opt/emcomm-tools/bin/et-common
|
||||
|
||||
read -p "Enter latitude: " LAT
|
||||
read -p "Enter longitude: " LON
|
||||
read -p "Enter band (optional): " BAND
|
||||
read -p "Enter mode (optional): " MODE
|
||||
|
||||
QUERY="http://localhost:1981/api/winlink/near?lat=${LAT}&lon=${LON}"
|
||||
[[ -n "${BAND}" ]] && QUERY="${QUERY}&band=${BAND}"
|
||||
[[ -n "${MODE}" ]] && QUERY="${QUERY}&mode=${MODE}"
|
||||
|
||||
OUT=$(curl -s "${QUERY}")
|
||||
|
||||
if [[ -z "${OUT}" ]] || [[ "${OUT}" = "[]" ]]; then
|
||||
echo "No Winlink RMS channels found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Nearby Winlink RMS Channels:"
|
||||
echo "----------------------------"
|
||||
|
||||
echo "${OUT}" | jq -r '
|
||||
(["Station","Callsign","Lat","Lon","Mode","Freq","Band"] | @tsv),
|
||||
(.[] | [
|
||||
.callsign,
|
||||
.base_callsign,
|
||||
(.lat | tostring),
|
||||
(.lon | tostring),
|
||||
.mode,
|
||||
(.freq | tostring),
|
||||
.band
|
||||
] | @tsv)
|
||||
' | column -t -s $'\t'
|
||||
Reference in New Issue
Block a user