nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ at_parser_max_params_from_str()

int at_parser_max_params_from_str ( const char *  at_params_str,
char **  next_param_str,
struct at_param_list *const  list,
size_t  max_params_count 
)

#include <include/modem/at_cmd_parser.h>

Parse a maximum number of AT command or response parameters from a string.

This function parses the parameters from at_params_str and saves them in list. If there are more parameters than max_params_count, they are ignored.

list must be initialized. It can be reused to parse multiple commands. When calling this function, the list is cleared. The maximum number of AT parameters that can be parsed and stored is limited by the size of list.

If an error is returned by the parser, the content of list should be ignored.

Parameters
at_params_strAT parameters as a null-terminated string. Can be numeric or string parameters.
next_param_strIn the case a string contains multiple notifications, the parser will stop parsing when it is done parsing the first notification, and return the remainder of the string in this pointer. The return code will be EAGAIN. If multinotification is not used, this pointer can be set to NULL.
listPointer to an initialized list where parameters are stored. Must not be NULL.
max_params_countMaximum number of parameters expected in at_params_str. Can be set to a smaller value to parse only some parameters.
Return values
0If the operation was successful.
-EAGAINNew notification detected in string re-run the parser with the string pointed to by next_param_str.
-E2BIGThe at_param_list supplied cannot hold all detected parameters in string. The list will contain the maximum number of parameters possible.
-EINVALOne or more of the supplied parameters are invalid.