Click or drag to resize

Retrieving Initialization Options

When client applications initialize an IVI driver via the InitWithOptions function, they may provide a series of initialization options in the form of name-value pairs. Two types of initialization options may be passed to a driver's InitWithOptions method - inherent options and driver setup options.

The inherent options are specific name-value pairs defined by the IVI Foundation. These include options such as Cache to turn on/off state caching and Simulation to indicate whether simulation should be enabled or not. The driver setup options are custom name-value pairs defined by the driver developer. Driver setup options may be used to control driver-specific features or to perform any custom setup. They are delineated from the inherent options by the IVI-defined DriverSetup keyword.

The example below shows a typical client application instantiating and then initializing a driver.

C++
// Client.cpp
ViSession session;
ViStatus status = acme4321_InitWithOptions("GPIB::10", VI_TRUE, VI_TRUE, "InterchangeCheck=VI_FALSE, Simulate=VI_TRUE, DriverSetup=OptionA=Foo,OptionB=VI_TRUE", &session);

InterchangeCheck option is an inherent option being passed in with a value of VI_FALSE. Simulate is also an inherent option specified with a value of VI_TRUE in the code above. Two driver setup options, OptionA and OptionB are being passed in with values of Foo and VI_TRUE, respectively.

The Nimbus implementation of the InitWithOptions function automatically saves the values of all inherent and driver setup options. If some of the IVI-defined inherent options are not specified, Nimbus caches IVI-defined default values for those options.

Nimbus provides several functions for retrieving the values of the IVI-defined inherent options. These functions are fully documented in the Nimbus Runtime Library documentation. The table below shows each inherent option and the Nimbus function available to retrieve its value. The IVI-defined default value of each option is also shown.

Inherent Options

Accessor Function

Default Value

Cache

CacheEnabled

True

InterchangeCheck

InterchangeCheckEnabled

False

QueryInstrStatus

QueryInstrStatusEnabled

False

RangeCheck

RangeCheckEnabled

True

RecordCoercions

RecordCoercionsEnabled

False

Simulate

SimulationEnabled

False

The Nimbus Runtime Library also provides the GetDriverSetupOption function for retrieving the value of driver setup options passed to the InitWithOptions function. A simple example of using the GetDriverSetupOption function is shown below.

C++
ViStatus _VI_FUNC acme4321_Configure(ViSession Vi, ViReal64 Frequency, ViReal64 Bandwidth)
{
    std::string strOption;

    if (GetDriverSetupOption(Vi, "OptionA", strOption))
    {
        // ...
    }
}

Download a complete CHM version of this documentation here.