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

Revision:
26:4f28a1eaa2aa
Parent:
25:aabc50bc418e
Child:
29:773cfb0fe56c
--- a/UbloxATCellularInterface.cpp	Mon May 20 07:56:16 2019 +0000
+++ b/UbloxATCellularInterface.cpp	Wed May 22 16:14:50 2019 +0500
@@ -1203,6 +1203,9 @@
     nsapi_error_t nsapi_error = NSAPI_ERROR_DEVICE_ERROR;
 #ifdef TARGET_UBLOX_C030_R41XM
     if (nwk_deregistration()) {
+        if (_connection_status_cb) {
+            _connection_status_cb(NSAPI_ERROR_CONNECTION_LOST);
+        }
 #else
     if (disconnect_modem_stack() && nwk_deregistration()) {
 #endif
@@ -1290,6 +1293,15 @@
         // +UPSND=<profile_id>,<param_tag>[,<dynamic_param_val>]
         // If we get back a quoted "w.x.y.z" then we have an IP address,
         // otherwise we don't.
+#ifdef TARGET_UBLOX_C030_R41XM
+        if (!_at->send("AT+CGPADDR=1") ||
+            !_at->recv("+CGPADDR: 1,%" u_stringify(NSAPI_IP_SIZE) "[^\n]\nOK\n", _ip) ||
+            !address.set_ip_address(_ip) || // Return NULL if the address is not a valid one
+            !address) { // Return null if the address is zero
+            free (_ip);
+            _ip = NULL;
+        }
+#else
         if (!_at->send("AT+UPSND=" PROFILE ",0") ||
             !_at->recv("+UPSND: " PROFILE ",0,\"%" u_stringify(NSAPI_IP_SIZE) "[^\"]\"", _ip) ||
             !_at->recv("OK") ||
@@ -1298,6 +1310,7 @@
             free (_ip);
             _ip = NULL;
         }
+#endif
     }
 
     UNLOCK();