viReadSTB
Syntax
viReadSTB(ViSession vi, ViPUInt16 status);
Description
Read a status byte of the service request. This operation reads a service request status from a service requester (the message-based device). For example, on the IEEE 488.2 interface, the message is read by polling devices. For other types of interfaces, a message is sent in response to a service request to retrieve status information.
For a session to a Serial device or TCPIP socket, if VI_ATTR_IO_PROT is VI_PROT_4882_STRS, the device is sent the string "*STB?" and then the device's status byte is read. Otherwise, this operation is not valid. If the status information is only one byte long, the most significant byte is returned with the zero value. If the service requester does not respond in the actual timeout period, VI_ERROR_TMO is returned.
For a session to a USB instrument, this function sends the READ_STATUS_BYTE command on the control pipe.
Parameters
Name |
Dir |
Type |
Description |
---|---|---|---|
vi |
IN |
ViSession |
Unique logical identifier to the session. |
status |
OUT |
ViPUInt16 |
Service request status byte. |
Return Values
Type ViStatus |
This is the function return status. It returns either a completion code or an error code as follows. |
Completion Code |
Description |
---|---|
VI_SUCCESS |
Operation completed successfully. |
Error Code |
Description |
VI_ERROR_BERR |
Bus error occurred during transfer. |
VI_ERROR_CONN_LOST |
The I/O connection for the given session has been lost. |
VI_ERROR_INV_SESSION |
The given session or object reference is invalid (both are the same value). |
VI_ERROR_INV_SETUP |
Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state). |
VI_ERROR_NCIC |
The interface associated with the given vi is not currently the controller in charge. |
VI_ERROR_NLISTENERS |
No Listeners condition is detected (both NRFD and NDAC are deasserted). |
VI_ERROR_NSUP_OPER |
The given vi does not support this function. |
VI_ERROR_RAW_RD_PROT_VIOL |
Violation of raw read protocol occurred during transfer. |
VI_ERROR_RAW_WR_PROT_VIOL |
Violation of raw write protocol occurred during transfer. |
VI_ERROR_RSRC_LOCKED |
Specified operation could not be performed because the resource identified by vi has been locked for this kind of access. |
VI_ERROR_SRQ_NOCCURRED |
Service request has not been received for the session. |
VI_ERROR_TMO |
Timeout expired before function completed. |