Click or drag to resize

Customizing the Driver Inherent Capabilities

All IVI drivers implement a standard set of IVI-defined methods and properties, irrespective of whether or not an instrument class is supported. This base set of functionality is referred to as the inherent capabilities. For a complete listing of the IVI inherent capabilities, see the IVI specification IVI-3.2: Inherent Capabilities Specification.

Nimbus provides complete implementations for all inherent capability methods and properties. In most cases, the Nimbus-supplied implementations fulfill the requirements of the driver developer. However, the implementation of the inherent capability methods and properties and be customized. Two techniques are available for customizing the behavior of the inherent capabilities:

  1. Using the Driver Info Object to specify basic function behavior.

  2. Overriding the Nimbus-supplied implementation completely.

Customizing the Inherent Capabilities with the Driver Info Object

The Nimbus-supplied implementation of many of the inherent capabilities relies upon a special called the Driver Info object. This object is an instance of a Nimbus-generated class named CDriverInfo and is accessible from any driver method via the GetDriverInfo method. The member variables exposed from this object control the implementation of the inherent capabilities. For example, setting the m_strDriverDescription member controls what is returned from the implementation of the IIviComponentIdentity::Description property.

The Nimbus Template Library documentation for the Driver Info object lists all members available and how they relate to the various inherent capability methods and properties.

Typically, the best place to access the Driver Info object is from the OnFinalConstruct method in the main driver implementation file. The example below demonstrates how to use the Driver Info object to set the timeouts used for the IIviDriverUtility::Reset and IIviDriverUtility::Disable functions.

C++
// CoAcme4321.cpp
HRESULT Acme4321::OnFinalConstruct()
{
  HRESULT hr = S_OK;

    GetDriverInfo().m_lSelfTestTimeout = 5000;
    GetDriverInfo().m_lDisableTimeout = 5000;

  return hr;
}
Customizing the Inherent Capabilities by Overriding the Default Implementation

In scenarios where there is a need for more control over the inherent capability implementation, the driver developer can simply override the NTL-based implementation. The main driver class implementation file (Co<driverName>.cpp) contains the implementation of all of the inherent capability methods and properties. Most contain a single line of code that delegates to a function in the driver bases classes. This delegation code can simply be replaced with custom logic.

Customizing the Initialize and Close Methods

Two of the IVI inherent capability methods bear special consideration when considering how to customize driver behavior. These are the IIviDriver::Initialize and IIviDriver::Close methods. Unlike the other Nimbus-supplied implementations of inherent capabilities, the implementations of Initialize and Close contain essential code for properly initializing and shutting down core driver features. As such, the implementation of these functions must ALWAYS delegate to the NTL base classes, via calls to DriverBase::Initialize and DriverBase::Close.

Caution note Caution

Never remove the calls to DriverBase::Initialize or DriverBase::Close from the Initialize and Close implementations.

Rather than allowing you to override the Initialize and Close implementations entirely, Nimbus provides a structured way to take control of various stages of driver initialization and shutdown, while still allowing the core Nimbus code to execute. These customization techniques are discussed in detail in the topic Customizing Driver Initialization and Shutdown.

See Also

Other Resources

Download a complete CHM version of this documentation here.