/* Parse a list of impulse response arguments Helper function for cn0503_impulse_response, cn0503_fluo_decay_calibrate/measure.  */
int32_t impulse_response_parse_arg_list(struct cn0503_impulse_response *impresp, uint8_t *arg, void **argvals, uint8_t *arg_types, uint8_t nb_args, uint8_t nb_required_args, uint8_t *nb_args_parsed)
/* Parse a list of impulse response arguments Helper function for cn0503_impulse_response, cn0503_fluo_decay_calibrate/measure.  */
int32_t impulse_response_parse_arg_list(struct cn0503_impulse_response *impresp, uint8_t *arg, void **argvals, uint8_t *arg_types, uint8_t nb_args, uint8_t nb_required_args, uint8_t *nb_args_parsed)
{
	uint8_t i, *space_ptr;
	if (nb_args_parsed != NULL)
		*nb_args_parsed = 0;
	for (i = 0; i < nb_args; i++) {
		space_ptr = (uint8_t *)strchr((char *)arg, ' ');
		if (space_ptr)
			*space_ptr = 0;
		if (arg_types[i] == METHOD && strnlen((char *) arg, 4) < 3)
			return FAILURE;
		impulse_response_parse_arg(impresp, arg, argvals[i], arg_types[i]);
		if (nb_args_parsed != NULL)
			*nb_args_parsed++;
		if (space_ptr == NULL) {
			if (i < nb_required_args - 1)
				return FAILURE;
			else
				break;
		}
		arg = space_ptr + 1;
	}
	i++;
	return SUCCESS;
}