-
Notifications
You must be signed in to change notification settings - Fork 536
/
easytest.sh
executable file
·243 lines (203 loc) · 6.59 KB
/
easytest.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#!/bin/sh
abort_action=0
OUTPUT_FREQ=434.0
DEFAUL_JPG_PICTURE_LOC=src/resources/SAMPLE_IMAGE.jpg
DEFAULT_WAV_FILE_MONO_LOC=src/resources/SAMPLE_MONO_AUDIO.wav
DEFAULT_WAV_FILE_STEREO_LOC=src/resources/SAMPLE_STEREO_AUDIO.wav
DEFAULT_RF_FREEDV_FILE_LOC=src/resources/SAMPLE_FREEDV.rf
DEFAULT_POCSAG_MESSAGE="1:YOURCALL\n2: Hello world"
DEFAULT_OPERA_CALLSIGN="F5OEO"
DEFAULT_RTTY_MESSAGE="HELLO WORLD FROM RPITX"
LAST_ITEM="0 Tune"
do_check_file_existance()
{
readlink -e $1 > /dev/null
if [ $? -eq 1 ]; then
whiptail --title "Error!" --msgbox "The file does not exist!" 8 78
return 1
fi
return 0
}
do_freq_setup()
{
if FREQ=$(whiptail --inputbox "Enter output Frequency (in MHz). Current is $OUTPUT_FREQ MHz" 8 78 $OUTPUT_FREQ --title "Rpitx transmit Frequency" 3>&1 1>&2 2>&3); then
OUTPUT_FREQ=$FREQ
fi
}
do_file_choose()
{
LAST_ITEM="$menuchoice"
if FILE_LOC=$(whiptail --inputbox "Enter $1 file location. Default is $2" 8 78 $2 --title "Select a file to transmit" 3>&1 1>&2 2>&3); then
do_check_file_existance "$FILE_LOC"
abort_action=$?
else
abort_action=1
fi
}
do_enter_message()
{
LAST_ITEM="$menuchoice"
if MESSAGE=$(whiptail --inputbox "Type custom $1 message:" 8 78 "$2" --title "Enter message to transmit" 3>&1 1>&2 2>&3); then
abort_action=0
if [ -z "$MESSAGE" ]; then
whiptail --title "Error!" --msgbox "Empty message!" 8 78
abort_action=1
fi
else
abort_action=1
fi
}
do_enter_callsign()
{
LAST_ITEM="$menuchoice"
if CALLSIGN=$(whiptail --inputbox "Type callsign:" 8 78 "$DEFAULT_OPERA_CALLSIGN" --title "Enter callsign to transmit" 3>&1 1>&2 2>&3); then
abort_action=0
if [ -z "$CALLSIGN" ]; then
whiptail --title "Error!" --msgbox "Empty callsign!" 8 78
abort_action=1
fi
else
abort_action=1
fi
}
do_stop_transmit()
{
sudo killall tune 2>/dev/null
sudo killall pichirp 2>/dev/null
sudo killall spectrumpaint 2>/dev/null
sudo killall pifmrds 2>/dev/null
sudo killall sendiq 2>/dev/null
sudo killall pocsag 2>/dev/null
sudo killall piopera 2>/dev/null
sudo killall rpitx 2>/dev/null
sudo killall freedv 2>/dev/null
sudo killall pisstv 2>/dev/null
sudo killall csdr 2>/dev/null
sudo killall pirtty 2>/dev/null
case "$menuchoice" in
0\ *) sudo killall testvfo.sh >/dev/null 2>/dev/null ;;
1\ *) sudo killall testvfo.sh >/dev/null 2>/dev/null ;;
2\ *) sudo killall testspectrum.sh >/dev/null 2>/dev/null ;;
3\ *) sudo killall snap2spectrum.sh >/dev/null 2>/dev/null ;;
4\ *) sudo killall testfmrds.sh >/dev/null 2>/dev/null ;;
5\ *) sudo killall testnfm.sh >/dev/null 2>/dev/null ;;
6\ *) sudo killall testssb.sh >/dev/null 2>/dev/null ;;
7\ *) sudo killall testam.sh >/dev/null 2>/dev/null ;;
8\ *) sudo killall testfreedv.sh >/dev/null 2>/dev/null ;;
9\ *) sudo killall testsstv.sh >/dev/null 2>/dev/null ;;
10\ *) sudo killall testpocsag.sh >/dev/null 2>/dev/null ;;
11\ *) sudo killall testopera.sh >/dev/null 2>/dev/null ;;
12\ *) sudo killall testrtty.sh >/dev/null 2>/dev/null ;;
esac
}
do_status()
{
LAST_ITEM="$menuchoice"
whiptail --title "Transmit ""$LAST_ITEM"" on ""$OUTPUT_FREQ"" MHz" --msgbox "Transmitting" 8 78
do_stop_transmit
}
#********************************
# User interface initialization *
#********************************
do_freq_setup
while [ true ]
do
menuchoice=$(whiptail --default-item "$LAST_ITEM" --title "Rpitx on ""$OUTPUT_FREQ"" MHz" --menu "Range frequency : 50kHz-1GHz. Choose your test:" 20 82 12 \
"F Set frequency" "Modify frequency (actual $OUTPUT_FREQ MHz)" \
"0 Tune" "Carrier" \
"1 Chirp" "Moving carrier" \
"2 Spectrum" "Spectrum painting" \
"3 RfMyFace" "Snap with Raspicam and RF paint" \
"4 FmRds" "Broadcast modulation with RDS" \
"5 NFM" "Narrow band FM" \
"6 SSB" "Upper Side Band modulation" \
"7 AM" "Amplitude Modulation (Poor quality)" \
"8 FreeDV" "Digital voice mode 800XA" \
"9 SSTV" "Pattern picture" \
"10 Pocsag" "Pager message" \
"11 Opera" "Like morse but need Opera decoder" \
"12 RTTY" "Radioteletype" \
3>&2 2>&1 1>&3)
RET=$?
if [ $RET -eq 1 ]; then
whiptail --title "Bye bye" --msgbox "Thx for using rpitx" 8 78
exit 0
elif [ $RET -eq 0 ]; then
case "$menuchoice" in
F\ *) do_freq_setup
;;
0\ *) "./testvfo.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
do_status
;;
1\ *) "./testchirp.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
do_status
;;
2\ *) do_file_choose "320x256 .jpg" "$DEFAUL_JPG_PICTURE_LOC"
if [ $abort_action -eq 0 ]; then
"./testspectrum.sh" "$OUTPUT_FREQ""e6" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
3\ *) "./snap2spectrum.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
do_status
;;
4\ *) do_file_choose ".wav" "$DEFAULT_WAV_FILE_STEREO_LOC"
if [ $abort_action -eq 0 ]; then
"./testfmrds.sh" "$OUTPUT_FREQ" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
5\ *) do_file_choose ".wav (16 bit per sample, 48000 sample rate, mono)" "$DEFAULT_WAV_FILE_MONO_LOC"
if [ $abort_action -eq 0 ]; then
"./testnfm.sh" "$OUTPUT_FREQ""e6" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
6\ *) do_file_choose ".wav (16 bit per sample, 48000 sample rate, mono)" "$DEFAULT_WAV_FILE_MONO_LOC"
if [ $abort_action -eq 0 ]; then
"./testssb.sh" "$OUTPUT_FREQ""e6" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
7\ *) do_file_choose ".wav (16 bit per sample, 48000 sample rate, mono)" "$DEFAULT_WAV_FILE_MONO_LOC"
if [ $abort_action -eq 0 ]; then
"./testam.sh" "$OUTPUT_FREQ""e6" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
8\ *) do_file_choose "FreeDV .rf" "$DEFAULT_RF_FREEDV_FILE_LOC"
if [ $abort_action -eq 0 ]; then
"./testfreedv.sh" "$OUTPUT_FREQ""e6" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
9\ *) do_file_choose "320x256 .jpg" "$DEFAUL_JPG_PICTURE_LOC"
if [ $abort_action -eq 0 ]; then
"./testsstv.sh" "$OUTPUT_FREQ""e6" "$FILE_LOC" >/dev/null 2>/dev/null &
do_status
fi
;;
10\ *) do_enter_message "POCSAG (ADDR:MESSAGE_BODY)" "$DEFAULT_POCSAG_MESSAGE"
if [ $abort_action -eq 0 ]; then
"./testpocsag.sh" "$OUTPUT_FREQ""e6" "$MESSAGE" >/dev/null 2>/dev/null &
do_status
fi
;;
11\ *) do_enter_callsign
if [ $abort_action -eq 0 ]; then
"./testopera.sh" "$OUTPUT_FREQ""e6" "$CALLSIGN" >/dev/null 2>/dev/null &
do_status
fi
;;
12\ *) do_enter_message "RTTY" "$DEFAULT_RTTY_MESSAGE"
if [ $abort_action -eq 0 ]; then
"./testrtty.sh" "$OUTPUT_FREQ""e6" "$MESSAGE" >/dev/null 2>/dev/null &
do_status
fi
;;
esac
else
exit 1
fi
done
exit 0