DriverSession::InitializeIO |
Establishes the I/O connection with the instrument.
virtual ViStatus InitializeIO();
Returns a VI_SUCCESS if the operation was successful or a failure ViStatus otherwise.
This function is automatically called as part of driver initialization and is used to establish the I/O connection with the instrument. By default, this function will use the VISA library to open an instrument session using the viOpen function. In simulation mode, this function should do nothing.
Important |
---|
This function must be overridden for non-VISA-based drivers. |
The following code demonstrates how to override the InitializeIO function:
// DriverSession.h class Acme4321DriverSession : public DriverSession { public: Acme4321DriverSession(ViSession handle) : DriverSession(handle, 2000, 2000, 2000, false, 1000) { } virtual ViStatus InitializeIO() override { ViStatus status = VI_SUCCESS; // Don't try to establish an I/O connection if we're simulating, because, well, that's what "simulating" means // if (!SimulationEnabled()) { // ... establish the I/O connection using a custom DLL or other appropriate mechanism } return status; } };