LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HAL design issue

I play around with a hardware abstraction layer. Right now I am stuck with my abstract init VI.

It seems I can't override my abstract init VI in child classes with inputs that are also children of the original init VI.

Since I can't have two dynamic inputs,

any suggestions for having a generic top level Init that accepts the device and a configuration object are welcome.

 

Quiztus2_0-1713960666254.png

Error: This VI doesn't match other VIs in the method, Connector Pane Terminal(s) are different.

Quiztus2_1-1713960727695.png

 

Actor Framework
0 Kudos
Message 1 of 5
(358 Views)

A few alternatives:

1. Use generic parameters : either the path of an INI file, or a variant (the child method will know how to cast it back to a cluster), or a string (XML or JSON)...

2. Make property node accessors for your class, initialize the parameters you need, and then call init() with no parameters

 

 

Reference: dealing with input types on dynamic dispatch - Object-Oriented Programming

-------------------------------------------------------
Control Lead | Intelline Inc
Message 2 of 5
(343 Views)

You ticked me in the right direction. Since the Specific FGEN knows which Configure object it can handle, I can cast the IConfigure to the correct IConfigureViaSessionHandle type inside it's Init VI. I will follow that path and will check where it brings me.

Quiztus2_0-1713962743740.png

 

Actor Framework
0 Kudos
Message 3 of 5
(329 Views)

What I do is pass in a JSON string for the object to be created.  The first thing in that JSON object is the class name.  I can use that and some string manipulation to dynamically load the desired class.  I can later set the class type on the wire to a parent or a child.

 

I initially used an INI file for my configuration, but I eventually concluded that I needed a hierarchical format to properly define my devices and instruments.  I allowed for XML, then got hooked on JSON.  I recently removed the XML support because I thought JSON was so much better.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(325 Views)

I like the approach of JSON configuration files. They seem reasonable for having changing configurations within the same device type. 

Actor Framework
0 Kudos
Message 5 of 5
(310 Views)