Implementation of the CellularInterface for u-blox C030 boards with N2xx modems. Note: requires the N211 module firmware to be at least 06.57 A01.02.

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

Files at this revision

API Documentation at this revision

Comitter:
rob.meades@u-blox.com
Date:
Thu Sep 14 10:29:22 2017 +0100
Parent:
6:658419981430
Child:
8:0162c103346a
Commit message:
Rename MAX_XXXX_SIZE macros to have N2XX on the end in order to avoid naming clash with non-N2xx flavour driver.

Changed in this revision

UbloxATCellularInterfaceN2xx.cpp Show annotated file Show diff for this revision Revisions of this file
UbloxATCellularInterfaceN2xx.h Show annotated file Show diff for this revision Revisions of this file
--- a/UbloxATCellularInterfaceN2xx.cpp	Wed Sep 13 15:57:06 2017 +0100
+++ b/UbloxATCellularInterfaceN2xx.cpp	Thu Sep 14 10:29:22 2017 +0100
@@ -255,7 +255,7 @@
     nsapi_size_or_error_t nsapi_error_size = NSAPI_ERROR_DEVICE_ERROR;
     bool success = true;
     const char *buf = (const char *) data;
-    nsapi_size_t blk = MAX_WRITE_SIZE;
+    nsapi_size_t blk = MAX_WRITE_SIZE_N2XX;
     nsapi_size_t count = size;
     SockCtrl *socket = (SockCtrl *) handle;
 
@@ -264,9 +264,9 @@
 
     MBED_ASSERT (check_socket(socket));
 
-    tr_debug("Max Write Size for SendTo: %d", MAX_WRITE_SIZE);
-    if (size > MAX_WRITE_SIZE) {
-        tr_warn("WARNING: packet length %d is too big for one UDP packet (max %d), will be fragmented.", size, MAX_WRITE_SIZE);
+    tr_debug("Max Write Size for SendTo: %d", MAX_WRITE_SIZE_N2XX);
+    if (size > MAX_WRITE_SIZE_N2XX) {
+        tr_warn("WARNING: packet length %d is too big for one UDP packet (max %d), will be fragmented.", size, MAX_WRITE_SIZE_N2XX);
     }
 
     while ((count > 0) && success) {
@@ -432,7 +432,7 @@
         at_timeout = _at_timeout;
         at_set_timeout(1000);
         
-        read_blk = MAX_READ_SIZE;
+        read_blk = MAX_READ_SIZE_N2XX;
         if (read_blk > size) {
             read_blk = size;
         }
@@ -460,7 +460,7 @@
                 buf += nsapi_error_size;
                 size -= nsapi_error_size;
                 
-                if (((uint)nsapi_error_size < read_blk) || (nsapi_error_size == MAX_READ_SIZE))
+                if (((uint)nsapi_error_size < read_blk) || (nsapi_error_size == MAX_READ_SIZE_N2XX))
                     size = 0;     // If we've received less than we asked for, or
                                   // the max size, then a whole UDP packet has arrived and
                                   // this means DONE.
@@ -506,7 +506,7 @@
 
     memset (ipAddress, 0, sizeof (ipAddress)); // Ensure terminator
     
-    if (length > MAX_READ_SIZE) {
+    if (length > MAX_READ_SIZE_N2XX) {
         return NSAPI_ERROR_UNSUPPORTED;
     }
     
--- a/UbloxATCellularInterfaceN2xx.h	Wed Sep 13 15:57:06 2017 +0100
+++ b/UbloxATCellularInterfaceN2xx.h	Thu Sep 14 10:29:22 2017 +0100
@@ -281,12 +281,12 @@
     /** The maximum number of bytes in a packet that can be written
      * to the AT interface in one go.
      */
-    #define MAX_WRITE_SIZE 512
+    #define MAX_WRITE_SIZE_N2XX 512
 
     /** The maximum number of bytes in a packet that can be read from
      * from the AT interface in one go.
      */
-    #define MAX_READ_SIZE 512
+    #define MAX_READ_SIZE_N2XX 512
 
     /** Management structure for sockets.
      */