nRF Connect SDK API 0.1.0
|
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.
[in] | parser | AT parser. |
[in] | index | Index in the current AT command line configured in parser . |
[in] | str | Pointer to the buffer where to copy the value. |
[in,out] | len | Available space in str , returns the length of the copied string. |
0 | If the operation was successful. Otherwise, a (negative) error code is returned. |
-EINVAL | One or more of the supplied parameters are invalid. |
-EPERM | parser has not been initialized. |
-EOPNOTSUPP | Operation not supported for the type of value at the given index. |
-ENOMEM | str is smaller than the null-terminated string to be copied. |
-EBADMSG | The AT command string is malformed. |
-EAGAIN | Parsing 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. |
-EIO | There 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. |