Command callback

Command callback is defined as function with result of type scpi_result_t and one parameter - scpi context

	scpi_result_t DMM_MeasureVoltageDcQ(scpi_t * context)

Command callback should return SCPI_RES_OK if everything goes well.

You can read command parameters and write command results. There are several functions to do this.

Every time, you call function to read parameter, it shifts pointers to the next parameter. You can’t read specified parameter directly by its index - e.g.

	// pseudocode
	param3 = read_param(3); // this is not possible

	read_param();           // discard first parameter
	read_param();           // discard second parameter
	param3 = read_param();  // read third parameter

If you discard some parameters, there is no way to recover them.

Specifying mandatory parameter will introduce SCPI Error -109 “Missing parameter” if parameter is missing.

These are the functions, you can use to read parameters

These are the functions, you can use to write results

You can use function SCPI_NumberToStr to convert number with units to textual representation and then use SCPI_ResultMnemonic to write this to the user.

You can use SCPI_Parameter in conjuction with SCPI_ParamIsNumber, SCPI_ParamToInt, SCPI_ParamToDouble, SCPI_ParamToChoice in your own parameter type handlers.

SCPI_ParamNumber is more universal. It can handle number with units, it can handle special numbers like DEF, INF, … These special numbers are now defined in parameter and not in context. It is possible to define more general usage with different special numbers for different commands.