#!/bin/bash
#

##
# Show the menu items
#
menu() {
    echo "";
    echo "(1) Create New Survey   (Starts Prosilica Drivers)";
    echo "(2) Stop Current Survey (Stops  Prosilica Drivers)";
    echo ""
    echo "(3) Begin Survey Image Acquisition";
    echo "(4) Stop  Survey Image Acquisition";
    echo ""
    echo "(5) Check number of images files";
    echo ""
    echo "(6) Start LCM Spy program";
    echo ""
    echo "(7) Exit";
    echo ""
    echo "Enter a command number 1 to 7"
    echo -ne "> ";
}

##
# Main loop
#
# Show the menu, read the requested command, execute the command.
#
clear;
echo "";
echo "******************************************"
echo "*        Image Acquisition Helper        *"
echo "******************************************"
while :
do
  menu
  read CMD
  case $CMD in
      1) clear;./run-stereo-driver;;
      2) clear;./kill-cameras;./make_imagelist.rb;;
      3) clear;./cam-attributes -s -m -O;./cam-attributes -s -c -O;gwenview latest/images/right &;;
      4) clear;./cam-attributes -s -m -X;./cam-attributes -s -c -X;;
      5) clear;echo "";echo "# image files: `ls -ltr ./latest/images/left/*IMG* | wc -l`";;
      6) clear;./perls-spy &;;
      [7qQ]) echo "Exiting..."; break;;
      *) echo "Invalid command, try again...";;
  esac
  sleep 0.5
  echo "";
  echo "******************************************"
done

#
