Demo Details

5.5.2Handling Keyboard Input Events

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

5.5.3Handling SRL Events

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

1.Get METAEVENT by calling gc_GetMetaEvent( ).

2.Get channel ID through device handle to channel mapping.

3.Get device type through device handle to type mapping.

4.Route meta event to the module specified by device type.

5.5.4Handling Application Exit Events

Normal application exit events, such as pressing either q or Q, or Ctrl+C, don’t enter the SRL. The main( ) function calls PDLSetApplicationExitPath( ) before initialization. In Windows, this function enables the detection of CTRL_CLOSE_EVENT (closing the window).

5.5.5TSUsrEvent Structure

The TSUsrEvent structure is used by the demo modules to return event processing results to the event router. It has five fields:

Event

The name of a user defined event, such as USR_CONNECTED, etc.

Destination

The name of the module that this event is destined for. A destination can be IP, VOICE, or NONE.

lineDevice

The device handle in this module. It will be later used by the Event Router as an index to find its counterpart in the destination module.

xmitSlot

An integer normally to be filled with with a time slot

neighborDevice neighbor device handle

dialString

A char string normally to be filled with a DTMF dialing string.

The TSUserEvt structure is defined as follows:

40

IP Media Server (Global Call) Demo Guide — November 2003

Page 40
Image 40
Intel 05-2065-002 manual Handling Keyboard Input Events, Handling SRL Events, Handling Application Exit Events