(Page 10 of 80 in this chapter)


adiConfigParm

Description

Modifies a single field in the default parameter database.

Prototype

DWORD adiConfigParm( char *parmname,
void
*data,
unsigned
size )

parmname Named specification of the parameter in the form "structure.field".

data Pointer to the new default value.

size Size of the parameter field value (the size must match the size of the parameter you are modifying).

Return Values

Events

None.

Details

adiConfigParm changes the value of an AG Access parameter. This will affect all ports and contexts in the executing process.

The default values for AG Access parameters are used when a function call passes a NULL. You can retrieve the default values with adiGetParms or adiGetParmByName.

Note: When the AG Access daemon (addaemon) is running, default values for AG Access parameters are retained in system shared memory. Any process executing adiConfigParm will affect the default value seen by all running and future processes executed after the daemon was launched.

See Also

adiGetParms, adiGetParmByName, adiGetParmInfo

Example


int setparm( char *str, char *val )
{
    int ret;
    ADI_PARM_INFO info;
    union 
    {
        WORD w;
        DWORD W;
        INT16 i;
        INT32 I;
        char s[80];
    } pdata;
    if( ( ret = adiGetParmInfo( 0, str, 0, &info ) ) != 0 )
    {
        printf( "not found\n" );
        return ret;
    }
    switch( info.format )
    {
     case ADI_FMT_INT32:
     case ADI_FMT_DWORD:
         pdata.W = (DWORD)strtoul( val, NULL, 0 );
         break;
     case ADI_FMT_INT16:
     case ADI_FMT_WORD:
         pdata.w =  (WORD)strtoul( val, NULL, 0 );
         break;
     case ADI_FMT_STRING:
         strcpy( (char *)&pdata.s, val );
         break;
     default:
         printf( "Error! Unknown data type: '%c'\n", info.format );
         return -1;
    }
    if( ( ret = adiConfigParm( str, &pdata, info.size ) ) != 0 )
    {
        printf( "write error\n" );
        return ret;
    }

    printf( "ok\n" );
    return 0;
}



(Page 10 of 80 in this chapter)


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