Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 4 out of 5     Rate this Document

Measurement Studio Instrument Driver .NET Wizard: Instrument Drivers that Expose Multiple Session Types Do Not Handle the Init/Close Semantics Correctly

Primary Software: Measurement Studio>>.NET Support
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: N/A
Hardware: Modular Instruments

Problem: Some of the NI modular instruments, such as the NIFgen and NIDmm, mix their calibration API into the function panel with the typical instrument driver API. However, the calibration API requires distinct initialization and close calls. The Instrument Driver .NET Wizard turns the calibration init calls into constructors, but since there is only one possible dispose function, the calibration close call is being left as a standard instance method. This means that an instance created with the calibration constructor will not dispose correctly when the Dispose method is called.

Solution:
  1. Run the Instrument Driver .NET Wizard.
  2. Add a private boolean member to the class declaration called _isCalibrationSession.
  3. Give the member a default value of false.
  4. In the calibration constructor, set the field to true.
  5. In the Dispose method, check the value. If it is true, call the calibrationClose method. If it is false, call the normal Dispose method.

Refer to the links below for more information about the Measurement Studio Instrument Driver .NET Wizard.

Related Links:
KnowledgeBase 3939UN5B: C# and VB.NET Wrappers for National Instruments' Modular Instruments
KnowledgeBase 32EFNNM8: Measurement Studio Instrument Driver .NET Wrapper generator generates private accessors for some property "Get" methods

Attachments:





Report Date: 10/16/2003
Last Updated: 01/04/2005
Document ID: 31RKM1K5

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit