Implementation of the CellularInterface for u-blox C027 and C030 (non-N2xx flavour) modems that uses the IP stack on-board the cellular modem, hence not requiring LWIP (and so less RAM) and allowing any AT command exchanges to be carried out at the same time as data transfers (since the modem remains in AT mode all the time). This library may be used from mbed 5.5 onwards. If you need to use SMS, USSD or access the modem file system at the same time as using the CellularInterface then use ublox-at-cellular-interface-ext instead.

Dependents:   example-ublox-cellular-interface example-ublox-cellular-interface_r410M example-ublox-mbed-client example-ublox-cellular-interface ... more

Branch:
profile_polling
Revision:
31:07c9c5c3fb88
Parent:
30:0f571a4920c8
Child:
33:5d5ce25405d4
--- a/UbloxATCellularInterface.cpp	Thu Aug 01 18:06:44 2019 +0500
+++ b/UbloxATCellularInterface.cpp	Fri Aug 02 11:32:14 2019 +0500
@@ -274,13 +274,29 @@
              success && (protocol <= nsapi_security_to_modem_security(NSAPI_SECURITY_CHAP)); protocol++) {
             if ((_auth == NSAPI_SECURITY_UNKNOWN) || (nsapi_security_to_modem_security(_auth) == protocol)) {
                 if (_at->send("AT+UPSD=" PROFILE ",6,%d", protocol) && _at->recv("OK")) {
-                    // Activate, waiting 30 seconds for the connection to be made
-                    at_set_timeout(30000);
-                    activated = _at->send("AT+UPSDA=" PROFILE ",3") && _at->recv("OK");
+                    at_set_timeout(3*60*1000);
+                    _at->send("AT+UPSDA=" PROFILE ",3") && _at->recv("OK");
                     at_set_timeout(at_timeout);
                 }
             }
         }
+
+        Timer timer;
+        timer.start();
+        while (timer.read() < 180) {
+            if (_at->send("AT+UPSND=" PROFILE ",8") && _at->recv("+UPSND: %*d,%*d,%d\n", &active) &&
+                _at->recv("OK")) {
+                if (active == 1) {
+                    tr_debug("Profile activated successfully");
+                    activated = true;
+                    break;
+                } else {
+                    tr_error("Profile still inactive");
+                    rtos::ThisThread::sleep_for(5000); //Wait for 5 seconds and then try again
+                }
+            }
+        }
+        timer.stop();
     }
 
     return activated;