ublox-at-cellular-interface
Diff: UbloxATCellularInterface.cpp
- Revision:
- 30:0f571a4920c8
- Parent:
- 29:773cfb0fe56c
- Child:
- 31:07c9c5c3fb88
--- a/UbloxATCellularInterface.cpp Mon Jul 29 14:49:01 2019 +0500 +++ b/UbloxATCellularInterface.cpp Thu Aug 01 18:06:44 2019 +0500 @@ -467,6 +467,8 @@ bool UbloxATCellularInterface::disconnect_modem_stack() { bool success = false; + int active; + Timer t1; LOCK(); if (get_ip_address() != NULL) { @@ -477,6 +479,21 @@ } } } + t1.start(); + while (!(t1.read() >= 180)) { + if (_at->send("AT+UPSND=" PROFILE ",8") && _at->recv("+UPSND: %*d,%*d,%d\n", &active) && _at->recv("OK")) { + + if (active == 0) { //If context is deactivated, exit while loop and return status + tr_debug("Profile deactivated successfully"); + break; + } + else { + tr_error("Profile still active"); + rtos::ThisThread::sleep_for(5000); //Wait for 5 seconds and then try again + } + } + } + t1.stop(); UNLOCK(); return success;