/// <summary> /// Initialize a new instance of the structure. Copies the specified parameters to the structure and creates the auto-scale limits from the specified watch data /// frames. /// </summary> /// <param name="header">The file header information.</param> /// <param name="dataStream">The data stream.</param> public WatchFile_t(Header_t header, DataStream_t dataStream) { Header = header; DataStream = dataStream; Filename = string.Empty; FullFilename = string.Empty; }
/// <summary> /// Get the fault log/snapshot log data stream corresponding to the specified record. /// </summary> /// <param name="eventRecord">The event record associated with the data stream that is to be downloaded.</param> /// <returns>The data stream corresponding to the specified event record.</returns> /// <exception cref="CommunicationException">Thrown if the error code returned from the calls to the PTUDLL32.GetStreamInformation() or PTUDLL32Event.GetStream() /// methods is not CommunicationError.Success.</exception> public DataStream_t GetStream(EventRecord eventRecord) { short watchVariableCount, sampleCount, sampleMultiple; short[] watchIdentifiers, dataTypes; GetStreamInformation(0, out watchVariableCount, out sampleCount, out sampleMultiple, out watchIdentifiers, out dataTypes); int[] buffer = new int[sampleCount * watchVariableCount]; // Default values are all zeroes. // Not used by the calling class. // short timeOrigin = 0; Workset_t workset = ConvertToWorkset(eventRecord.Description, watchIdentifiers, sampleMultiple); DataStream_t dataStream = new DataStream_t(eventRecord, watchVariableCount, sampleCount, sampleMultiple, workset); DateTime startTime = eventRecord.DateTime.Subtract(new TimeSpan(0, 0, 0, 0, dataStream.DurationPreTripMs)); // Convert the retrieved data stream into a list of individual, time-stamped watch variable data frames. List <WatchFrame_t> watchFrameList = ConvertToWatchFrameList(startTime, sampleCount, dataStream.FrameIntervalMs, buffer, dataTypes, workset); dataStream.WatchFrameList = watchFrameList; // Configure the upper and lower display limits. dataStream.ConfigureAutoScale(); #if NODELAY #else // Include a delay to provide verisimilitude. System.Threading.Thread.Sleep(SleepMsVerisimilitudeGetStream); #endif return(dataStream); }