Dear NI community,
let me, please, ask you one more question regarding hardware abstraction layer (HAL) implementation.
I am implementing now HAL classes with methods, which have common inputs/outputs. Then, there is API VIs for calling of these methods; and API VIs, as the top-level VIs are called from TestStand/LabVIEW.
But the problem comes, when some device needs specific setting/parameter. So, it means, that I have two ways of implementation:
- create new method for generic HAL class, and then implement it in specific device class;
- extend specific device class with the private method.
Both of solutions have issues. The first one:
- now, specific device implementations classes would have methods in override what they don't need (not a bit issue at the end, I can leave with that, but it seems for me that it's not so nice solution);
- if existing method needs additional parameter, it's not good to create new method which will do the same, but will have additional input. So, I can implement method of setting up that parameter, and then use it internally in specific device implementation. But, it is difficult to see for the end user, and without proper documentation purpose of that method could be unclear in the future.
The second one:
- if there will be private methods, it means, that I need to create APIs specially for them. Thus, LV code/TestStand sequence will contain steps for particular, and not abstract hardware. So in case of instrument change, it will be not enough to init HAL class with proper instance. I will need to remove that specific API call step. If I'll not do it (hopefully, I'm not mistaken) then while running other specific implementations of the class on that device-specific method could cause error (or not?), b/c that method is not common for siblings classes.
Is there some third way? And which way is more preferrable, please? Or there is no some strict experience with it, and one should consider it based on the situation?
Thank you very much in advance!
Sincerely, kosist90
![logos_middle.jpg logos_middle.jpg]()
JKI VI Tester – useful tool for LabVIEW developer