Merge pull request #10840 from u-blox/socket_flag_update

Cellular: cellular socket flags updated
pull/10928/head
Martin Kojtal 2019-07-01 09:04:16 +01:00 committed by GitHub
commit 60d047cae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
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
@ -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
@ -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;
@ -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;
@ -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) {

View File

@ -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
@ -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;
@ -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;