(Page 59 of 80 in this chapter)


adiStartTimer

Description

Starts (or re-starts) a timer on the board.

Prototype

DWORD adiStartTimer( CTAHD ctahd,
unsigned timeout,
unsigned count )

ctahd Context handle returned by adiOpenPort.

timeout Timeout value (in milliseconds).

count Number of events.

Return Values

Events

Details

AG Access supports one application timer per port. This on-board timer has 10 ms resolution. The timer can be used when the application is controlling the protocol from application space. The timer generates periodic events. The programmer specifies both the period (timeout) and number of events (count).

The application can stop the timer by calling adiStopTimer. The timer may be reset or restarted with another call to adiStartTimer. When the timer is restarted, previous timer definitions are discarded and the timer begins with the new parameters.

Note: Unlike most other AG Access asynchronous functions, the timer function is not stopped automatically when a call is released.

See Also

adiStopTimer

Example


int myTimer( CTAHD ctahd, unsigned ms )
{
    ADI_EVENT event;

    if( adiStartTimer( ctahd, ms, 1 /*count*/ ) != SUCCESS )
        return MYFAILURE;

    while( 1 )
    {
        myGetEvent( &event );           /* see adiFetchAndProcess example */

        switch( event.id )
        {
            case ADIEVN_TIMER_DONE:
                if( IS_ADI_ERROR( event.value ) )
                    return MYFAILURE;       /* API error */
                else
                    return SUCCESS;         /* stopped normally */
                    break;

            /* might include cases to handle disconnect event, DTMFs, etc. */
        }
    }
}




(Page 59 of 80 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.