public List <MyoData> SyncCollectedData(DataCollector input) { List <MyoData> output = new List <MyoData>(); DateTime baseTime; foreach (AccelerometerDataEventArgs baseData in input.accelerometerData) { baseTime = baseData.Timestamp; for (int i = 0; i < 100; i++) { if (MDSA.isEMGexists(input, baseTime, i)) { if (!output.Any(x => x.Time_stamp == baseTime.AddMilliseconds(i))) { MyoData data = MDSA.buildRecordUsing(input, baseTime, baseTime.AddMilliseconds(i)); output.Add(data); break; } else { break; } } else if (MDSA.isEMGexists(input, baseTime, i * -1)) { if (!output.Any(x => x.Time_stamp == baseTime.AddMilliseconds(i * -1))) { MyoData data = MDSA.buildRecordUsing(input, baseTime, baseTime.AddMilliseconds(i * -1)); output.Add(data); break; } else { break; } } } } return(output); }
public bool isEMGexists(DataCollector input, DateTime baseTime, int msOffset) { return(input.emgData.Any(x => x.Timestamp == baseTime.AddMilliseconds(msOffset))); }