PREV TOC HOME INDEX NEXT


9.8.3 Getting or Setting Protocol Configuration in Synchronous Mode

The Global Call RTCM feature allows the customer application to retrieve or change the default configuration of a protocol. Figure 38 shows the procedure for the synchronous mode.

Figure 38. Getting or Setting Protocol Configuration in Synchronous Mode

The following describes the procedure for getting or setting the configuration of a Protocol in the synchronous mode.

  1. Load the protocol (after, in many cases, calling the gc_OpenEx( ) function for the first channel running the protocol).
  2. Find the protocol ID by its name. Call the gc_QueryConfigData( ) function with:
    target type = GCTGT_GCLIB_SYSTEM
    target id = 0
    query ID = GCQUERY_PROTOCOL_NAME_TO_ID
    source data = protocol name
  3. Find the CDP parameter ID by its name. Call gc_QueryConfigData( ) function with:
    target type = GCTGT_PROTOCOL_SYSTEM
    target id = protocol ID
    query ID = GCQUERY_PARM_NAME_TO_ID
    source data = CDP name
  4. Create the target object data (a GC_PARM_BLK data structure) with the appropriate set ID, parm ID, value size, and value by calling the Global Call utility functions gc_util_insert_ref( ) or gc_util_insert_val( ). See the Global Call API Library Reference for more information.
  5. Call the gc_GetConfigData( ) or gc_SetConfigData( ) function with:
    target_type = GCTGT_PROTOCOL_SYSTEM (for getting or setting the parameter on a system-wide basis, that is, for all channels) or GCTGT_PROTOCOL_CHAN (for getting or setting the parameter on an individual channel)
    target_id = protocol ID
    time_out = 0
    mode = EV_SYNC

    Note: If a CDP parameter value is changed, the change takes effect for newly opened devices only. It does not apply to devices that are already opened.

  6. If the gc_GetConfigData( ) function returns successfully, then obtain the individual parameter data by calling the gc_util_get_next_parm( ) function. If an error occurs, call the gc_ErrorInfo( ) function to find the error and correct it.
  7. Call the gc_OpenEx( ) function to open other channels with updated values of CDP parameters.

The following code shows a function that can be used to change a modifiable CDP parameter value for a channel:

// name = CDP parameter name
// val = pointer to data
// size = size of data  
void ChangeChannelCDPParm( LINEDEV chan, char *name, void *val,  int size )
{
    int id;         /* protocol ID */
    char prot_name[] = "pdk_ar_r2_io";
    GC_PARM src, dest;
    GC_PARM_ID pair;
    GC_PARM_BLK *pblkp = NULL;
    GC_PARM_DATA *parm;
    long req_id;  
    // Get Protocol ID from name
    src.paddress = prot_name;
    gc_QueryConfigData( GCTGT_GCLIB_SYSTEM, 0, &src,
                        GCQUERY_PROTOCOL_NAME_TO_ID, &dest );
    id = dest.intvalue;  
    // Get CDP parameter IDs from name
    src.paddress = name;
    dest.pstruct = &pair;
    gc_QueryConfigData( GCTGT_PROTOCOL_SYSTEM, id, &src,
                        GCQUERY_PARM_NAME_TO_ID, &dest );  
    // Build GC_PARM_BLK and call SetConfigData to change CDP parameter
    gc_util_insert_parm_ref( &pblkp, pair.set_ID, pair.parm_ID, size, val );
    gc_SetConfigData( GCTGT_PROTOCOL_CHAN, chan, pblkp, 0, GCUPDATE_ATNULL,
                  &req_id, EV_SYNC ); /* Must be GCUPDATE_ATNULL for CDP parameters */ 
    gc_util_delete_parm_blk( pblkp );
    pblkp = NULL;  /* strictly speaking, not necessary, but it is good practice to 
                      always set the parm block pointer to NULL when done with it */ 
}  

PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

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