(Page 33 of 80 in this chapter)


adiOpenPort

Description

Opens a single AG Access port, and returns a context handle.

Prototype

DWORD adiOpenPort( unsigned drvid,
unsigned board,
unsigned stream,
unsigned timeslot,
unsigned mode,
DWORD userid,
CTAHD *ctahd )

drvid Driver ID returned by adiOpenDriver.

board AG board number as configured by agmon.

stream MVIP stream.

timeslot MVIP time slot.

mode Stream and slot selection mode; any combination of:
ADI_VOICE_INPUT
ADI_VOICE_OUTPUT
ADI_SIGNAL_INPUT
ADI_SIGNAL_OUTPUT
ADI_VOICE_DUPLEX
ADI_SIGNAL_DUPLEX
ADI_FULL_DUPLEX

userid User-specified value which is written into the ADI_EVENT userid field when AG Access generates an event on this context.

ctahd Context handle returned by adiOpenPort.

Return Values

Events

Details

The application supplies a drvid which associates the newly opened port with an open AG driver. This association is used to send commands and detect waiting events on the port's behalf. See the "Opening Ports" section of the AG Access Developer's Manual for a complete description.

The board argument identifies a particular AG board. This identifier must correlate to a board ID in the AG configuration file. Refer to the AG configuration file keyword "Board" in the AG Access Installation Manual.

adiOpenPort attaches the open port to a context, and returns a ctahd (context handle) for the application to use to access the associated port.

The MVIP stream, timeslot, and mode are discussed in detail the Application Development chapter of the AG Access Developer's Manual.

The userid is written into the ADI_EVENT userid field whenever AG Access generates an event for the application. The application can use this field to correlate the event with the appropriate context.

See Also

adiOpenDriver, adiFetchAndProcess, adiClosePort, adiStartProtocol

Example

 
int myOpenPort( unsigned drvid, unsigned board,
                unsigned stream, unsigned timeslot, CTAHD *ctahd )
{
    ADI_EVENT event;

    if( adiOpenPort( drvid, board, stream, timeslot,
                     ADI_FULL_DUPLEX, 0, ctahd ) != SUCCESS )
        return MYFAILURE;

    do 
    {
        myGetEvent( &event );           /* see adiFetchAndProcess example */
    } while( event.id != ADIEVN_OPENPORT_DONE );

    if( event.value != CTA_REASON_FINISHED )
        return MYFAILURE;
    return SUCCESS;
}



(Page 33 of 80 in this chapter)


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