-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathpistar-sendcw
executable file
·50 lines (42 loc) · 1.73 KB
/
pistar-sendcw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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