fork

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();