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

◆ at_parser_string_get()

int at_parser_string_get ( struct at_parser parser,
size_t  index,
char *  str,
size_t *  len 
)

#include <include/modem/at_parser.h>

Get a string value.

The data type must be a string (quoted or non-quoted), an AT command prefix, or an array, otherwise an error is returned. The string value is copied to the buffer and null-terminated. len must be at least string length plus one, or an error is returned.

Parameters
[in]parserAT parser.
[in]indexIndex in the current AT command line configured in parser.
[in]strPointer to the buffer where to copy the value.
[in,out]lenAvailable space in str, returns the length of the copied string.
Return values
0If the operation was successful. Otherwise, a (negative) error code is returned.
-EINVALOne or more of the supplied parameters are invalid.
-EPERMparser has not been initialized.
-EOPNOTSUPPOperation not supported for the type of value at the given index.
-ENOMEMstr is smaller than the null-terminated string to be copied.
-EBADMSGThe AT command string is malformed.
-EAGAINParsing of the current AT command line is terminated and a subsequent line is available. Returned when index is greater than the maximum index for the current AT command line.
-EIOThere is nothing more to parse in the AT command string configured in parser. Returned when index is greater than the maximum index for the current AT command line.