aboutsummaryrefslogtreecommitdiff
path: root/unittest/ota_last.sh
blob: 31efa1cfeb3df18138dcf4a4ae7eb87f57ff8b35 (plain)
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
#!/usr/bin/env bash
#
# Present summary info from the n-th latest OTA HF data test

function print_help {
    echo
    echo "Summary of last automated Over The Air (OTA) test"
    echo
    echo "  usage ./ota_last.sh [options]"
    echo
    echo "    -a       show scatter diagram"
    echo "    -p       play the received wave file"
    echo "    -n N     select N-th from last file"
    echo "    -s       display spectrogram"
}

show_spec=0
show_scatter=0
play_file=0
N=1

while [[ $# -gt 0 ]]
do
key="$1"
case $key in
    -n)
        N="$2"
        shift
        shift
    ;;
    -a)
        show_scatter=1
        shift
    ;;
    -s)
        show_spec=1
        shift
    ;;
    -p)
        play_file=1
        shift
    ;;
    -h)
        print_help	
    ;;
esac
done

# cat the log from the selected test
directory=$(ls -td 2021* | head -n ${N} | tail -n 1)
echo ${directory}
cat ${directory}/log.txt

# optionally show a few plots

if [ $show_spec -eq 1 ]; then
    if [ -f ${directory}/spec.png ]; then
        eog ${directory}/spec.png
    else
        eog ${directory}/spec.jpg
    fi
fi

if [ $show_scatter -eq 1 ]; then
    eog ${directory}/scatter.png
fi

if [ $play_file -eq 1 ]; then
    play ${directory}/rx.wav
fi