Click or drag to resize

DriverSession::ClearIOStatus

Clears out any I/O errors that may be in the device at initialization.

virtual ViStatus ClearIOStatus();

ViStatus ClearIOStatus(ViSession Vi);
Parameters
Vi

[in] ViSession handle for the driver session.

Return Value

Returns a VI_SUCCESS if the operation was successful or a failure ViStatus otherwise.

Remarks

This function is automatically called as part of driver initialization and is used to clear out any I/O errors that may be in the device at initialization. This allows the user to initialize the driver, even if the device is in an error state. By default, this function will use the VISA library to send a *CLS command to the instrument. In simulation mode, this function should do nothing.

Important note Important

This function must be overridden for drivers that need to use something other than a VISA-based *CLS command for clearing the instrument I/O status.

Example

The following code demonstrates how to override the ClearIOStatus function:

C++
// DriverSession.h
class Acme4321DriverSession : public DriverSession
{
public:
    Acme4321DriverSession(ViSession handle)
        : DriverSession(handle, 2000, 2000, 2000, false, 1000)
    {
    }

    virtual ViStatus ClearIOStatus() override
    {
        ViStatus status = VI_SUCCESS;

        status = viPrintf(GetVisaSession(), "STAT:CLEAR\n");

        return status;
    }
};

Download a complete CHM version of this documentation here.