![]() | DriverSession::CloseIO |
Closes the I/O connection with the instrument.
virtual ViStatus CloseIO(); ViStatus CloseIO(ViSession Vi);
[in] ViSession handle for the driver session.
Returns a VI_SUCCESS if the operation was successful or a failure ViStatus otherwise.
This function is automatically called as part of driver shutdown and is used to sever the I/O connection with the instrument. By default, Nimbus uses the VISA library viClose function to sever the connection with the instrument.
![]() |
---|
This function must be overridden for non-VISA-based drivers to perform custom I/O shutdown and to release any custom I/O resources. |
The following code demonstrates how to override the CloseIO function:
// DriverSession.h class Acme4321DriverSession : public DriverSession { public: Acme4321DriverSession(ViSession handle) : DriverSession(handle, 2000, 2000, 2000, false, 1000) { } virtual ViStatus CloseIO() override { // We're still using VISA, so we delegate to the base class, but then we perform custom post-processing. // Non-VISA-based drivers would override in a similar fashion but *not* delegate to the base. Rather, // they would perform a custom operation such as invoking functions on a helper DLL specific to the // I/O protocol in use. // auto status = __super::CloseIO(); ReturnOnError(status); // ... free up additional driver specific resources. return status; } };