viSetBuf

Agilent VISA.NET

viSetBuf

Syntax

viSetBuf(ViSession vi, ViUInt16 mask, ViUInt32 size);

Description

Set the size for the formatted I/O and/or serial communication buffer(s). This operation changes the buffer size of the read and/or write buffer for formatted I/O and/or serial communication. The mask parameter specifies which buffer to set the size of. The mask parameter can specify multiple buffers by bit-ORing any of the following values together.

Flag

Interpretation

VI_READ_BUF

Formatted I/O read buffer.

VI_WRITE_BUF

Formatted I/O write buffer.

VI_IO_IN_BUF

I/O communication receive buffer.

VI_IO_OUT_BUF

I/O communication transmit buffer.

For backward compatibility, VI_IO_IN_BUF is the same as VI_ASRL_IN_BUF and VI_IO_OUT_BUF is the same as VI_ASRL_OUT_BUF. Since not all serial drivers support user-defined buffer sizes, it is possible that a specific implementation of VISA may not be able to control this feature. If an application requires a specific buffer size for performance reasons, but a specific implementation of VISA cannot guarantee that size, it is recommended to use some form of handshaking to prevent overflow conditions.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession

Unique logical identifier to a session.

mask

IN

ViUInt16

Specifies the type of buffer.

size

IN

ViUInt32

The size to be set for the specified buffer(s).

Return Values 

Type ViStatus

This is the function return status. It returns either a completion code or an error code as follows.

Completion Codes

Description

VI_SUCCESS

Buffer size set successfully.

VI_WARN_NSUP_BUF

The specified buffer is not supported.

Error Codes

Description

VI_ERROR_ALLOC

The system could not allocate the buffer(s) of the specified size because of insufficient system resources.

VI_ERROR_INV_MASK

The system cannot set the buffer for the given mask.

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

VI_ERROR_RSRC_LOCKED

Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.

See Also

viFlush