MODES OF INTERACTION WITH INPUT DEVICES
[Angel, p.85]
-
-
REQUEST MODE: the transfer is initiated by the
program, but the transfer is triggered by the
device.
--
E.g., read from keyboard statements
in most computer languages, or scanf in C language.
The trigger is the pressing of
special keys such as ENTER or RETURN keys.
--
There be an indefinite time lapse between
initiation and transfer (usually, the program
hangs up during this gap).
-
-
SAMPLE MODE: the initiation and trigger
both originates from the program.
--
E.g., most locator devices can be sampled at any
time.
--
Of course, not all devices can be accessed in
this mode.
-
-
EVENT MODE: the device initiates and
triggers the transfer. May also be called
the "interrupt mode".
--
This is sometimes implemented to causes the measure and
other data (e.g., device ID) to be placed
in an event queue.
But now, the program has to
busy wait for events.
--
To avoid busy waiting, the GLUT approach is for the program
to specify callback functions for classes
of events. When an event occurs, the associated
callback function is invoked at once.