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
Diff: UbloxATCellularInterfaceN2xx.cpp
- Revision:
- 10:08c5a69437ac
- Parent:
- 9:f6d022f5c4f5
- Parent:
- 8:0162c103346a
- Child:
- 12:b0757007cc72
--- a/UbloxATCellularInterfaceN2xx.cpp Thu Sep 28 15:18:00 2017 +0100 +++ b/UbloxATCellularInterfaceN2xx.cpp Thu Sep 28 15:19:21 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) { @@ -435,7 +435,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; } @@ -455,7 +455,7 @@ if (nsapi_error_size >= 0) { memcpy(buf, tmpBuf, nsapi_error_size); - if (read_blk != (uint) nsapi_error_size) + if (read_blk != (uint32_t) nsapi_error_size) tr_debug("Requested size is not the same as the returned size."); socket->pending -= nsapi_error_size; @@ -463,7 +463,7 @@ buf += nsapi_error_size; size -= nsapi_error_size; - if (((uint)nsapi_error_size < read_blk) || (nsapi_error_size == MAX_READ_SIZE)) + if (((uint32_t) 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. @@ -509,7 +509,7 @@ memset (ipAddress, 0, sizeof (ipAddress)); // Ensure terminator - if (length > MAX_READ_SIZE) { + if (length > MAX_READ_SIZE_N2XX) { return NSAPI_ERROR_UNSUPPORTED; }