Click or drag to resize

Customizing Driver Initialization and Shutdown

The initialization of an IVI-C driver session begins with a client application invoking the init or InitWithOptions function and ends with a call to the driver's close function. Nimbus provides a default implementation of all three of these functions that handles a great deal of processing in an IVI-compliant way, such as loading information from the IVI Configuration Store, parsing initialization options, instantiating an IVI session object, and more.

Much of the standard processing in the default implementation of the driver initialization and shutdown functions is suitable for all drivers and need not (and, indeed, should not) be customized for specific drivers. However, some of that implementation logic necessarily makes assumptions about how the driver supports certain operations, such as how it opens an I/O session, how it identifies the instrument and how it clears the I/O session. Since IVI drivers can vary wildly in how these operations should be performed, Nimbus provides a simple means to override only those specific aspects of initialization while still leveraging those portions that work for all drivers.

When the driver's init or InitWithOptions function is called, Nimbus creates an instance of a driver session object. The definition of the driver session class is maintained in the driver project's DriverSession.h file and is named <prefix>DriverSession. This class derives from the standard Nimbus Runtime Library's DriverSession class, and Nimbus relies heavily upon virtual functions on this DriverSession class. Driver developers override these virtual DriverSession class functions to customize the behavior of the driver.

The table below presents the sequence of operations that take place over the lifetime of a typical IVI-C driver session and which functions are available to customize this sequence to meet specific driver requirements.

Step

Function Called

Description

1

Client application calls the driver's InitWithOptions function.

The client application may also call init, but the sequence of operations presented here is identical.

2

InitializeIO

This function is used to establish an I/O connection with the device. 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. This function must be overridden for non-VISA-based drivers.

3

ClearIOStatus

This function 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. Drivers that need to use an alternate mechanism for clearing the instrument I/O status must override this function.

4

GetIdentificationInfo

This function is used to set the instrument model, manufacturer, serial number, and firmware revision. By default, this function will use the VISA library to send a *IDN? query and it will expect a standard IEEE 488.2 response. Drivers that need to use an alternate mechanism for identifying the connected instrument must override this function.

5

InstrumentSupported

This function checks if the connected instrument is supported by the driver. By default, this function checks that the model detected by the GetIdentificationInfo function in an earlier step is in the list of supported models. This function can be overridden to implement more advanced logic, such as cases where the number of instrument models supported is prohibitively large and/or not precisely enumerable by the driver.

6

The InitWithOptions function completes (if all previous steps succeeded).

7

Client application calls the driver's close function.

8

CloseIO

This function closes the connection with the instrument. By default, Nimbus uses the VISA library viClose function to sever the connection with the instrument. Non-VISA-based drivers must override this function to perform custom I/O shutdown and to release any custom I/O resources.

9

The close function completes.

Download a complete CHM version of this documentation here.