![]() | The Driver Info Object |
The Nimbus Template Library supplies a special object called the Driver Info object for controlling the standard Nimbus implementation of various IVI-defined functions. Previous versions of Nimbus relied upon virtual functions that the driver developer needed to override separately to customize the NTL default behavior. The Driver Info object simplifies this customization.
The Driver Info object is an instance of the CDriverInfo class defined in NtlDriver.h. A single instance of this class is created and managed by Nimbus. The table below explains each of the members and the role they play in controlling the Nimbus implementation of various functions. It is important to note that some of these members are controlled via various settings in the Driver Settings Editor, while other members can be directly set in the OnFinalConstruct or the OnFinalInitialize methods.
Member | Data Type | How to Set | Default | Description |
---|---|---|---|---|
m_strSoftwareModuleName | CString | Manual | <projectName> OR <prefix>, if IVI-C is enabled | Name of the software module in the IVI Configuration Store. This value should not be changed directly. Rather the project should be renamed or the IVI-C prefix should be modified. |
m_strDriverIdentifier | CString | Manual | <projectName> | Used to implement the IIviDriver::Identity property. |
m_strDriverVendor | CString | Driver Settings | Specified in wizard | Used to implement the IIviComponentIdentity::Vendor property. |
m_strDriverDescription | CString | Driver Settings | Specified in wizard | Used to implement the IIviComponentIdentity::Description property. |
m_strDriverRevision | CString | Driver Settings | 1.0 | Used to implement the IIviComponentIdentity::Revision property. |
m_strGroupCapabilities | CString | Driver Settings | All groups in selected classes | Used to implement the IIviDriverIdentity::GroupCapabilities property. |
m_strSupportedModels | CString | Driver Settings | <projectName> | Used to implement the IIviDriverIdentity::SupportedInstrumentModels property. |
m_strDefaultSimulatedModel | CString | Driver Settings | First supported model | Used to determine which model is assumed when simulating and no Model option is passed to Initialize. |
m_lSpecificationMajorVersion | long | Driver Settings | Major version of class spec | Used to implement the IIviDriverIdentity::SpecificationMajorVersion property. |
m_lSpecificationMinorVersion | long | Driver Settings | Minor version of class spec | Used to implement the IIviDriverIdentity::SpecificationMinorVersion property. |
m_bInterchangeCheckSupported | bool | Manual | false | Indicates if the driver supports interchangeability checking. A runtime error will be generated in Initialize if the user tries to enable interchangeability checking and this member is set to false. |
m_bResetSupported | bool | Manual | true | Indicates if the driver supports the Reset function. A runtime error will be generated in Initialize if the user tries to reset the device and this member is set to false. |
m_bSelfTestSupported | bool | Manual | true | Indicates if the driver supports the IIviDriverUtility::SelfTest function. |
m_bRevisionQuerySupported | bool | Manual | true | Indicates if the driver supports querying for the driver version number. |
m_bIdQuerySupported | bool | Manual | true | Indicates if the driver supports querying the instrument for its identification information. |
m_lSelfTestTimeout | long | Manual | 2000 | Specifies the I/O timeout value (in milliseconds) to use when executing the IIviDriverUtility::SelfTest function. |
m_lDisableTimeout | long | Manual | 2000 | Specifies the I/O timeout value (in milliseconds) to use when executing the IIviDriverUtility::Disable function. |
m_lResetTimeout | long | Manual | 2000 | Specifies the I/O timeout value (in milliseconds) to use when executing the IIviDriverUtility::Disable function. |
m_lCoercionLogSize | long | Manual | 1000 | Specifies the size of the internal buffer used to store coercion log entries. The size is indicated in terms of the number of entries. Once the coercion log is full, entries are overwritten starting with the oldest. |
The Driver Info object is accessed via the GetDriverInfo function. Typically settings that need to be overridden are set in the OnFinalConstruct function. This function executes only once over the lifetime of the driver (NOT once per Initialize call) and since the settings available on the Driver Info object typically do not depend upon the specific instrument connection (for instance, the specific model connected), the OnFinalConstruct function is the typical choice for customizing the Driver Info object settings.
If the desired Driver Info object settings depend upon some aspect of the specific instrument connected (such as the specific model), then the OnFinalInitialize function can be used to customize the Driver Info object settings. This function executes at the last stage of driver initialization so all of the model identification information is available.
The example code below demonstrates changing the timeout values used for the Reset and Disable functions.
// CoAcme4321.cpp HRESULT Acme4321::OnFinalConstruct() { HRESULT hr = S_OK; GetDriverInfo().m_lSelfTestTimeout = 5000; GetDriverInfo().m_lDisableTimeout = 5000; return hr; }