using System; using System.IO; using System.Text; using GHI.Processor; using Microsoft.SPOT; namespace SWModules { public enum CPFStates : ushort { SMNotRunning = 1, initMission, initProfile, descend, ascend, surfaceOpsSetBellows, surfaceOps, preMissionDelay, dumpCPData, ABDecBuocyFast, ABDecBuocySlow, park, anchor, deAnchor, startCP, recovery, exit, cpfStatesLength } public struct SV { public static CPFStates CurrentState { get; set; } public static StringBuilder CurrentStateName { get; set; } public static CPFStates PastState { get; set; } public static CPFStates NextState { get; set; } public static bool RunPVPID { get; set; } public static bool SurfaceOpsGo { get; set; } public static bool ManualProfileMode { get; set; } public static int ProfileNum { get; set; } public static readonly string FloatID = "CPF001"; public static int MaxProfiles { get; set; } public static double Pressure { get; set; } public static DateTime PressureTimeStamp { get; set; } //TODO P0: Need to make sure this can never return an index out of range. //Maybe need explicit descend and ascend pressureTableNum with error checking in the get property public static int PressureTableNum { get; set; } //state entry flag public static bool DoStateEntry { get; set; } public static bool BellowsAtUpperLimit { get; set; } public static bool BellowsAtLowerLimit { get; set; } public static double BellowsPosition { get; set; } public static bool UploadEngrFile { get; set; } public static bool InCPMode { get; set; } public static bool SamplePH { get; set; } public static bool SampleN3 { get; set; } //public static bool SamplePHandN3 { get; set; } public static bool MissionTimedOut { get; set; } public static TimeSpan MissionTimeoutTS { get; set; } public static bool ForceRecoveryState { get; set; } public static StringBuilder ForceRecoveryReason { get; set; } public static double PVSetPoint { get; set; } public static double canPressure { get; set; } public static double canHumidity { get; set; } public static double busVoltage { get; set; } public static double busAmps { get; set; } public static double pumpVoltage { get; set; } public static double pumpAmps { get; set; } public static bool devMode { get; set; } //TODO P3 probably should check that all these variables really should be state variables static SV() { RunPVPID = false; SurfaceOpsGo = false; ManualProfileMode = true; ProfileNum = 0; MaxProfiles = 1; Pressure = double.NaN; PressureTimeStamp = new DateTime(); PressureTableNum = -1; DoStateEntry = true; BellowsAtUpperLimit = false; BellowsAtLowerLimit = false; BellowsPosition = double.NaN; UploadEngrFile = false; InCPMode = false; SamplePH = false; SampleN3 = false; //SamplePHandN3 = false; MissionTimedOut = false; ForceRecoveryState = false; ForceRecoveryReason = new StringBuilder("no reason"); FailedInitialization = false; busVoltage = double.NaN; busAmps = double.NaN; pumpVoltage = double.NaN; pumpAmps = double.NaN; canPressure = double.NaN; canHumidity = double.NaN; devMode = true; } public static bool FailedInitialization { get; set; } public static DateTime MissionStartTime { get; set; } } }