Skip to content

Commit b5b306e

Browse files
authored
Merge pull request #7052 from mirelachirica/bc95_sock_id_fix
Cellular: BC95 socket creation to fail on missing socket id in the re…
2 parents c151811 + 5c22622 commit b5b306e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

features/cellular/framework/AT/AT_CellularStack.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ nsapi_size_or_error_t AT_CellularStack::socket_sendto(nsapi_socket_t handle, con
250250

251251
_at.unlock();
252252
if (ret_val != NSAPI_ERROR_OK) {
253+
tr_error("Error creating socket to send to: %s error code: %d", addr.get_ip_address(), ret_val);
253254
return ret_val;
255+
} else {
256+
tr_info("Success creating socket to send to: %s", addr.get_ip_address());
254257
}
255258
}
256259

@@ -265,6 +268,12 @@ nsapi_size_or_error_t AT_CellularStack::socket_sendto(nsapi_socket_t handle, con
265268
_at.lock();
266269

267270
ret_val = socket_sendto_impl(socket, addr, data, size);
271+
272+
if (ret_val <= 0) {
273+
tr_error("Error sending to: %s error code: %d", addr.get_ip_address(), ret_val);
274+
} else {
275+
tr_info("Success sending %d Bytes to: %s", ret_val, addr.get_ip_address());
276+
}
268277

269278
_at.unlock();
270279

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ nsapi_error_t QUECTEL_BC95_CellularStack::create_socket_impl(CellularSocket *soc
119119
}
120120
}
121121

122-
if (!socketOpenWorking) {
122+
if (!socketOpenWorking || (sock_id == -1)) {
123123
tr_error("Socket create failed!");
124124
return NSAPI_ERROR_NO_SOCKET;
125125
}

0 commit comments

Comments
 (0)