Data communication in colibri

2. July 2006, fixed 27. Nov 2006
This file is a short description how Drivers, GrafikUserInterface, .. is working.
data flow

Driver for acquisition of an image

At startup of the driver it is initializing the hardware (some init sub-vis), and a queue called "SaveQueue".
Then there is a while loop with an Notifier (name: scan.number.set) waiting to acquire the image.
When the notifier arrives (the text contains the number of images to acquire) acqisition is started:
 - Read all needed variables and configure the rest of the hardware (e.g. exposure time...)
 - obtain a new IMAQ from ImaqStorage.vi
 - grab the image and write it into the IMAQ
     - if there is a new part available change the scan.imaq.list variable to the IMAQ-number to send a notification to update the display.
 - send the IMAQ with its meta data into the SaveQueue
 - change the scan.number variable to the sequence number (so a job controller or a GUI will be notified of the arrival of a new image)
 - if there is a sequence to acquire: check if there is no error, check the notifier (i use the text "cancel" to abort a sequence): If everything is OK start a new acquisition.
When the notifier is deleted (main program is closed) quit the driver.

Driver for Hardware (easy without query)

At startup of the driver it is initializing the hardware (some init sub-vis). Read the actual value and update the variables.
Then there is a while loop with an Notifier (listening to a .set variable) waiting.
When the notifier arrives (the text contains e.g. a number with the new value for the hardware):
 - send the data to the hardware
 - read the result and update the variable.
When the notifier is deleted (main program is closed) quit the driver.

Driver for Hardware (advanced with query)

At startup of the driver it is initializing the hardware (some init sub-vis)
Then there is a while loop with an Notifier (.set name) waiting, use the timeout of the WaitForNotifier to start a query after some seconds.
When the notifier arrives (the text contains the new value for the hardware, or number="update" to force an update):
 - send data to the hardware (new data or query)
 - read the result and update the number variable. (the driver can not watch the notifier while waiting here, so maybe waiting is a problem)
You can use an extra while loop to query the device after some seconds if waiting for the result is too slow.
When the notifier is deleted (main program is closed) quit the driver.

GUI for a Variable (Hardware control)

open a Notifier on the variable you want to control (without the .set!)
Have a WaitForNotifier loop to update your display with the actual values. Do an first update at startup.
Have a Event loop to watch the user input and change the variable.set to the new data. The Notifiacation for a driver is generated from Variables.vi.
It would be best to have two displays: One for the variable.set to start a change and one for the Notifier to watch the result. You can do this with one but there is periodically query or another application is changing the data you may see you control changing while editing the value.