Winlink - In preparation to support VARA FM and HF, I started to refactor the Winlink modes. Added support for Winlink configuration templates. Added supported for native AX.25 packet for devices that use /dev/rfcomm0 and a Bluetooth TNC

This commit is contained in:
Gaston Gonzalez
2025-02-03 16:48:33 -07:00
parent 4f46a72b87
commit 350173ab39
9 changed files with 335 additions and 24 deletions
+40 -13
View File
@@ -2,7 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 4 November 2024
# Updated : 12 December 2024
# Updated : 3 February 2025
# Purpose : Wrapper script for starting YAAC with PnP support
#
# Preconditions:
@@ -13,14 +13,17 @@
# 1. Callsign, Winlink password, and grid are updated are updated
# 2. pat http is started
source /opt/emcomm-tools/bin/et-common
PAT_CONF_FILE=${HOME}/.config/pat/config.json
PAT_CONF_FILE_TEMPLATE=/etc/skel/.config/pat/config.json
usage() {
echo "usage: $(basename $0) <command>"
echo " <command>"
echo " start-ardop - Start Pat Winlink in ardop mode"
echo " start-packet - Start Pat Winlink in packet mode"
echo " start-ardop - Start Pat Winlink in ardop mode"
echo " start-packet - Start Pat Winlink in packet mode"
echo " start-native-packet - Start Pat Winlink in native AX.25 packet mode"
}
if [ $# -ne 1 ]; then
@@ -60,7 +63,7 @@ start_packet() {
notify_user "Dire Wolf not running. Run: et-direwolf simple-packet"
exit 1
fi
update_config packet
CMD="pat http"
@@ -69,6 +72,24 @@ start_packet() {
${CMD}
}
# Only the BTECH UV PRO is supported in this mode
start_native_packet() {
BLUETOOTH_TNC_CHECK=$(ps -ef | grep "[r]fcomm connect")
if [[ $? -ne 0 ]]; then
echo -e "${RED}Can't start Pat in native AX.25 packet mode."
echo -e "If you have a UV Pro, first run: ${YELLOW}et-uv-pro connect${NC}"
exit 1
fi
update_config native-packet
CMD="pat http"
et-log "Starting Pat with: ${CMD}"
${CMD}
}
update_config () {
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
@@ -82,6 +103,18 @@ update_config () {
exit 1
fi
case $1 in
ardop)
PAT_CONF_FILE_TEMPLATE=/opt/emcomm-tools/conf/template.d/winlink/config.ardop.json
;;
packet)
PAT_CONF_FILE_TEMPLATE=/opt/emcomm-tools/conf/template.d/winlink/config.ax25-agw.json
;;
native-packet)
PAT_CONF_FILE_TEMPLATE=/opt/emcomm-tools/conf/template.d/winlink/config.ax25-native.json
;;
esac
et-log "Updating Pat configuration file: ${PAT_CONF_FILE}..."
cp -v ${PAT_CONF_FILE_TEMPLATE} ${PAT_CONF_FILE}
@@ -89,15 +122,6 @@ update_config () {
sed -i "s|{{ET_WINLINK_PASSWD}}|${WINLINK_PASSWD}|g" ${PAT_CONF_FILE}
sed -i "s|{{ET_GRID}}|${GRID}|g" ${PAT_CONF_FILE}
# Enable the P2P listener for the current mode selected (ARDOP or AX.25)
case $1 in
ardop)
sed -i "s|{{ET_WINLINK_LISTEN}}|ardop|g" ${PAT_CONF_FILE}
;;
packet)
sed -i "s|{{ET_WINLINK_LISTEN}}|ax25|g" ${PAT_CONF_FILE}
;;
esac
}
case $1 in
@@ -107,6 +131,9 @@ case $1 in
start-packet)
start_packet
;;
start-native-packet)
start_native_packet
;;
*)
echo "Invalid command."
usage