6. Demo Details
29
Calls gc_OpenEx( ) which opens all IP devices, returns the IP
LineDevH, and saves it in Session.ipParams
Saves the channel number in the global array HandleToChannel[ ]
according to the LineDevH handle
13. The application main() function calls waitForKey( ), to receive keyboard
input.
6.5. Event Mechanism
The IP Gateway (Global Call) demo uses the SRL mechanism to retrieve events.
When an event occurs, SRL calls event handlers automatically. All events are
received by the SRL and then passed to the callback_hdlr() function for
handling.
In the initialization phase of the demo the gateInitialize() function sets up the
call-back handler, by calling PDLsr_enbhdlr().
6.5.1. Handling Keyboard Input Events
There is an endless loop {while(1)} in the main() function in the Gatemain.c file.
In that loop, the application waits forever for a keyboard event by calling the
waitForKey() function. The event must be handled immediately and event-
specific information should be retrieved before the next call to waitForKey().
When the next event occurs or when a time-out is reached, the waitForKey()
returns and the call-back handler function is called automatically.
6.5.2. Handling SRL Events
When the R4/Global Call event is received, the callback_hdlr( ) function
performs the following:
1. Calls gc_GetMetaEvent( ) to get the event
2. If the event is for a board, the application calls rasProcessEvent( ) to
process it.