Skip to content

Commit

Permalink
Merge pull request #10840 from u-blox/socket_flag_update
Browse files Browse the repository at this point in the history
Cellular: cellular socket flags updated
  • Loading branch information
0xc0170 authored Jul 1, 2019
2 parents 85c477c + 26f1d0b commit 60d047c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void UBLOX_AT_CellularStack::UUSORD_URC()

socket = find_socket(a);
if (socket != NULL) {
socket->rx_avail = true;
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
Expand All @@ -75,6 +76,7 @@ void UBLOX_AT_CellularStack::UUSORF_URC()

socket = find_socket(a);
if (socket != NULL) {
socket->rx_avail = true;
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
Expand Down Expand Up @@ -151,6 +153,7 @@ nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
}
}

socket->started = true;
socket->id = sock_id;

return NSAPI_ERROR_OK;
Expand Down Expand Up @@ -383,6 +386,7 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
}
timer.stop();

socket->rx_avail = false;
socket->pending_bytes = 0;
if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) {
return NSAPI_ERROR_WOULD_BLOCK;
Expand Down Expand Up @@ -431,6 +435,8 @@ void UBLOX_AT_CellularStack::clear_socket(CellularSocket *socket)
{
if (socket != NULL) {
socket->id = SOCKET_UNUSED;
socket->started = false;
socket->rx_avail = false;
socket->pending_bytes = 0;
socket->closed = true;
if (socket->_cb) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void UBLOX_N2XX_CellularStack::NSONMI_URC()

socket = find_socket(a);
if (socket != NULL) {
socket->rx_avail = true;
socket->pending_bytes = b;
// No debug prints here as they can affect timing
// and cause data loss in UARTSerial
Expand Down Expand Up @@ -106,6 +107,7 @@ nsapi_error_t UBLOX_N2XX_CellularStack::create_socket_impl(CellularSocket *socke
}
}

socket->started = true;
socket->id = sock_id;

return NSAPI_ERROR_OK;
Expand Down Expand Up @@ -218,6 +220,7 @@ nsapi_size_or_error_t UBLOX_N2XX_CellularStack::socket_recvfrom_impl(CellularSoc
}
timer.stop();

socket->rx_avail = false;
socket->pending_bytes = 0;
if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) {
return NSAPI_ERROR_WOULD_BLOCK;
Expand Down

0 comments on commit 60d047c

Please sign in to comment.