(Page 16 of 80 in this chapter)


adiGetContextInfo

Description

Retrieves configuration information about a specified context.

Prototype

DWORD adiGetContextInfo( CTAHD ctahd,
ADI_CONTEXT_INFO *info,
unsigned size )

ctahd Context handle returned by adiOpenPort.

info Buffer to receive the information. The ADI_CONTEXT_INFO structure is shown below:

typedef struct
{     /* User accessible CONTEXT INFO structure:  */
 DWORD size;    /* returned size of this structure           */
 DWORD queueid;    /* queue id (a.k.a. devid in adi.lib           */
 DWORD userid;    /* user supplied during adiOpenPort           */
 INT32 agliberr;    /* last error code after calling AGLIB           */
 DWORD channel;    /* AG Channel           */
 DWORD board;    /* AG Board  number           */
 DWORD stream;    /* MVIP stream of this port           */
 DWORD timeslot;    /* MVIP slot of this port           */
 DWORD mode;    /* MVIP mode of operation of this port           */
 DWORD maxbufsize;    /* maximum board buffer size           */
 char  tcpname[12];
/* Current Protocol */
DWORD state; /* port state */ } ADI_CONTEXT_INFO;
size Amount of memory available at info, which must be large enough to receive the ADI_CONTEXT_INFO size return value.

Return Values

Events

None.

Details

This function returns information about the current state of a specified context.

Up to size bytes of the ADI_CONTEXT_INFO structure are copied to the address at info. If size is greater than or equal to sizeof(ADI_CONTEXT_INFO), the complete structure is copied. The number of bytes actually copied is returned in the ADI_CONTEXT_INFO size field.

The following table summarizes the ADI_CONTEXT_INFO structure. Many of these context characteristics are described in other functions, as noted:

Field

Description

Related Functions

size

The returned size.

N/A

queueid

The driver ID associated with the context .

adiOpenPort

userid

The application value returned with every event for the context

adiOpenPort

agliberr

NMS internal

N/A

channel

NMS internal

N/A

board

The board number on which the context's DSP resides.

adiOpenPort

stream

The base MVIP stream for the context.

adiOpenPort

timeslot

The context's MVIP timeslot.

adiOpenPort

mode

The context's MVIP mode.

adiOpenPort

maxbufsize

The AG physical buffer size.

adiGetEncodingInfo

tcpname

The protocol executing on the context.

adiStartProtocol

state

The context state.

N/A

See Also

adiOpenPort

Example


int  myShowContextState( CTAHD ctahd )
{
    ADI_CONTEXT_INFO info;

    if( adiGetContextInfo( ctahd, &info, sizeof info ) != SUCCESS )
        return MYFAILURE;

    printf( "        Queue ID = %d\n",      info.queueid    );
    printf( "         User ID = %08Xh\n",   info.userid     );
    printf( "      AG Channel = %08Xh\n",   info.channel    );
    printf( "Last AGLIB Error = %d \n",     info.agliberr   );
    printf( "  AG Buffer Size = %d\n",      info.maxbufsize );
    printf( "        Protocol = %s\n",      info.tcpname    );
    printf( "    Board Number = %d\n",      info.board      );
    printf( "Stream:Slot,Mode = %d:%d,",    info.stream, info.timeslot );

    switch( info.mode )
    {
        case ADI_FULL_DUPLEX   : puts("ADI_FULL_DUPLEX" );   break;
        case ADI_VOICE_DUPLEX  : puts("ADI_VOICE_DUPLEX" );  break;
        case ADI_SIGNAL_DUPLEX : puts("ADI_SIGNAL_DUPLEX" ); break;
        default:
            if( info.mode & ADI_VOICE_INPUT  ) printf( "+ADI_VOICE_INPUT"  );
            if( info.mode & ADI_VOICE_OUTPUT ) printf( "+ADI_VOICE_OUTPUT" );
            if( info.mode & ADI_SIGNAL_INPUT ) printf( "+ADI_SIGNAL_INPUT" );
            if( info.mode & ADI_SIGNAL_OUTPUT) printf( "+ADI_SIGNAL_OUTPUT");
            printf( "\n" );
                break;
    }
    printf("\n");
    return SUCCESS;
}



(Page 16 of 80 in this chapter)


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