viClear
Syntax
viClear(ViSession vi);
Description
Clear a device. This operation performs an IEEE 488.1-style clear of the device.
- For VXI, the Word Serial Clear command should be used.
 - For GPIB systems, the Selected Device Clear command should be used.
 - For a session to a TCPIP socket, if VI_ATTR_IO_PROT is VI_PROT_4882_STRS, the device is sent the string "*CLS\n". Otherwise, this operation is not valid.
 - For a session to a serial device, this function flushes the instrument buffer. This is equivalent to calling viFlush with the VI_READ_BUF flag.
 - For a session to a USB instrument, this function sends the INITIATE_CLEAR and CHECK_CLEAR_STATUS commands on the control pipe.
 
Parameters
| 
                                                     Name  | 
                                                
                                                     Dir  | 
                                                
                                                     Type  | 
                                                
                                                     Description  | 
                                            
|---|---|---|---|
| 
                                                     vi  | 
                                                
                                                     IN  | 
                                                
                                                     ViSession  | 
                                                
                                                     Unique logical identifier to a session.  | 
                                            
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_RSRC_LOCKED  | 
                                                
                                                     Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.  | 
                                            
| 
                                                     VI_ERROR_TMO  | 
                                                
                                                     Timeout expired before function completed.  |