cellular socket flags updated

pull/11023/head
mudassar-ublox 2019-06-14 17:28:04 +05:00 committed by Evelyne Donnaes
parent a8fdcdee69
commit 0e6e1a6309
2 changed files with 9 additions and 0 deletions

View File

@ -55,6 +55,7 @@ void UBLOX_AT_CellularStack::UUSORD_URC()
socket = find_socket(a); socket = find_socket(a);
if (socket != NULL) { if (socket != NULL) {
socket->rx_avail = true;
socket->pending_bytes = b; socket->pending_bytes = b;
// No debug prints here as they can affect timing // No debug prints here as they can affect timing
// and cause data loss in UARTSerial // and cause data loss in UARTSerial
@ -75,6 +76,7 @@ void UBLOX_AT_CellularStack::UUSORF_URC()
socket = find_socket(a); socket = find_socket(a);
if (socket != NULL) { if (socket != NULL) {
socket->rx_avail = true;
socket->pending_bytes = b; socket->pending_bytes = b;
// No debug prints here as they can affect timing // No debug prints here as they can affect timing
// and cause data loss in UARTSerial // and cause data loss in UARTSerial
@ -151,6 +153,7 @@ nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
} }
} }
socket->started = true;
socket->id = sock_id; socket->id = sock_id;
return NSAPI_ERROR_OK; return NSAPI_ERROR_OK;
@ -383,6 +386,7 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
} }
timer.stop(); timer.stop();
socket->rx_avail = false;
socket->pending_bytes = 0; socket->pending_bytes = 0;
if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) { if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) {
return NSAPI_ERROR_WOULD_BLOCK; return NSAPI_ERROR_WOULD_BLOCK;
@ -431,6 +435,8 @@ void UBLOX_AT_CellularStack::clear_socket(CellularSocket *socket)
{ {
if (socket != NULL) { if (socket != NULL) {
socket->id = SOCKET_UNUSED; socket->id = SOCKET_UNUSED;
socket->started = false;
socket->rx_avail = false;
socket->pending_bytes = 0; socket->pending_bytes = 0;
socket->closed = true; socket->closed = true;
if (socket->_cb) { if (socket->_cb) {

View File

@ -54,6 +54,7 @@ void UBLOX_N2XX_CellularStack::NSONMI_URC()
socket = find_socket(a); socket = find_socket(a);
if (socket != NULL) { if (socket != NULL) {
socket->rx_avail = true;
socket->pending_bytes = b; socket->pending_bytes = b;
// No debug prints here as they can affect timing // No debug prints here as they can affect timing
// and cause data loss in UARTSerial // and cause data loss in UARTSerial
@ -106,6 +107,7 @@ nsapi_error_t UBLOX_N2XX_CellularStack::create_socket_impl(CellularSocket *socke
} }
} }
socket->started = true;
socket->id = sock_id; socket->id = sock_id;
return NSAPI_ERROR_OK; return NSAPI_ERROR_OK;
@ -218,6 +220,7 @@ nsapi_size_or_error_t UBLOX_N2XX_CellularStack::socket_recvfrom_impl(CellularSoc
} }
timer.stop(); timer.stop();
socket->rx_avail = false;
socket->pending_bytes = 0; socket->pending_bytes = 0;
if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) { if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) {
return NSAPI_ERROR_WOULD_BLOCK; return NSAPI_ERROR_WOULD_BLOCK;