public List <double> GetStoredData() { try { if (controllerMode == ControllerMode.CommMode) { SetGeneralMode(); } var storeStats = new DataStorageStats(); StorageStatus currentStatus = StorageStatus.StorageActive; while (currentStatus == StorageStatus.StorageActive) { storeStats = GetStorageStatus(); currentStatus = storeStats.StorageStatus; } string dataOut = Write(dataStoreOut, 100); Write(dataStoreStop, 100); var stringList = GetData(dataOut); var outputList = new List <double>(); foreach (int ptCt in storeStats.StoredDataCount) { outputList.Add((double)ptCt); } for (int i = 0; i < stringList.Count; i++) { double result = 0; if (double.TryParse(stringList[i], out result)) { outputList.Add(result); } } return(outputList); } catch (Exception) { throw; } }
public DataStorageStats GetStorageStatus() { try { string data = Write("AN", 100); var words = data.Split(','); var status = (StorageStatus)Enum.Parse(typeof(StorageStatus), words[1]); var pointCountList = new List <int>(); for (int i = 2; i < words.Length; i++) { int pc = int.Parse(words[i]); pointCountList.Add(pc); } var dss = new DataStorageStats(); dss.StorageStatus = status; dss.StoredDataCount = pointCountList.ToArray(); return(dss); } catch (Exception) { throw; } }