DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Registering for cloneable module broadcasts from a top level module

Solved!
Go to solution

Hello,

I have a question. The scenario is this:

A top level module launches two singleton modules A and B.  Module B then launches cloneable modules C and D. The issue now is that Module A needs data from C. What is the best way for module A to register for the broadcasts from C? I know I could go up the tree and send another broadcast through the launcher module but I was wondering if it is possible for A to register and receive broadcast data.

Thanks

0 Kudos
Message 1 of 5
(215 Views)

If Module A depends on broadcasts from C, and B is what launches C, then I think Module A should launch module B. Module A can use the Null Broadcast Events VI from Module C to initialize its Register For Events function to define the type, even though Module C hasn't launched yet.

Once Module C launches, Module B should be registered for Module C's 'Did Init' broadcast, and when it gets that broadcast, it should then tell Module A (through a broadcast is fine) that Module C has started, then Module A can use Module C's 'Obtain Broadcast Events for Registration' VI to update the event registration (which was previously defined with the Null Events VI) with the actual events.

Message 2 of 5
(212 Views)

Hello Darren,

Thanks for the quick reply. I will give it a try and let you know.

0 Kudos
Message 3 of 5
(208 Views)
Solution
Accepted by topic author SolPS

An alternative could be for Module A to ask Module B for the broadcast event reference but for both A and B to use a separate typedef for the event datatype. That way, no static dependency is created between A and C.

 

We do this quite often when a generic data sink (eg a logger) shall receive data from a generic data source (eg a DAQ module). The logger knows it expects data of the type of Array of Waveforms, for example, but doesn't care where the data actually originates. It prepares its own event registration with its own typedef for an event of that type (i.e not using the Null broadcast event ref typedef of the DAQ module).

 

The Main module - which starts both the DAQ and the Logger - has static dependencies to both modules. It can read the DAQ broadcast reference from the DAQ's Obtain Broadcast Events for Registration.vi and forward it to the Logger. The Logger can now use the live reference to register for the event without creating a static dependency to the DAQ module (or even knowing about it).

 

These pictures are from a training we gave a while ago:

 

02 broadcast registration.jpeg

04 broadcasts.jpeg




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


0 Kudos
Message 4 of 5
(171 Views)

I ended up following Joerg's suggestion by having module B share the broadcast event reference with module A.  I always strive to keep my application designs at no more than three layers whenever possible. Having module A launch B would create an additional layer which increases the complexity a little bit. Again thanks Joerg and Darren for your timely suggestions. Much appreciated!

0 Kudos
Message 5 of 5
(131 Views)