Skip to content

Make array_size_in_samps / array_size_in_bytes optional for DAQmx Read RPCs #1224

@bkeryan

Description

@bkeryan

array_size_in_(samps|bytes) is an artifact of the DAQmx C API's memory allocation strategy and does not exist in any other DAQmx API implementation (LabVIEW, .NET, Python). If this parameter was optional and grpc-device calculated the required buffer size automatically, it could simplify some use cases and/or prevent the need to make additional RPCs to query the number of channels, default samples to read, etc.

Here's how that could work for ReadAnalogF64:

  • If you specify array_size_in_samps, then grpc-device passes that to the C API and everything works like today.
  • If you don't specify array_size_in_samps, then grpc-device calculates the required array size based on num_samps_per_chan and ReadNumChans. If num_samps_per_chan == -1, then it also uses DefaultNumberOfSamplesToRead.

This also applies to ReadDigitalLines, ReadDigitalU32, ReadBinaryI16, ReadRaw, etc. Note that some of these require additional information besides ReadNumChans and DefaultNumberOfSamplesToRead:

  • ReadDigitalLines needs ReadDigitalLinesBytesPerChan. ReadDigitalWaveforms already uses this info.
  • ReadRaw needs ReadRawDataWidthInBits

See #1223 (comment) for more details.

AB#3465613

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions