Click or drag to resize

DriverSession::PollInstrumentErrors

If instrument error polling is enabled, (i.e. the QUERY_INSTR_STATUS attribute is VI_TRUE) this function polls the instrument to determine if an error condition exists.

virtual ViStatus PollInstrumentErrors();

ViStatus PollInstrumentErrors(ViSession Vi);
Parameters
Vi

[in] ViSession handle for the driver session.

Return Value

Returns a VI_SUCCESS if no instrument error was detected. If an instrument error was detected, this function returns the standard IVI error code IVIC_ERROR_INSTRUMENT_STATUS.

Remarks

This function is automatically called whenever commands are sent to the instrument. The function should only query the instrument for errors when the QUERY_INSTR_STATUS attribute is VI_TRUE.

The default implementation of PollInstrumentErrors uses the VISA library to send a *ESR? query to the instrument and expects an IEEE 488.2 response.

Important note Important

This function must be overridden for non-VISA-based drivers or drivers that use something other than the *ESR? query to poll the instrument for errors.

Example

The following code demonstrates how to override the PollInstrumentErrors function:

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

    virtual ViStatus PollInstrumentErrors() override
    {
        auto status = VI_SUCCESS;

        // Don't poll unless error polling has been enabled by the client program
        // 
        if (QueryInstrStatusEnabled())
        {
            // Perform a driver-specific query to determine if there is an error eithin the instrument
            // 
        }

        return status;
    }
};

Download a complete CHM version of this documentation here.