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.

Derives from

Syntax

Namespace: NationalInstruments.DAQmx

public class DaqStream : MarshalByRefObject, IFilteredTypeDescriptor

Remarks

Note

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

Thread Safety

All members of this type are safe for multithreaded operations.

Properties

NameDescription
AccessoryInsertionOrRemovalDetected

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.

AvailableSamplesPerChannel

Indicates the number of samples available to read per channel. This value is the same for all channels in the task.

Buffer

Gets the buffer for the task.

ChannelsToRead

Sets a subset of channels in the task from which to read.

CommonModeRangeErrorChannels

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.

CommonModeRangeErrorChannelsExist

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.

CurrentReadPosition

Indicates in samples per channel the current position in the buffer.

CurrentWritePosition

Indicates the position in the buffer of the next sample to generate. This value is identical for all channels in the task.

DevicesWithInsertedOrRemovedAccessories

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.

DigitalLinesPerInputChannel

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 false.

DigitalLinesPerOutputChannel

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.

LoggingFilePath

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.

LoggingFilePreallocationSize

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.

LoggingFileWriteSize

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.

LoggingMode

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.

LoggingPause

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.

LoggingSamplesPerFile

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.

NumberOfInputChannels

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.

NumberOfOutputChannels

Indicates the number of channels that writing to the task writes to the task. This value is the number of channels in the task.

OpenThermocoupleChannels

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.

OpenThermocoupleChannelsExist

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.

OutputBufferSpaceAvailable

Indicates in samples per channel the amount of available space in the buffer.

OverloadedInputChannels

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.

OverloadedInputChannelsExist

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.

PhaseLockedLoopUnlockedChannels

Indicates the channels that had their PLLs unlock.

PhaseLockedLoopUnlockedChannelsExist

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.

ReadAllAvailableSamples

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.

ReadAutoStart

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 true. When reading from the task starts a finite acquisition task, it also stops the task after reading the last sample.

ReadAuxPowerErrorChannels

Indicates a list of names of any virtual channels in the task for which an auxiliary power supply error condition has been detected. You must read the Aux Power Error Channels Exist property before you read this property. Otherwise, you will receive an error.

ReadAuxPowerErrorChannelsExist

Indicates if the device(s) detected an auxiliary power supply error condition for any channel in the task. Reading this property clears the error condition status for all channels in the task. You must read this property before you read the Aux Power Error Channels property. Otherwise, you will receive an error.

ReadExcitationFaultChannels

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.

ReadExcitationFaultChannelsExist

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.

ReadInputLimitsFaultChannels

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.

ReadInputLimitsFaultChannelsExist

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.

ReadOffset

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.

ReadOpenCurrentLoopChannels

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.

ReadOpenCurrentLoopChannelsExist

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.

ReadOvercurrentChannels

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.

ReadOvercurrentChannelsExist

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.

ReadOvertemperatureChannels

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.

ReadOvertemperatureChannelsExist

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.

ReadOverwriteMode

Specifies whether to overwrite samples in the buffer that you have not yet read.

ReadPowerSupplyFaultChannels

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.

ReadPowerSupplyFaultChannelsExist

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.

ReadRawDataWidth

Indicates in bytes the size of a raw sample from the task.

ReadRelativeTo

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.

ReadRemoteSenseErrorChannels

Indicates a list of names of any virtual channels in the task for which a remote sense connection error condition has been detected. You must read Remote Sense Error Channels Exist before you read this property. Otherwise, you will receive an error.

ReadRemoteSenseErrorChannelsExist

Indicates if the device(s) detected an error condition of the remote sense connection for any channel in the task. You must disable the output and resolve the hardware connection issue to clear the error condition. You must read this property before you read the Remote Sense Error Channels property. Otherwise, you will receive an error.

ReadReverseVoltageErrorChannels

Indicates a list of names of all virtual channels in the task for which reverse voltage error condition has been detected. You must read the Reverse Voltage Error Channels Exist property before you read this property. Otherwise, you will receive an error.

ReadReverseVoltageErrorChannelsExist

Indicates if the device(s) detected reverse voltage error for any of the channels in the task. Reverse voltage error occurs if the local voltage is equal to the negative saturated voltage. Reading this property clears the error condition status for all channels in the task. You must read this property before you read the Reverse Voltage Error Channels property. Otherwise, you will receive an error.

ReadSleepTime

Specifies in seconds the amount of time to sleep after checking for available samples if ReadWaitMode is Sleep.

ReadSynchronizationUnlockedChannels

Indicates the channels from devices in an unlocked target.

ReadSynchronizationUnlockedChannelsExist

Indicates whether the target is currently locked to the grand master. Devices may report PLL Unlock either during acquisition or after acquisition.

ReadWaitMode

Specifies how reading from the task waits for samples to become available.

TdmsLoggingGroupName

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.

TdmsLoggingOperation

Specifies how to open the TDMS file.

Timeout

Gets or sets the amount of time in milliseconds to wait for reads or writes to complete.

TotalSamplesAcquiredPerChannel

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.

TotalSamplesGeneratedPerChannel

Indicates the total number of samples generated by each channel in the task. This value is identical for all channels in the task.

WaveformAttributeMode

Gets or sets the type of information returned from a waveform read.

WriteExternalOvervoltageChannels

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.

WriteExternalOvervoltageChannelsExist

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.

WriteOffset

Specifies in samples per channel an offset at which a write operation begins. This offset is relative to the location you specify with WriteRelativeTo.

WriteOpenCurrentLoopChannels

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.

WriteOpenCurrentLoopChannelsExist

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.

WriteOvercurrentChannels

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.

WriteOvercurrentChannelsExist

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.

WriteOverloadedChannels

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.

WriteOverloadedChannelsExist

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.

WriteOvertemperatureChannels

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.

WriteOvertemperatureChannelsExist

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.

WritePowerSupplyFaultChannels

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.

WritePowerSupplyFaultChannelsExist

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.

WriteRawDataWidth

Indicates in bytes the required size of a raw sample to write to the task.

WriteRegenerationMode

Specifies whether to allow NI-DAQmx to generate the same data multiple times.

WriteRelativeTo

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.

WriteSleepTime

Specifies in seconds the amount of time to sleep after checking for available buffer space if WriteWaitMode is Sleep.

WriteSynchronizationUnlockedChannels

Indicates the channels from devices in an unlocked target.

WriteSynchronizationUnlockedChannelsExist

Indicates whether the target is currently locked to the grand master. Devices may report PLL Unlock either during acquisition or after acquisition.

WriteWaitMode

Specifies how writing to the task waits for space to become available in the buffer.

Methods

NameDescription
ConfigureInputBuffer(long)

Overrides the automatic input buffer allocation that NI-DAQmx performs.

ConfigureOutputBuffer(long)

Overrides the automatic output buffer allocation that NI-DAQmx performs.

ReadRaw(int)

Reads raw, unprocessed samples from the channels in the task.

ToString()

Returns a string representation of the object.

WriteRaw(bool, byte[])

Writes raw, unprocessed samples to the channels in the task.

See Also