NI-DAQmx .NET Framework 4.0 API Reference

Table of Contents

DaqStream Class

  • Updated2023-02-21
  • 17 minute(s) read
DaqStream Class
Exposes a data stream on a Task that can be used to control reading and writing behavior and can be used in conjunction with reader and writer classes to read or write samples to or from an NI-DAQmx task.

Inheritance Hierarchy

SystemObject
  SystemMarshalByRefObject
    NationalInstruments.DAQmxDaqStream

Namespace:  NationalInstruments.DAQmx
Assembly:  NationalInstruments.DAQmx (in NationalInstruments.DAQmx.dll) Version: 20.7.40.49302

Syntax

public class DaqStream : MarshalByRefObject, IFilteredTypeDescriptor
Public Class DaqStream
	Inherits MarshalByRefObject
	Implements IFilteredTypeDescriptor

The DaqStream type exposes the following members.

Properties

  NameDescription
Public propertyAccessoryInsertionOrRemovalDetected
Indicates if any device(s) in the task detected the insertion or removal of an accessory since the task started. Reading this property clears the accessory change status for all channels in the task. You must read this property before you read DevicesWithInsertedOrRemovedAccessories. Otherwise, you will receive an error.
Public propertyAvailableSamplesPerChannel
Indicates the number of samples available to read per channel. This value is the same for all channels in the task.
Public propertyBuffer
Gets the buffer for the task.
Public propertyChannelsToRead
Sets a subset of channels in the task from which to read.
Public propertyCommonModeRangeErrorChannels
Indicates a list of names of any virtual channels in the task for which the device(s) detected a common mode range violation. You must read CommonModeRangeErrorChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyCommonModeRangeErrorChannelsExist
Indicates if the device(s) detected a common mode range violation for any virtual channel in the task. Common mode range violation occurs when the voltage of either the positive terminal or negative terminal to ground are out of range. Reading this property clears the common mode range violation status for all channels in the task. You must read this property before you read CommonModeRangeErrorChannels. Otherwise, you will receive an error.
Public propertyCurrentReadPosition
Indicates in samples per channel the current position in the buffer.
Public propertyCurrentWritePosition
Indicates the position in the buffer of the next sample to generate. This value is identical for all channels in the task.
Public propertyDevicesWithInsertedOrRemovedAccessories
Indicates the names of any devices that detected the insertion or removal of an accessory since the task started. You must read AccessoryInsertionOrRemovalDetected before you read this property. Otherwise, you will receive an error.
Public propertyDigitalLinesPerInputChannel
Indicates the number of lines per channel that NI-DAQmx returns in a sample for line-based reads. If a channel has fewer lines than this number, the extra lines are .
Public propertyDigitalLinesPerOutputChannel
Indicates the number of Boolean values expected per channel in a sample for line-based writes. This property is determined by the channel in the task with the most digital lines. If a channel has fewer lines than this number, NI-DAQmx ignores the extra Boolean values.
Public propertyLoggingFilePath
Specifies the path to the TDMS file to which you want to log data. If the file path is changed while the task is running, this takes effect on the next sample interval (if Logging.SampsPerFile has been set) or when DAQmx Start New File is called. New file paths can be specified by ending with "\" or "/". Files created after specifying a new file path retain the same name and numbering sequence.
Public propertyLoggingFilePreallocationSize
Specifies a size in samples to be used to pre-allocate space on disk. Pre-allocation can improve file I/O performance, especially in situations where multiple files are being written to disk. For finite tasks, the default behavior is to pre-allocate the file based on the number of samples you configure the task to acquire.
Public propertyLoggingFileWriteSize
Specifies the size, in samples, in which data will be written to disk. The size must be evenly divisible by the volume sector size, in bytes.
Public propertyLoggingMode
Specifies whether to enable logging and whether to allow reading data while logging. Log mode allows for the best performance. However, you cannot read data while logging if you specify this mode. If you want to read data while logging, specify Log and Read mode.
Public propertyLoggingPause
Specifies whether logging is paused while a task is executing. If LoggingMode is set to Log and Read mode, this value is taken into consideration on the next call to DAQmx Read, where data is written to disk. If LoggingMode is set to Log Only mode, this value is taken into consideration the next time that data is written to disk. A new TDMS group is written when logging is resumed from a paused state.
Public propertyLoggingSamplesPerFile
Specifies how many samples to write to each file. When the file reaches the number of samples specified, a new file is created with the naming convention of <filename>_####.tdms, where #### starts at 0001 and increments automatically with each new file. For example, if the file specified is C:\data.tdms, the next file name used is C:\data_0001.tdms. To disable file spanning behavior, set this attribute to 0. If LoggingFilePath is changed while this attribute is set, the new file path takes effect on the next file created.
Public propertyNumberOfInputChannels
Indicates the number of channels that reading from the task reads from the task. This value is the number of channels in the task or the number of channels you specify with ChannelsToRead.
Public propertyNumberOfOutputChannels
Indicates the number of channels that writing to the task writes to the task. This value is the number of channels in the task.
Public propertyOpenThermocoupleChannels
Indicates a list of names of any virtual channels in the task for which the device(s) detected an open thermcouple. You must read OpenThermocoupleChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyOpenThermocoupleChannelsExist
Indicates if the device(s) detected an open thermocouple connected to any virtual channel in the task. Reading this property clears the open thermocouple status for all channels in the task. You must read this property before you read OpenThermocoupleChannels. Otherwise, you will receive an error.
Public propertyOutputBufferSpaceAvailable
Indicates in samples per channel the amount of available space in the buffer.
Public propertyOverloadedInputChannels
Indicates a list of names of any overloaded virtual channels in the task. You must read OverloadedInputChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyOverloadedInputChannelsExist
Indicates if the device(s) detected an overload in any virtual channel in the task. Reading this property clears the overload status for all channels in the task. You must read this property before you read OverloadedInputChannels. Otherwise, you will receive an error.
Public propertyPhaseLockedLoopUnlockedChannels
Indicates the channels that had their PLLs unlock.
Public propertyPhaseLockedLoopUnlockedChannelsExist
Indicates whether the PLL is currently locked, or whether it became unlocked during the previous acquisition. Devices may report PLL Unlock either during acquisition or after acquisition.
Public propertyReadAllAvailableSamples
Specifies whether subsequent read operations read all samples currently available in the buffer or wait for the buffer to become full before reading. NI-DAQmx uses this setting for finite acquisitions and only when the number of samples to read is -1. For continuous acquisitions when the number of samples to read is -1, a read operation always reads all samples currently available in the buffer.
Public propertyReadAutoStart
Specifies if reading from the task automatically starts the task if you did not start the task explicitly by using starting the task. The default value is . When reading from the task starts a finite acquisition task, it also stops the task after reading the last sample.
Public propertyReadExcitationFaultChannels
Indicates a list of names of any virtual channels in the task for which the device(s) detected an excitation fault condition. You must read ReadExcitationFaultChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyReadExcitationFaultChannelsExist
Indicates if the device(s) detected an excitation fault condition for any virtual channel in the task. Reading this property clears the excitation fault status for all channels in the task. You must read this property before you read ReadExcitationFaultChannels. Otherwise, you will receive an error.
Public propertyReadInputLimitsFaultChannels
Indicates the virtual channels that have detected samples outside the upper or lower limits configured for each channel in the task. You must read ReadInputLimitsFaultChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyReadInputLimitsFaultChannelsExist
Indicates if the device or devices detected a sample that was outside the upper or lower limits configured for each channel in the task. Reading this property clears the input limits fault channel status for all channels in the task. You must read this property before you read ReadInputLimitsFaultChannels. Otherwise, you will receive an error. Note: Fault detection applies to both positive and negative inputs. For instance, if you specify a lower limit of 2 mA and an upper limit of 12 mA, NI-DAQmx detects a fault at 15 mA and -15 mA, but not at -6 mA because it is in the range of -12 mA to -2 mA.
Public propertyReadOffset
Specifies an offset in samples per channel at which to begin a read operation. This offset is relative to the location you specify with ReadRelativeTo.
Public propertyReadOpenCurrentLoopChannels
Indicates a list of names of any virtual channels in the task for which the device(s) detected an open current loop. You must read ReadOpenCurrentLoopChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyReadOpenCurrentLoopChannelsExist
Indicates if the device(s) detected an open current loop for any virtual channel in the task. Reading this property clears the open current loop status for all channels in the task. You must read this property before you read ReadOpenCurrentLoopChannels. Otherwise, you will receive an error.
Public propertyReadOvercurrentChannels
Indicates a list of names of any virtual channels in the task for which the device(s) detected an overcurrent condition. You must read ReadOvercurrentChannelsExist before you read this property. Otherwise, you will receive an error. On some devices, you must restart the task for all overcurrent channels to recover.
Public propertyReadOvercurrentChannelsExist
Indicates if the device(s) detected an overcurrent condition for any virtual channel in the task. Reading this property clears the overcurrent status for all channels in the task. You must read this property before you read ReadOvercurrentChannels. Otherwise, you will receive an error.
Public propertyReadOvertemperatureChannels
Indicates a list of names of any overtemperature virtual channels. You must read ReadOvertemperatureChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyReadOvertemperatureChannelsExist
Indicates if the device(s) detected an overtemperature condition in any virtual channel in the task. Reading this property clears the overtemperature status for all channels in the task. You must read this property before you read ReadOvertemperatureChannels. Otherwise, you will receive an error.
Public propertyReadOverwriteMode
Specifies whether to overwrite samples in the buffer that you have not yet read.
Public propertyReadPowerSupplyFaultChannels
Indicates the virtual channels that have detected a power supply fault. You must read WritePowerSupplyFaultChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyReadPowerSupplyFaultChannelsExist
Indicates if the device or devices detected a power supply fault condition in any virtual channel in the task. Reading this property clears the power supply fault status for all channels in this task. You must read this property before you read ReadPowerSupplyFaultChannels. Otherwise, you will receive an error.
Public propertyReadRawDataWidth
Indicates in bytes the size of a raw sample from the task.
Public propertyReadRelativeTo
Specifies the point in the buffer at which to begin a read operation. If you also specify an offset with ReadOffset, the read operation begins at that offset relative to the point you select with this property. The default value is CurrentReadPosition unless you configure a Reference Trigger for the task. If you configure a Reference Trigger, the default value is FirstPretriggerSample.
Public propertyReadSleepTime
Specifies in seconds the amount of time to sleep after checking for available samples if ReadWaitMode is Sleep.
Public propertyReadSynchronizationUnlockedChannels
Indicates the channels from devices in an unlocked target.
Public propertyReadSynchronizationUnlockedChannelsExist
Indicates whether the target is currently locked to the grand master. Devices may report PLL Unlock either during acquisition or after acquisition.
Public propertyReadWaitMode
Specifies how reading from the task waits for samples to become available.
Public propertyTdmsLoggingGroupName
Specifies the name of the group to create within the TDMS file for data from this task. If you append data to an existing file and the specified group already exists, NI-DAQmx appends a number symbol and a number to the group name, incrementing that number until finding a group name that does not exist. For example, if you specify a group name of Voltage Task, and that group already exists, NI-DAQmx assigns the group name Voltage Task #1, then Voltage Task #2.
Public propertyTdmsLoggingOperation
Specifies how to open the TDMS file.
Public propertyTimeout
Gets or sets the amount of time in milliseconds to wait for reads or writes to complete.
Public propertyTotalSamplesAcquiredPerChannel
Indicates the total number of samples acquired by each channel. NI-DAQmx returns a single value because this value is the same for all channels. For retriggered acquisitions, this value is the cumulative number of samples across all retriggered acquisitions.
Public propertyTotalSamplesGeneratedPerChannel
Indicates the total number of samples generated by each channel in the task. This value is identical for all channels in the task.
Public propertyWaveformAttributeMode
Gets or sets the type of information returned from a waveform read.
Public propertyWriteExternalOvervoltageChannels
Indicates a list of names of any virtual channels in the task for which an External Overvoltage condition has been detected. You must read External OvervoltageChansExist before you read this property. Otherwise, you will receive an error.
Public propertyWriteExternalOvervoltageChannelsExist
Indicates if the device(s) detected an External Overvoltage condition for any channel in the task. Reading this property clears the External Overvoltage status for all channels in the task. You must read this property before you read External OvervoltageChans. Otherwise, you will receive an error.
Public propertyWriteOffset
Specifies in samples per channel an offset at which a write operation begins. This offset is relative to the location you specify with WriteRelativeTo.
Public propertyWriteOpenCurrentLoopChannels
Indicates a list of names of any virtual channels in the task for which the device(s) detected an open current loop. You must read WriteOpenCurrentLoopChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyWriteOpenCurrentLoopChannelsExist
Indicates if the device(s) detected an open current loop for any channel in the task. Reading this property clears the open current loop status for all channels in the task. You must read this property before you read WriteOpenCurrentLoopChannels. Otherwise, you will receive an error.
Public propertyWriteOvercurrentChannels
Indicates a list of names of any virtual channels in the task for which an overcurrent condition has been detected. You must read WriteOvercurrentChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyWriteOvercurrentChannelsExist
Indicates if the device(s) detected an overcurrent condition for any channel in the task. Reading this property clears the overcurrent status for all channels in the task. You must read this property before you read WriteOvercurrentChannels. Otherwise, you will receive an error.
Public propertyWriteOverloadedChannels
Indicates a list of names of any overloaded virtual channels in the task. You must read WriteOverloadedChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyWriteOverloadedChannelsExist
Indicates if the device(s) detected an overload in any virtual channel in the task. Reading this property clears the overload status for all channels in the task. You must read this property before you read WriteOverloadedChannels. Otherwise, you will receive an error.
Public propertyWriteOvertemperatureChannels
Indicates a list of names of any overtemperature virtual channels. You must read WriteOvertemperatureChannelsExist before you read this property. Otherwise, you will receive an error. The list of names may be empty if the device cannot determine the source of the overtemperature.
Public propertyWriteOvertemperatureChannelsExist
Indicates if the device(s) detected an overtemperature condition in any virtual channel in the task. Reading this property clears the overtemperature status for all channels in the task. You must read this property before you read WriteOvertemperatureChannels. Otherwise, you will receive an error.
Public propertyWritePowerSupplyFaultChannels
Indicates a list of names of any virtual channels in the task that have a power supply fault. You must read WritePowerSupplyFaultChannelsExist before you read this property. Otherwise, you will receive an error.
Public propertyWritePowerSupplyFaultChannelsExist
Indicates if the device(s) detected a power supply fault for any channel in the task. Reading this property clears the power supply fault status for all channels in the task. You must read this property before you read WritePowerSupplyFaultChannels. Otherwise, you will receive an error.
Public propertyWriteRawDataWidth
Indicates in bytes the required size of a raw sample to write to the task.
Public propertyWriteRegenerationMode
Specifies whether to allow NI-DAQmx to generate the same data multiple times.
Public propertyWriteRelativeTo
Specifies the point in the buffer at which to write data. If you also specify an offset with WriteOffset, the write operation begins at that offset relative to this point you select with this property.
Public propertyWriteSleepTime
Specifies in seconds the amount of time to sleep after checking for available buffer space if WriteWaitMode is Sleep.
Public propertyWriteSynchronizationUnlockedChannels
Indicates the channels from devices in an unlocked target.
Public propertyWriteSynchronizationUnlockedChannelsExist
Indicates whether the target is currently locked to the grand master. Devices may report PLL Unlock either during acquisition or after acquisition.
Public propertyWriteWaitMode
Specifies how writing to the task waits for space to become available in the buffer.
Top

Methods

  NameDescription
Public methodConfigureInputBuffer
Overrides the automatic input buffer allocation that NI-DAQmx performs.
Public methodConfigureOutputBuffer
Overrides the automatic output buffer allocation that NI-DAQmx performs.
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Public methodReadRaw
Reads raw, unprocessed samples from the channels in the task.
Public methodToString
Returns a string representation of the object.
(Overrides ObjectToString.)
Public methodWriteRaw
Writes raw, unprocessed samples to the channels in the task.
Top

Remarks

Tip Tip
Example applications are located in the Public Documents\National Instruments\NI-DAQ\Examples\DotNET4.x directory or in the Start menu at National InstrumentsNI-DAQmxNI-DAQmx Examples.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Log in to get a better experience