Previous Page Table Of ContentsHome IndexNext Page


6.7.  Event Mechanism

The IP Mail 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 mailInitialization( ) function sets up the call-back handler, by calling PDLsr_enbhdlr( ).

There is an endless loop {while(1)} in the main( ) function in the appmain.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.

When the R4/Global Call event is received, the application performs the following:

  1. Gets the event device handle, by calling PDLsr_getevtdev( ).
  2. Gets the channel number related to the event, from the global array (HandleToChannel[ ]).
  3. Updates the METAEVENT structure by calling gc_GetMetaEvent( ).
  4. Gets the event type, by calling PDLsr_getevttype( ).

Normal application exit events don't enter the SRL. The main( ) function calls PDLSetApplicationExitPath( ) before initialization. In Linux, this function sets the signals (SIGINT, SIGTERM, SIGABRT) for making the appropriate exit from application. In Windows, this function enables the detection of CTRL_CLOSE_EVENT (closing the window).


Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Telecom Support Resources

Copyright 2002, Intel Corporation
All rights reserved
This page generated September, 2002