Click or drag to resize

Retrieving Initialization Options

When client applications initialize an IVI driver via the Initialize method, 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 Initialize 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.cs
Acme4321 driver = new Acme4321();

driver.Initialize("GPIB::10", true, true, "InterchangeCheck=False, Simulate=True, DriverSetup=OptionA=Foo,OptionB=True");

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

The Nimbus implementation of the Initialize 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 Driver State Functions section of the Nimbus Template 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

GetCache

True

InterchangeCheck

GetInterchangeCheck

False

QueryInstrStatus

GetQueryInstrStatus

False

RangeCheck

GetRangeCheck

True

RecordCoercions

GetRecordCoercions

False

Simulate

GetSimulate

False

The Nimbus Template Library also provides the GetDriverSetupOptionValue function for retrieving the value of driver setup options passed to the Initialize function. A simple example of using the GetDriverSetupOptionValue function is shown below. For more details, see the documentation for this function in the Nimbus Template Library.

C++
// IAcme4321.cpp
HRESULT Acme4321::IAcme4321_put_Frequency(double Frequency)
{
   HRESULT hr = S_OK;

   CString strOption = GetDriverSetupOptionValue("OptionA");

   if (strOption == "Foo")
   {
      // ...
   }

   return hr;
}

Download a complete CHM version of this documentation here.