From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-17-2019 05:58 AM
I have a question about the IO handle for instruments in my HAL library
There is a base instrument class with private data of VISA string, VISA reference, IVI session handle. DMM, Power supply classes inherit from Base instrument class.
When a connection to a DMM (niDMM driver) is opened, the instrument handle could not be written to IVI of the base instrument class because of class conflict of IVI handle( IVI session of class IVI and class NiDMM). What is the solution for this
1. Should I create a IVI session handle of niDMM class type in Base instrument class? If so, wouldn't thtat break abstraction
and if I were to use some other drivers, I have to add its type...
2. Should I cast the handle (NiDMM to IVI) with in the driver class and write to the generic IVI session handle in the base instrument class.
Suggestions are welcome
Solved! Go to Solution.
01-17-2019 08:18 AM
01-17-2019 08:37 AM
I am already saving the resource identifier in the base class. The problem is, with different drivers for a specific instrument, DMM for example, the IVI handle after opening a connection are of different types. Hence I cannot save it in the Base or instrument classes as they have to be generic...
01-17-2019 08:47 AM
@StewieRupert wrote:
I am already saving the resource identifier in the base class. The problem is, with different drivers for a specific instrument, DMM for example, the IVI handle after opening a connection are of different types. Hence I cannot save it in the Base or instrument classes as they have to be generic...
Thats why I suggested you save the IVI-handle of for a specific instrument class in that class. Then you use it internally in that class only and never need to bother about it, and can have any type of instrument-reference in different instrument classes, while still having the resource string in the base class.