Click or drag to resize

VisaTimeoutManager Class

This class is used to change the timeout of the underlying VISA library for a specific sequence of operations. This class is only defined when the driver is using VISA for its underlying I/O, as specified in the I/O Property Page.

To use this class to increase or decrease the VISA timeout for a sequence of operations, simply declare a local variable of type VisaTimeoutManager within the function or code block of interest. The constructor of the VisaTimeoutManager class will store the current value of the VISA timeout attribute before changing its value to the desired value specified in the class constructor. When the function or code block exists, the VisaTimeoutManager destructor runs, which restores the timeout to its previous value.

The VisaTimeoutManager can be used in nested code blocks, as demonstrated below, to achieve specific timeout requirements.

The following example demonstrates use of the VisaTimeoutManager class.

C++
ViStatus _VI_FUNC acme4321_ConfigureSweep(ViSession Vi, ViReal64 StartFrequency, ViReal64 StopFrequency)
{
    VisaTimeoutManager timeout1(Vi, 3000);

    // All code here executes with a VISA timeout of 3 seconds
    // 

    {
        VisaTimeoutManager timeout2(Vi, 4000);

        // All code here executes with a VISA timeout of 4 seconds
        // 
        // ...

    }   // When this point is reached, the previous timeout of 3 seconds is restored

    // All code here executes with a VISA timeout of 3 seconds
    // 
    // ...

}   // When this point is reached, the previous timeout (before invoking this function) is restored

Download a complete CHM version of this documentation here.