Skip to content

Commit

Permalink
Merge pull request #15521 from world-direct/feature/cellspam
Browse files Browse the repository at this point in the history
reduce spam on info log of cellular sockets
  • Loading branch information
0xc0170 authored Oct 8, 2024
2 parents d84a97a + 46e8545 commit d723bf9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ nsapi_size_or_error_t AT_CellularStack::socket_sendto(nsapi_socket_t handle, con
_at.unlock();

if (ret_val >= 0) {
tr_info("Socket %d sent %d bytes to %s port %d", find_socket_index(socket), ret_val, addr.get_ip_address(), addr.get_port());
tr_debug("Socket %d sent %d bytes to %s port %d", find_socket_index(socket), ret_val, addr.get_ip_address(), addr.get_port());
} else if (ret_val != NSAPI_ERROR_WOULD_BLOCK) {
tr_error("Socket %d sendto %s error %d", find_socket_index(socket), addr.get_ip_address(), ret_val);
}
Expand Down Expand Up @@ -362,9 +362,9 @@ nsapi_size_or_error_t AT_CellularStack::socket_recvfrom(nsapi_socket_t handle, S

if (ret_val >= 0) {
if (addr) {
tr_info("Socket %d recv %d bytes from %s port %d", find_socket_index(socket), ret_val, addr->get_ip_address(), addr->get_port());
tr_debug("Socket %d recv %d bytes from %s port %d", find_socket_index(socket), ret_val, addr->get_ip_address(), addr->get_port());
} else {
tr_info("Socket %d recv %d bytes", find_socket_index(socket), ret_val);
tr_debug("Socket %d recv %d bytes", find_socket_index(socket), ret_val);
}
} else if (ret_val != NSAPI_ERROR_WOULD_BLOCK) {
tr_error("Socket %d recv error %d", find_socket_index(socket), ret_val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,22 @@ nsapi_error_t QUECTEL_BG96_CellularContext::do_user_authentication()
type = 1;
}

auto debug = _at.get_debug();
_at.set_debug(false);
if (_pwd && _uname) {
if (_at.at_cmd_discard("+QICSGP", "=", "%d%d%s%s%s%d", _cid, type,
_apn, _uname, _pwd, _authentication_type) != NSAPI_ERROR_OK) {
_at.set_debug(debug);
return NSAPI_ERROR_AUTH_FAILURE;
}
} else {
if (_at.at_cmd_discard("+QICSGP", "=", "%d%d%s", _cid, type,
_apn) != NSAPI_ERROR_OK) {
_at.set_debug(debug);
return NSAPI_ERROR_AUTH_FAILURE;
}
}
_at.set_debug(debug);

return NSAPI_ERROR_OK;
}
Expand Down

0 comments on commit d723bf9

Please sign in to comment.