forked from AndyTaylorTweet/Pi-Star_Binaries_sbin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tool for sending CW from the CLI
- Loading branch information
root
committed
May 6, 2020
1 parent
6d3ebc3
commit 48826d5
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |