niRFSA_GetAttributeViString

NI RF Vector Signal Analyzers

niRFSA_GetAttributeViString

ViStatus = niRFSA_GetAttributeViString (ViSession vi, ViConstString channelName, ViAttr attributeId, ViString *value);

Purpose

Queries the value of a ViString attribute.

You can use this low-level function to get the values of inherent IVI attributes, class-defined attributes, and instrument-specific attributes. If the attribute represents an instrument state, this function performs instrument I/O in the following cases:

  • State caching is disabled for the entire session or for the particular attribute.
  • State caching is enabled, and the currently cached value is invalid.

You must provide a ViString (ViChar array) to serve as a buffer for the value. You pass the number of bytes in the buffer as the bufferSize parameter. If the current value of the attribute, including the terminating NULL byte, is larger than the size you indicate in the bufferSize parameter, the function copies buffer size minus 1  bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is "123456" and the buffer size is 4, the function places "123" into the buffer and returns 7.

If you want to call this function just to get the required buffer size, you can pass 0 for the bufferSize and VI_NULL for the attributeValue buffer.

If you want the function to fill in the buffer regardless of the number of bytes in the value, pass a negative number for the buffer size parameter.

Parameters

Input
Name Type Description
vi ViSession Identifies your instrument session. vi is obtained from the niRFSA_init or the niRFSA_initWithOptions functions and identifies a particular instrument session.
channelName ViConstString If the attribute is channel based, this parameter specifies the channel to which the attribute applies. If the attribute is not channel based, set this parameter to "" (empty string) or VI_NULL.
attributeID ViAttr Pass the ID of an attribute.
bufferSize ViInt32 Pass the number of bytes in the ViChar buffer you specify for the attribute value parameter.

If you pass a negative number, the function copies the value to the buffer regardless of the number of bytes in the value.

If you pass 0, you can pass VI_NULL for the attribute value buffer parameter.
Output
Name Type Description
attributeValue ViInt32* Returns the current value of the attribute. Pass the address of a ViInt32 variable.

Return Value

Name Type Description
statusOrRequiredSize ViStatus Returns the status code of this operation. The status code either indicates success or describes an error or warning condition. You examine the status code from each call to an instrument driver function to determine if an error occurred.

To obtain a text description of the status code, call the niRFSA_error_message function. To obtain additional information about the error condition, call the niRFSA_GetError function. To clear the error information from the driver, call the niRFSA_ClearError function.

The general meaning of the status code is as follows:

Value
Meaning
0 Success
Positive Values Warnings
Negative Values Errors