nRF Connect SDK API 0.1.0
|
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.
at_params_str | AT parameters as a null-terminated string. Can be numeric or string parameters. |
next_param_str | In 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. |
list | Pointer to an initialized list where parameters are stored. Must not be NULL. |
max_params_count | Maximum number of parameters expected in at_params_str . Can be set to a smaller value to parse only some parameters. |
0 | If the operation was successful. |
-EAGAIN | New notification detected in string re-run the parser with the string pointed to by next_param_str . |
-E2BIG | The at_param_list supplied cannot hold all detected parameters in string. The list will contain the maximum number of parameters possible. |
-EINVAL | One or more of the supplied parameters are invalid. |