Click or drag to resize

Retrieving Initialization Options

When client applications instantiates an IVI.NET driver, the client 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 constructor - 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 a driver.

C#
// Client.cs
var driver = new Acme4321(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 driver constructor 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. 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 property

Default Value

Cache

CachingEnabled

True

InterchangeCheck

InterchangeCheckingEnabled

False

QueryInstrStatus

QueryInstrumentStatusEnabled

False

RangeCheck

RangeCheckingEnabled

True

RecordCoercions

CoercionRecordingEnabled

False

Simulate

SimulationEnabled

False

In addition to providing access to the IVI-defined intialization options, the Nimbus Class Library provides a means to retrieve the DriverSetup options. The InitOptions.DriverSetup property exposes a map of key-value pairs, where the key is the name of the option and the value is the string value supplied. If the DriverSetup string does not take on the form of name-value pairs for a particular driver, then the raw value can be retrieved using the InitOptions.DriverSetupString property. The example below demonstrates how to retrieve the value of a custom DriverSetup option called OptionA.

C#
// Acme4321.cs
Configure(double frequency, double span)
{
   // The line of code below assumes the constructor was invoked with a call such as:
     // 
     //   var driver = new Acme4321("MyLogicalName", false, false, "DriverSetup= OptionA=Foo");
     // 
   var myOptionValue = this.Session.DriverSetup["OptionA"];

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

Download a complete CHM version of this documentation here.