using System;
using Microsoft.SPOT;

namespace miniCPF
{
    class MissionConfigFile
    {
        public struct DepthTable
        {
            public double depth;
            public double PV;
            public TimeSpan parkTime;
        }

        public static DepthTable[] ascendTable = new DepthTable[3];
        public static DepthTable[] descendTable = new DepthTable[1];

        public static TimeSpan parkSamplePeriod = new TimeSpan(0, 0, 60);    //hours, minutes, seconds

        private static bool usbCable = true;

        public static void init()
        {
            usbCable = false;
            //usbCable = true;
            if (usbCable)
            {
                //Ascend table
                ascendTable[0].depth = 1.5;
                ascendTable[0].PV = 0.05;
                ascendTable[0].parkTime = new TimeSpan(0, 0, 0, 0);         //days, hours, minutes, seconds

                ascendTable[1].depth = 1.0;
                ascendTable[1].PV = 0.05;
                ascendTable[1].parkTime = new TimeSpan(0, 0, 0, 0);

                // The last entry in the Ascend table must have a depth of 0.0
                // When the mission hits the last entry in the ascend table, it goes to the surface at this PV rate
                // The park time value don't matter, 
                ascendTable[2].depth = 0.0;
                ascendTable[2].PV = 0.2;
                ascendTable[2].parkTime = new TimeSpan(0, 0, 0, 0);

                //Descend table
                //descendTable[0].depth = 1.5;
                //descendTable[0].PV = -0.05;
                //descendTable[0].parkTime = new TimeSpan(0, 0, 0, 0);

                descendTable[0].depth = 2.0;
                descendTable[0].PV = -0.05;
                descendTable[0].parkTime = new TimeSpan(0, 0, 3, 0);
            }
            else
            {
                //Ascend table
                ascendTable[0].depth = 4.0;
                ascendTable[0].PV = 0.05;
                ascendTable[0].parkTime = new TimeSpan(0, 0, 0, 0);         //days, hours, minutes, seconds

                ascendTable[1].depth = 2.0;
                ascendTable[1].PV = 0.05;
                ascendTable[1].parkTime = new TimeSpan(0, 0, 5, 0);

                // The last entry in the Ascend table must have a depth of 0.0
                // When the mission hits the last entry in the ascend table, it goes to the surface at this PV rate
                // The park time value don't matter, 
                ascendTable[2].depth = 0.0;
                ascendTable[2].PV = 0.2;
                ascendTable[2].parkTime = new TimeSpan(0, 0, 0, 0);

                //Descend table
                //descendTable[0].depth = 2.5;
                //descendTable[0].PV = -0.05;
                //descendTable[0].parkTime = new TimeSpan(0, 0, 0, 0);

                descendTable[0].depth = 5.0;
                descendTable[0].PV = -0.05;
                descendTable[0].parkTime = new TimeSpan(0, 0, 10, 0);
            }
        }
    }
}
