Skip to content

Commit

Permalink
Add tool for sending CW from the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 6, 2020
1 parent 6d3ebc3 commit 48826d5
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions pistar-sendcw
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#
##############################################################################
# #
# Pi-Star send CW Tool #
# #
# Version 1.0, Code, Design and Development by Andy Taylor (MW0MWZ). #
# #
# Make it simple to send CW from the CLI on Pi-Star. #
# #
##############################################################################
#
if [ "$(id -u)" != "0" ]; then
echo -e "You need to be root to run this command...\n"
exit 1
fi

# Make sure config is present
if [ "$(grep -o 'Remote Control' /etc/mmdvmhost | wc -l)" -eq "0" ]; then
echo -e "Remote Commands not enabled...\n"
exit 1
fi

# Setup some variables
cmd=/usr/local/bin/RemoteCommand
enable=$(grep -A1 'Remote Control' /etc/mmdvmhost | tail -n 1 | awk -F "=" '{print $2}')
port=$(grep -A2 'Remote Control' /etc/mmdvmhost | tail -n 1 | awk -F "=" '{print $2}')

# Make sure that remote commands are turned on
if [ "${enable}" -eq "0" ]; then
echo -e "Remote Commands not enabled...\n"
exit 1
fi


if [ -z "$1" ]
then
echo "To send CW from your Pi-Star, simply run the command with"
echo "the following syntax: pistar-sendcw <message>"
echo "where <message> is the message you want to transmit in CW."
echo ""
exit 0
fi

# Swap "." to " " until MMDVM firmware includes "." support
message=$(echo "$*" | tr "." " ")

(cd /var/log/pi-star/; ${cmd} ${port} cw ${message^^})

exit 0

0 comments on commit 48826d5

Please sign in to comment.