SCPI_Parameter()

scpi_bool_t
SCPI_Parameter(
    scpi_t * context,
    scpi_parameter_t * parameter,
    scpi_bool_t mandatory);

This function is for universal processing of parameters. It doesn’t do any cnversions. It is used in all SCPI_ParamXYZ() functions so for basic usage, you can prefere these functions. If you need some special processing of parameter, which can be for example integer, mnemonic or expression, you need to define your own processing functions.

Next parameter is stored in parameter structure.

If mandatory is TRUE and parameter is missing, SCPI error -109, “Missing parameter” is also generated for this.

Parameter description

scpi_parameter_t type has this fields

It is possible to use functions SCPI_ParamIsNumber(), SCPI_ParamToInt(), SCPI_ParamToUnsignedInt(), SCPI_ParamToDouble(), SCPI_ParamToChoice() for further processing of parameter.

Usage example

scpi_bool_t res;
scpi_parameter_t param1;
uint32_t value = 0;

res = SCPI_Parameter(context, &param1, FALSE);

if (res) {
    if (param.type == SCPI_TOKEN_PROGRAM_EXPRESSION) {
        if (strncpy(param.ptr, "(1)", param.len)) {
            value = 1;
        }
    }
}