1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

driver/at: add return code for CME/CMS errors

in case of CME or CMS errors, the error codes or human readable strings
are in the response buffer. We want to indicate to the AT driver user
that when tihs case occurrs so he can extract the error codes.
This commit is contained in:
Toon Stegen 2019-06-06 21:45:29 +02:00
parent b4079badf7
commit 331c0db5cf
2 changed files with 7 additions and 5 deletions

View File

@ -208,10 +208,10 @@ ssize_t at_send_cmd_get_lines(at_dev_t *dev, const char *command,
return -1;
}
else if (strncmp(pos, "+CME ERROR:", 11) == 0) {
return -1;
return -2;
}
else if (strncmp(pos, "+CMS ERROR:", 11) == 0) {
return -1;
return -2;
}
else {
pos += res;

View File

@ -183,8 +183,9 @@ ssize_t at_send_cmd_get_resp(at_dev_t *dev, const char *command, char *resp_buf,
* This function sends the supplied @p command, then returns all response
* lines until the device sends "OK".
*
* If a line starts with "ERROR" or "+CME ERROR:", or the buffer is full, the
* function returns -1.
* If a line starts with "ERROR" or the buffer is full, the function returns -1.
* If a line starts with "+CME ERROR" or +CMS ERROR", the function returns -2.
* In this case resp_buf contains the error string.
*
* @param[in] dev device to operate on
* @param[in] command command to send
@ -194,7 +195,8 @@ ssize_t at_send_cmd_get_resp(at_dev_t *dev, const char *command, char *resp_buf,
* @param[in] timeout timeout (in usec)
*
* @returns length of response on success
* @returns <0 on error
* @returns -1 on error
* @returns -2 on CMS or CME error
*/
ssize_t at_send_cmd_get_lines(at_dev_t *dev, const char *command, char *resp_buf,
size_t len, bool keep_eol, uint32_t timeout);