private SerializableTimeSeriesData ReadCurrentTimeSeriesData(string fromID, string toID) { try { // Abort if services is not enabled. if (!Enabled) return null; // Ensure that data archive is available. if (Archive == null) throw new ArgumentNullException("Archive"); // Read current time-series data from the archive. byte[] buffer = null; StateRecord state = null; SerializableTimeSeriesData data = new SerializableTimeSeriesData(); List<SerializableTimeSeriesDataPoint> points = new List<SerializableTimeSeriesDataPoint>(); for (int id = int.Parse(fromID); id <= int.Parse(toID); id++) { buffer = Archive.ReadStateData(id); if (buffer == null) { // ID is invalid. continue; } else { // Add to resultset. state = new StateRecord(id, buffer, 0, buffer.Length); points.Add(new SerializableTimeSeriesDataPoint(state.CurrentData)); } } data.TimeSeriesDataPoints = points.ToArray(); return data; } catch (Exception ex) { // Notify about the encountered processing exception. OnServiceProcessException(ex); throw; } }
/// <summary> /// Raises the <see cref="ProcessAlarmNotification"/> event. /// </summary> /// <param name="pointState"><see cref="StateRecord"/> to send to <see cref="ProcessAlarmNotification"/> event.</param> protected virtual void OnProcessAlarmNotification(StateRecord pointState) { if (ProcessAlarmNotification != null) ProcessAlarmNotification(this, new EventArgs<StateRecord>(pointState)); }
/// <summary> /// Initializes a new instance of the <see cref="StateRecordSummary"/> class. /// </summary> /// <param name="record">A <see cref="StateRecord"/> object.</param> public StateRecordSummary(StateRecord record) { HistorianID = record.HistorianID; CurrentData = record.CurrentData; }