Fixed IOTCELL-2384

Earlier we called AT+QICSGP only if the username and password was set.
It seems that we must call it also to set up APN while in AT mode.
This commit fixes the issue + updated IPv4/v6 handling to be correct in the same call
pull/12227/head
Antti Kauppila 2020-01-09 17:19:24 +02:00
parent dc6320239b
commit 2fb167be26
1 changed files with 10 additions and 1 deletions

View File

@ -69,11 +69,20 @@ ControlPlane_netif *QUECTEL_BG96_CellularContext::get_cp_netif()
nsapi_error_t QUECTEL_BG96_CellularContext::do_user_authentication()
{
uint8_t type = 1;
if ((uint8_t)_pdp_type > 1) {
type = 2;
}
if (_pwd && _uname) {
if (_at.at_cmd_discard("+QICSGP", "=", "%d%d%s%s%s%d", _cid, 1,
if (_at.at_cmd_discard("+QICSGP", "=", "%d%d%s%s%s%d", _cid, type,
_apn, _uname, _pwd, _authentication_type) != NSAPI_ERROR_OK) {
return NSAPI_ERROR_AUTH_FAILURE;
}
} else {
if (_at.at_cmd_discard("+QICSGP", "=", "%d%d%s", _cid, type,
_apn) != NSAPI_ERROR_OK) {
return NSAPI_ERROR_AUTH_FAILURE;
}
}
return NSAPI_ERROR_OK;