05-02-2016 05:11 AM
Dears,
even though I've been reading here for a lot of time this is my first message in this forum. I've been using LabVIEW for some years, but never used its LVOOP capabilites. I think I'm missing something in the approach of OOP, and I'm writing here to get suggestions from you. Thanks for reading and correcting me.
In a software suite developed by my company there is a tool to make some measurements, e.g. THD or VPP, on acquired waveforms. Available measurements are actually hard coded in LV code. I'm trying to change it into a plugin architecture based on LVOOP.
What I need is to display a subpanel where measurement parameters are set. Idea is: I define a plugin ancestor in charge of loading the front panel of selected measurement. Correct front panel is chosen at run time thanks to OOP.
Ancestor contains a "LoadPanel" VI which calls via asynchronous call a "CallMeasureFrontPanel" VI. "CallMeasureFrontPanel" has static dispatch templates, otherwise can't be asynchronously called. This VI finally calls "MeasureFrontPanel", with dynamic dispatch terminals. "MeasureFrontPanel" is overridden in child classes.
Ancestor has a "PanelLoaded" boolean attribute which is set to True by "MeasureFrontPanel" VI. Main VI polls on this attribute to verify that plugin has been correctly loaded.
A screenshot of Main.
Overridden "MeasureFrontPanel" sets PanelLoaded attribute to True:
What happens is that the loop in main always times out. I believe that my problem resides in LoadPanel:
The object I return from this VI, which is then used to access "PanelLoaded" attribute, is not the same object that runs in "MeasureFrontPanel". If so, how could I get rid of it?
Thanks for comments,
Andrea
05-02-2016 05:26 AM
Andrea,
why do you want to use asynchronous calls for the FPs?
05-02-2016 05:33 AM
Because it's how I understood plugin architectures should be developed as written here... Is it not right?
05-02-2016 05:38 AM
The idea behind plugins is to load a whole class dynamically (LVCLASS) not just a VI from a class.
05-02-2016 05:39 AM
Have you already seen this? https://decibel.ni.com/content/docs/DOC-21441
05-02-2016 05:42 AM
Oli_Wachno,
sorry I don't understand your answer. I want to run in asynchronous way a VI because it must be embedded in a subpanel. I want to use classes, because in my understanding it is the best way to implement a plugin architecture. I'm experiencing problems, for sure due to my poor understanding of LVOOP in general, and for sure to my limits in programming.
But really I don't understand what is the advice in your message.
Thanks for better explanation,
Andrea
05-02-2016 05:51 AM
@andrea.angeloni.alfamation wrote:sorry I don't understand your answer. I want to run in asynchronous way a VI because it must be embedded in a subpanel.
What I have done for this is pass the subpanel reference into the object's initializing VI (or constructor if you really want to call it that). Then the class itself can decide which VI's panel to load. It could load up a parent's GUI VI if it wanted to. If needed, you could also have the initializing VI call whichever VI needs to run Asynchronously.
05-02-2016 06:32 AM
Plugin refers to classes (in you case measurements) that can be dynamically loaded from disc.
The idea is to write an application which is implemented only using the parent class. The class eventually being worked with is only determined at runtime.
Thus you write you application once, all you have to provide are classes (different measurement types) inheriting from your measurement master.
The way I would do it:
05-02-2016 07:52 AM - edited 05-02-2016 08:07 AM
crossrulz,
subpanel reference is stored within ancestor class. I removed asynchronous call. "LoadPanel" is dynamic dispatch, overridden in child object.
Subpanel is correctly shown, but loop shown on first post is still exiting for timeout.
Referring to the main shown on first post, I don't understand how to have the wire coming out from LoadPanel to refer to the child object.
Thanks,
Andrea
EDIT: to be more precise, wire from LoadPanel is istance of expected child object. LoadPanel correctly runs MeasureFrontPanel. What I miss is the link between object in MeasureFrontPanel and LoadPanel, in my understanding I'm working with two different istances while I want them to be the same. Again, I could be totally missing some basic concept, sorry for it.