Deactivate PDP context on disconnect when using AT stack.

pull/6082/head
Juho Eskeli 2018-02-15 14:35:21 +02:00 committed by Ari Parkkila
parent 66aca1fddf
commit 71f54bc2d4
1 changed files with 14 additions and 1 deletions

View File

@ -195,7 +195,20 @@ nsapi_error_t AT_CellularNetwork::disconnect()
#if NSAPI_PPP_AVAILABLE
return nsapi_ppp_disconnect(_at.get_file_handle());
#else
return NSAPI_ERROR_OK;
_at.lock();
_at.cmd_start("AT+CGACT=0,");
_at.write_int(_cid);
_at.cmd_stop();
_at.resp_start();
_at.resp_stop();
_at.restore_at_timeout();
_connect_status = NSAPI_STATUS_DISCONNECTED;
if (_connection_status_cb) {
_connection_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED);
}
return _at.unlock_return_error();
#endif
}