(Page 23 of 80 in this chapter)


adiGetParmInfo

Description

Retrieves a parameter definition.

Prototype

DWORD adiGetParmInfo( unsigned parmid,
char *parmname,
unsigned index,
ADI_PARM_INFO *info )

parmid Parameter structure ID.

parmname Pointer to the parameter name (use NULL if the parmid specifies a valid parameter ID).

index Relative field within the parameter structure.

info Buffer to receive a copy of ADI_PARM_INFO, whose structure is shown below:

typedef struct
{       /* Describes the fields          */
 char structname[40];     /* name of the structure         */
 char fieldname[40];     /* name of the field         */
 DWORD offset;     /* byte offset from the base          */
 DWORD size;     /* size of the field         */
 DWORD format;     /* format type         */
 DWORD units;     /* units type         */
} ADI_PARM_INFO;

Return Values

Events

None.

Details

This function retrieves a single parameter definition conveyed as an ADI_PARM_INFO structure. The parameter structure can be specified either by name or numeric ID.

If parmname is non-NULL, AG Access searches for the parameter structure named therein. The parmname format is structname or structure[.fieldname].

If the field name is not supplied in the parmname, AG Access uses the given index as the field (parameter) selector. The first parameter within the structure is indexed as 0, the second as 1 and so on.

If parmname is NULL, the parmid is used to retrieve the parameter structure and the index is used as the parameter selector. The parameter IDs are defined in the adidef.h include file. The IDs are of the form: ADI_xxx_PARMID (e.g., ADI_RECORD_PARMID).

The returned ADI_PARM_INFO structure contains the following fields:

Field

Description

structname

The parameter's structure name.

fieldname

The parameter's field name.

offset

The value's offset in the parameter structure.

size

The parameter value size (bytes).

format

The parameter value format.

units

The parameter value units.

The following formats are supported:

Format

Description

ADI__FMT_WORD

Field is a 16-bit unsigned quantity.

ADI_FMT_DWORD

Field is a 32-bit unsigned quantity.

ADI_FMT_INT16

Field is a 16-bit signed quantity.

ADI_FMT_INT32

Field is a 32-bit signed quantity.

ADI_FMT_STRING

Field is a NULL-terminated string.

The following units are supported:

Unit

Description

ADI_UNITS_INTERNAL

No engineering units available.

ADI_UNITS_INTEGER

Field is a count or index.

ADI_UNITS_COUNT

Field is a "number of something."

ADI_UNITS_MASK

Field is a bit mask.

ADI_UNITS_MS

Field contains milliseconds.

ADI_UNITS_DB

Field is a relative signal level.

ADI_UNITS_DBM

Field is an absolute signal level.

ADI_UNITS_IDU

Field is in internal DSP units (NMS internal representation for amplitude).

ADI_UNITS_HZ

Field contains frequency (Hertz: cycles per second).

ADI_UNITS_STRING

Field contains a string.

ADI_UNITS_PERCENT

Field contains a percentage (where 100 is 100 percent).

See Also

adiGetParms, adiGetParmByName, adiConfigParm

Example


void myShowParmInfo( char *parmname )
{
    ADI_PARM_INFO info;
    BYTE temp[100]; /* temp storage for parm value */
    union 
    {
        WORD  w;
        DWORD W;
        INT16 i;
        INT32 I;
        char  s[80];
    } *pdata =( void* ) temp;
    char *punits;

    if( adiGetParmInfo( 0, parmname, 0, &info ) != SUCCESS
     || adiGetParmByName( parmname, &temp, sizeof temp ) != SUCCESS )
    {
        /* display error */
        return;
    }

    switch( info.units )
    {
     case ADI_UNITS_INTERNAL: punits = "Internal";     break;
     case ADI_UNITS_INTEGER : punits = "Integer";      break;
     case ADI_UNITS_COUNT   : punits = "Count";        break;
     case ADI_UNITS_MASK    : punits = "Mask";         break;
     case ADI_UNITS_HZ      : punits = "Hz";           break;
     case ADI_UNITS_MS      : punits = "ms";           break;
     case ADI_UNITS_DB      : punits = "dB";           break;
     case ADI_UNITS_DBM     : punits = "dBm";          break;
     case ADI_UNITS_IDU     : punits = "Internal DSP"; break;
     case ADI_UNITS_STRING  : punits = "String";       break;
     case ADI_UNITS_PERCENT : punits = "Percent";      break;
     default                : punits = "Undefined";    break;
    }

    switch( info.format )
    {
        case ADI_FMT_WORD:
            printf( "%s.%-20s = %5u\t\t# (0x%04x) WORD  (%s)\n",
                    info.structname, info.fieldname, pdata->w, pdata->w, punits );
            break;
        case ADI_FMT_DWORD:
            printf( "%s.%-20s = %5u\t\t# (0x%04x) DWORD (%s)\n",
                    info.structname, info.fieldname, pdata->W, pdata->W, punits );
            break;
        case ADI_FMT_INT16:
            printf( "%s.%-20s = %5d\t\t# (0x%04x) INT16 (%s)\n",
                    info.structname, info.fieldname, pdata->i, pdata->i, punits );
            break;
        case ADI_FMT_INT32:
            printf( "%s.%-20s = %5d\t\t# (0x%04x) INT32 (%s)\n",
                    info.structname, info.fieldname, pdata->I, pdata->I, punits );
            break;
        case ADI_FMT_STRING:
            printf( "%s.%-20s = \"%s\"\t\t# STRING[%d]\n",
                    info.structname, info.fieldname, pdata->s, info.size );
            break;
        default:
            printf( "Error! Unknown data type: '%c'\n",
                    info.format );
            break;
    }
    return;
}



(Page 23 of 80 in this chapter)


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