Skip to content

Cellular: Handle SEND FAIL and ERROR response #11534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,17 @@ nsapi_size_or_error_t QUECTEL_BG96_CellularStack::socket_sendto_impl(CellularSoc
_at.write_bytes((uint8_t *)data, size);
_at.resp_start();
_at.set_stop_tag("\r\n");
// Possible responses are SEND OK, SEND FAIL or ERROR.
char response[16];
response[0] = '\0';
_at.read_string(response, sizeof(response));
_at.resp_stop();
if (strcmp(response, "SEND OK") != 0) {
return NSAPI_ERROR_DEVICE_ERROR;
}

// Get the sent count after sending

nsapi_size_or_error_t err = _at.at_cmd_int("+QISEND", "=", sent_len_after, "%d%d", socket->id, 0);

if (err == NSAPI_ERROR_OK) {
sent_len = sent_len_after - sent_len_before;
return sent_len;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,14 @@ nsapi_size_or_error_t QUECTEL_M26_CellularStack::socket_sendto_impl(CellularSock
_at.write_bytes((uint8_t *)data, sent_len);
_at.resp_start();
_at.set_stop_tag("\r\n");
// Possible responses are SEND OK, SEND FAIL or ERROR.
char response[16];
response[0] = '\0';
_at.read_string(response, sizeof(response));
_at.resp_stop();
if (strcmp(response, "SEND OK") != 0) {
return NSAPI_ERROR_DEVICE_ERROR;
}

if (_at.get_last_error() != NSAPI_ERROR_OK) {
tr_error("QUECTEL_M26_CellularStack:%s:%u:[NSAPI_ERROR_DEVICE_ERROR]", __FUNCTION__, __LINE__);
Expand Down