Creating a New DQMH Event
The different events
A DQMH Event can be either a request or a broadcast.
-
A request is code that fires an event that the DQMH Module Main.vi has to act on.
-
A broadcast is code that fires an event that informs other VIs that are registered to listen that the DQMH Module Main.vi has done something.
-
There are also synchronous events of the type request and wait for reply. These events are fired when the DQMH Module Main.vi needs to return a reply to the VI that called the request and this calling VI must wait until it gets that reply (or the request times out).
Create a new event:
Videos demonstrating the following steps and other examples are available at: bit.ly/DelacorQMH |
-
Go to Tools>DQMH Consortium>DQMH>Event>Create New DQMH Event….
-
Two windows will open: the Create New DQMH Event window and the Arguments Window.
If you select to create a Request and Wait for Reply, an additional Arguments Window will open. |
1 | In the Create New DQMH Event window select the DQMH module for which you wish to create a new event. This drop down menu will only list valid DQMH modules found within the project. |
2 | In the Create New DQMH Event window, specify the type of event you wish to create. A description of each event type appears next to the drop down selection:
|
3 | Specify the name of the new event (in the case of the Round Trip option, specify the name for the request and the name for the broadcast). |
4 | Add controls to the Arguments window. These values will be the arguments sent along with the event when it fires. Use a descriptive label for each control.
|
5 | (Optional but heavily encouraged) Enter a description for the event. This description will be included as the VI documentation for the VIs that this tool created to fire the event created. |
6 | Click OK to create the new event(s). The new event VI(s) will be selected in the project explorer window after creation is complete. |
TheDQMH Module Main.vi and Tester VI might be broken.
The developer has to complete several actions to complete the creation of this code, all of which are identified with #CodeNeeded bookmarks that can be explored with the Bookmark Manager window.
DQMH 3.0 adds automatic wiring of event structure frames when used in LabVIEW 2016 or later. |
-
The developer needs to complete the following actions:
-
In the case of a new Request:
-
-
Add a new front panel control to test the new request event. Note that DQMH 4.2 adds automatic wiring of a test button on the API Tester if this option was selected at event creation time.
-
Open the block diagram, which should be showing the newly added event frame with the new request VI inside. Right-click on the event structure, select Edit Events Handled by This Case, and select the control added in the previous step. Note that DQMH 4.2 will take care of this step automatically if the developer selected this option at event creation time.
-
By default, all the inputs of the request VI are required. Wire appropriate inputs to the request VI.
-
The Tester VI should no longer be broken (assuming it was not broken before the new event was added).
-
-
In the DQMH Module Main.vi:
-
Open the block diagram, which should be showing the newly added event frame in the EHL and the newly added case frame in the MHL.
-
Right-click the event structure, select Edit Events Handled by This Case, and select the newly created request that should be listed under Dynamic>><Module Name> Request Events.
-
Wire the event data (<arguments label(s)>) to the Bundle function in the event frame.
-
Add necessary code to the <request name> frame in the MHL case structure.
-
-
-
In the case of a new Broadcast:
-
In the Tester VI:
-
Open the block diagram, which should be showing the newly added event frame with the #CodeNeeded bookmark. Right-click the event structure, select Edit Events Handled by This Case, and select the newly created broadcast that should be listed under Dynamic>><Module Name> Broadcast Events.
-
Add code to process the event data sent by the broadcast event.
-
The Tester VI should no longer be broken (assuming it was not broken before the new event was added).
-
-
In the DQMH Module Main.vi:
-
Open the block diagram, which should have the newly created broadcast VI on the left side with a #CodeNeeded bookmark.
-
Move that VI wherever the newly created broadcast event needs to be called.
-
-
-
In the case of a new Request and Wait for Reply:
-
In the Tester VI:
-
Add a new front panel control to test the new request event.
-
Open the block diagram, which should be showing the newly added event frame with the new request VI inside. Right-click the event structure, select Edit Events Handled by This Case, and select the control added in the previous step.
-
By default, all the inputs of the request VI are required. Wire appropriate inputs to the request VI.
-
Process the reply payload output from the new request VI.
-
If the payload argument needs to be changed, open the new request VI and right-click the Reply Payload indicator to open its typedef and edit it accordingly.
-
The Tester VI should no longer be broken (assuming it was not broken before the new event was added).
-
-
In the DQMH Module Main.vi:
-
Open the block diagram, which should be showing the newly added event frame in the EHL and the newly added case frame in the MHL.
-
Right-click the event structure, select Edit Events Handled by This Case, and select the newly created request that should be listed under Dynamic>><Module Name> Request Events.
-
Wire the event data (<arguments label(s)>) to the Bundle function in the event frame. Take special care to wire the Wait Notifier event node output to the Bundle function that the utility added.
-
Add necessary code to the <request name> frame in the MHL case structure.
-
Wire the proper reply to the Send Notification function.
-
-
-
DQMH versions before 4.1, created the Round Trip differently, in those versions the Round trip was a combination of a request and a broadcast where both events shared the same argument typedef. Based on feedback from the DQMH community and DQMH development team’s own experience, we decided to change the round trip to be now the combination of a request and wait for reply and a broadcast. |