#!/bin/bash

function print_usage_and_die {
    echo "USAGE:  set-test-mode TESTMODE SNAPTESTCHANNEL"
    echo "modes:  full-tx-rx-normal, rxonly, intermod, disabled"
    exit 1
}


if [[ "$#" < 1 ]] ; then
    print_usage_and_die
fi 

rm -f /opt/fcc-tests/run-fcc-tests

if [[ "$1" == "rxonly" ]] ; then
    ln -s /opt/fcc-tests/rx-only-tests.sh /opt/fcc-tests/run-fcc-tests
    exit 0
elif [[ "$1" == "full-tx-rx-normal" ]] && [[ "$#" == 2 ]] ; then
    ln -s /opt/fcc-tests/full-tx-rx-normal-ops-exercise.sh /opt/fcc-tests/run-fcc-tests
elif [[ "$1" == "intermod" ]] && [[ "$#" == 2 ]] ; then
    ln -s /opt/fcc-tests/intermod-tests.sh /opt/fcc-tests/run-fcc-tests
elif [[ "$1" == "disabled" ]] ; then 
    exit 0
else
    print_usage_and_die
fi

CHANNEL=$2
/usr/local/bin/set-snap-test-channel $CHANNEL
