/// <summary> /// Reads the given input stream, asynchronously (in the ITC sense, not the .Net sense). Should not be called while /// Running. /// </summary> /// <remarks>All output streams are automatically set to their associated ExternalDevice's Background value on stop</remarks> /// <param name="daqInputStream">IDAQInputStream to read</param> /// <returns>IInputData with a single read sample</returns> /// <exception cref="ArgumentException">If the given stream is not an input stream belonging to this HekaDAQController</exception>" public IInputData ReadStreamAsyncIO(IDAQInputStream daqInputStream) { if (!InputStreams.Contains(daqInputStream)) { throw new ArgumentException("Input stream is not present on this device.", "daqInputStream"); } var instream = daqInputStream as HekaDAQInputStream; if (instream != null) { return(Device.ReadStreamAsyncIO(instream)); } return(null); }
internal void InitializeStreams() { logService.Write(InputStreams.Count > 0 ? LogEntryType.Info : LogEntryType.Warning, "Found {0} input stream{1}...", InputStreams.Count, InputStreams.Count == 1 ? "" : "s"); // iterate from the back to be able to remove a stream if it fails to initialize for (int i = InputStreams.Count - 1; i >= 0; i--) { try { InputStreams[i].Initialize(streamService); logService.Write("'{0}' initialized", InputStreams[i].Name); } catch (Exception ex) { logService.Write(LogEntryType.Error, "Initializing input stream '{0}' failed: {1}", InputStreams[i].Name, ex.Message); InputStreams.Remove(InputStreams[i]); } } // order by name InputStreams = InputStreams.OrderBy(i => i.Name).ToList(); }