using System; using System.Text; namespace SWModules { public enum CPFStates : int { 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 RecoveryMode { get; set; } public static int ProfileNum { get; set; } 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; } //flag to allow checkStuckPressure test to be performed //TODO P2 probably more robust to get rid of flag and check inside the checkStruckPressure method or checkGlobalEvents, where checkStuckPressure is checked, when it should actually run public static bool CheckStuckPressure { 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 UploadLastEngrFile { 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 ForceRecoveryMode { 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; } //TODO P3 probably should check that all these variables really should be state variables static SV() { RunPVPID = false; SurfaceOpsGo = false; RecoveryMode = true; ProfileNum = -1; MaxProfiles = 1; Pressure = double.NaN; PressureTimeStamp = new DateTime(); PressureTableNum = -1; CheckStuckPressure = false; DoStateEntry = true; BellowsAtUpperLimit = false; BellowsAtLowerLimit = false; BellowsPosition = double.NaN; UploadEngrFile = false; UploadLastEngrFile = false; InCPMode = false; SamplePH = false; SampleN3 = false; SamplePHandN3 = false; MissionTimedOut = false; ForceRecoveryMode = false; FailedInitialization = false; busVoltage = double.NaN; canPressure = double.NaN; canHumidity = double.NaN; } public static bool FailedInitialization { get; set; } public static DateTime MissionStartTime { get; set; } public static double CtdSamplePeriod { get; set; } } }