#!/bin/sh

LRAUV=/home/tethysadmin/workspace/LRAUV
# TODO make path portable

cd $LRAUV
for vehicle in lrauv-tethys lrauv-daphne
do
  octave --eval "cd Tools/HFRadarModel/; queueOutgoing('$vehicle')" &> /dev/null
  # TODO Make the queueOutgoing script more robust to missing or malformed data
  # 	 (Maybe fold all of this into a single python script.)
done
# TODO Come back and make this vehicle/IMEI mapping a loop, or wait until it
# is all in a single python script and use an INI file.

sendOutgoing=Tools/HFRadarModel/sendOutgoing.py
enc=TethysEncryption

echo "$1"
if [ "$1" = "send" ] 
then
  echo "sending data updates via SFTP and iridium"
  $sendOutgoing lrauv-tethys 300234011866620 $enc
  $sendOutgoing lrauv-daphne 300234011783940 $enc
fi
# TODO Look up the IMEI numbers from Config/<vehicle>/vehicle.cfg

# TODO might want to split the network and Iridium implementations so that
# you have to explicitly specify iridium -- don't want to send a whole slew
# of files over iridium due to some temporary network error.
