About This File
LVOOP Event Handler v1.0.1
Copyright © 2010, François Normandin.
All rights reserved.
Contact Info: Contact via PM on www.lavag.org
Created and tested with LabVIEW 2009
This is a package that provides the framework for a LVOOP Subscribable Event Handler.
Processes can dynamically register new events and list the classes that are allowed to subscribe to it.
Once a TopProcess takes ownership of the Handler, it manages a Global Stop event and a Handler Activity event to inform subscribers that a new event has been registered with the handler. All subscribers can then get a list of all the events they are allowed to subscribe to.
Everything is done through events with LVOOP LVObject as a backbone. The subscriber will then be free to implement its interpretation of the subscribe event content when received, by casting to the known object types.
After installing package with VIPM, refresh palettes if VIPM is not set to refresh automatically.
Use palette to find the LVOOP Event Handler. Select the Event Handler VI and drop it in your application.
There is a test program that shows how data is exchanged between three dummy classes. You can open the front panel
of the Event Handler to see what are the actual allowed subscribers for which event owner.
v1.0.0: Initial release of the code. (2009)
v1.0.1: Fixed a wrong connection with the "Preserve RunTime Class" primitive where children classes were not considered as such when a parent class was passed.
Better error handling on Destroy Handler command. (Caused a code 1 error when event destroyed by owner prior handler command.
Added the Event Description string to the connector pane.
Distributed under the BSD license.
If you have any problems with this code or want to suggest features:
please go to www.lavag.org and Navigate to the discussion page.
This code was downloaded from the LAVA Code Repository found at www.lavag.org
How it works:
This framework consists of a FGV Event Handler that manages the interactions between publishers and subscribers to events. It consists of some commands that allow the use of generic LVOOP events.
It allows the owner to control a Global Stop command, which can be listened by any VI. Once initialized, any process can register its own events and choose which classes are able to subscribe dynamically to it.
A generic event notifies all subscribers to a change in the list of the events available, so that no VI needs to poll constantly to detect the new events or unsubscribe from events that are unregistered by its owner.
1- Initialize Handler: The first VI to call the initialization takes ownership of the handler. All other calls before the handler is destroyed will return an error.
2- Subscribe: Default case. When a VI subscribes to event, it will receive a list of all events for which it is allowed to register. Then the VI can decide what it does with the incoming data on that event channel.
3- Register: Any VI can register an event refnum (LVOOP type) and decide which object types can subscribe to it. If no input is provided, or if LVObject is in the list, then all are allowed to subscribe. A notification is sent via the Handler Activity event.
4- Unregister: Any VI that owns an event can remove it from the list. A notification is sent to everyone that listens to the Handler Activity event to prevent the need for poling.
5- Global Stop: Only the owner of the handler can call a global stop. It is meant to protect the integrity of the program should a subscriber decide to play god.
6- Destroy Handler: Releases the command to any process that wants to initialize it. It also erases all events still registered. It can only be called by the Handler's owner.
There is an example VI in the LVOOP Event Handler palette.
What's New in Version 10/07/2010 07:25 PM See changelog
No changelog available for this version.