/// <summary> /// For testing purposes /// </summary> /// <param name="UPByte"></param> /// <param name="FHRByte"></param> public void ProcessPatterns(List <byte> UPSubList, List <byte> FHRSubList, DateTime startTime, DateTime lastDetectedEnd) { var newBlock = new TracingBlock() { HRs = FHRSubList, UPs = UPSubList, Start = startTime }; Tracings.HRs = FHRSubList; Tracings.UPs = UPSubList; Tracings.Start = startTime; var FHRs = Tracings.HRs.ToArray(); var UPs = Tracings.UPs.ToArray(); ProcessPatterns(UPs, FHRs); }
/// <summary> /// Process file and put items in queue /// </summary> private void ReadTracing(string filename) { // Reset current data this.TracingData = null; // Disable controls... this.Enabled = false; this.Cursor = Cursors.WaitCursor; try { // Make sure there is a filename... if (string.IsNullOrEmpty(filename)) { throw new Exception("No file selected"); } // Read the file and merge blocks to improve detection performances var block = TracingBlock.Merge(TracingFileReader.Read(filename), 3600).LastOrDefault(); if ((block == null) || (block.TotalSeconds == 0)) { throw new Exception("Invalid or empty tracing file!"); } // Make sure UP & HR are the exact same length block.AlignSignals(); // Position the time cursor to present time minus requested history tracing this.TracingData = block; // File opened... txtFile.Text = filename; } catch (Exception ex) { this.TracingData = null; // Error processing, message and clean MessageBox.Show(this, string.Format("Error: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } finally { this.Enabled = true; this.Cursor = Cursors.Default; } }
private void Init() { lock (s_mainLockObject) { Tracings = new TracingBlock(); LastRequest = DateTime.Now; LastResultRequest = DateTime.Now; Results = new List <DetectionArtifact>(); for (int i = 0; i < 15 && Engine == null; i++) { Engine = new PatternsProcessorWrapper(GUID, DateTime.Now); } StartTime = DateTime.MinValue; EndTimeOfPreviousTracings = DateTime.MinValue; Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Patterns Session Data, Init", "Session created"); } }
public static void RemoveCalculatedTracings(this TracingBlock tracings, DateTime newStartTime) { var seconds = Math.Max(0, (newStartTime - tracings.Start).TotalSeconds); tracings.RemoveCalculatedTracings((int)seconds); }
public static void RemoveCalculatedTracings(this TracingBlock tracings, int seconds) { tracings.UPs.RemoveRange(0, seconds); tracings.HRs.RemoveRange(0, seconds * 4); tracings.Start = tracings.Start.AddSeconds(seconds); }