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

Files at this revision

API Documentation at this revision

Comitter:
rob.meades@u-blox.com
Date:
Thu Jun 15 14:04:26 2017 +0100
Parent:
5:f6706249d076
Child:
7:3b2ca10cc23a
Commit message:
Improve template, add extra time for gethostbyname() as it seems to take an age on some networks, rename "driver" to "interface" for consistency with the PPP test suite.

Changed in this revision

TESTS/unit_tests/default/main.cpp Show annotated file Show diff for this revision Revisions of this file
TESTS/unit_tests/default/template_mbed_app.txt Show annotated file Show diff for this revision Revisions of this file
UbloxATCellularInterface.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TESTS/unit_tests/default/main.cpp	Tue Jun 13 10:09:57 2017 +0100
+++ b/TESTS/unit_tests/default/main.cpp	Thu Jun 15 14:04:26 2017 +0100
@@ -17,7 +17,12 @@
 
 // IMPORTANT!!! if you make a change to the tests here you should
 // check whether the same change should be made to the tests under
-// the GENERIC driver.
+// the PPP interface.
+
+// NOTE: these test are only as reliable as UDP across the internet
+// over a radio link.  The tests expect an NTP server to respond
+// to UDP packets and, if configured, an echo server to respond
+// to UDP packets.  This simply may not happen.  Please be patient.
 
 // ----------------------------------------------------------------
 // COMPILE-TIME MACROS
@@ -145,8 +150,8 @@
 static Mutex mtx;
 #endif
 
-// An instance of the cellular driver
-static UbloxATCellularInterface *driver =
+// An instance of the cellular interface
+static UbloxATCellularInterface *interface =
        new UbloxATCellularInterface(MDMTXD, MDMRXD,
                                     MBED_CONF_UBLOX_CELL_BAUD_RATE,
                                     MBED_CONF_APP_DEBUG_ON);
@@ -271,7 +276,7 @@
     *callback_triggered = true;
 }
 
-// Do a UDP echo but using the asynchronous driver; we can exchange
+// Do a UDP echo but using the asynchronous interface; we can exchange
 // packets longer in size than one UDP packet this way
 static void do_udp_echo_async(UDPSocket *sock, SocketAddress *host_address,
                               int size, bool *callback_triggered)
@@ -349,7 +354,7 @@
     return count;
 }
 
-// Do a TCP echo but using the asynchronous driver
+// Do a TCP echo but using the asynchronous interface
 static void do_tcp_echo_async(TCPSocket *sock, int size, bool *callback_triggered)
 {
     void * recv_data = malloc (size);
@@ -431,14 +436,14 @@
 }
 
 // Get NTP time
-static void do_ntp(UbloxATCellularInterface *driver)
+static void do_ntp(UbloxATCellularInterface *interface)
 {
     UDPSocket sock;
     SocketAddress host_address;
 
-    TEST_ASSERT(sock.open(driver) == 0)
+    TEST_ASSERT(sock.open(interface) == 0)
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_NTP_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_NTP_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_NTP_PORT);
 
     tr_debug("UDP: NIST server %s address: %s on port %d.", MBED_CONF_APP_NTP_SERVER,
@@ -452,13 +457,13 @@
 }
 
 // Use a connection, checking that it is good
-static void use_connection(UbloxATCellularInterface *driver)
+static void use_connection(UbloxATCellularInterface *interface)
 {
-    const char * ip_address = driver->get_ip_address();
-    const char * net_mask = driver->get_netmask();
-    const char * gateway = driver->get_gateway();
+    const char * ip_address = interface->get_ip_address();
+    const char * net_mask = interface->get_netmask();
+    const char * gateway = interface->get_gateway();
 
-    TEST_ASSERT(driver->is_connected());
+    TEST_ASSERT(interface->is_connected());
 
     TEST_ASSERT(ip_address != NULL);
     tr_debug ("IP address %s.", ip_address);
@@ -467,17 +472,17 @@
     TEST_ASSERT(gateway != NULL);
     tr_debug ("Gateway %s.", gateway);
 
-    do_ntp(driver);
+    do_ntp(interface);
     TEST_ASSERT(!connection_has_gone_down);
 }
 
 // Drop a connection and check that it has dropped
-static void drop_connection(UbloxATCellularInterface *driver)
+static void drop_connection(UbloxATCellularInterface *interface)
 {
-    TEST_ASSERT(driver->disconnect() == 0);
+    TEST_ASSERT(interface->disconnect() == 0);
     TEST_ASSERT(connection_has_gone_down);
     connection_has_gone_down = false;
-    TEST_ASSERT(!driver->is_connected());
+    TEST_ASSERT(!interface->is_connected());
 }
 
 // ----------------------------------------------------------------
@@ -489,11 +494,11 @@
     UDPSocket sock;
     SocketAddress host_address;
 
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    do_ntp(driver);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    do_ntp(interface);
     TEST_ASSERT(!connection_has_gone_down);
-    drop_connection(driver);
+    drop_connection(interface);
 }
 
 #ifdef MBED_CONF_APP_ECHO_SERVER
@@ -506,16 +511,16 @@
     int x;
     int size;
 
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_ECHO_UDP_PORT);
 
     tr_debug("UDP: Server %s address: %s on port %d.", MBED_CONF_APP_ECHO_SERVER,
              host_address.get_ip_address(), host_address.get_port());
 
-    TEST_ASSERT(sock.open(driver) == 0)
+    TEST_ASSERT(sock.open(interface) == 0)
 
     // Do a bind, just for the helluvit
     local_address.set_port(MBED_CONF_APP_LOCAL_PORT);
@@ -533,7 +538,7 @@
     }
 
     sock.close();
-    drop_connection(driver);
+    drop_connection(interface);
     tr_debug("%d UDP packets of size up to %d byte(s) echoed successfully.",
              x, MBED_CONF_APP_UDP_MAX_PACKET_SIZE);
 }
@@ -551,17 +556,17 @@
     bool sendSuccess;
     Timer timer;
 
-    driver->deinit();
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    interface->deinit();
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_ECHO_UDP_PORT);
 
     tr_debug("UDP: Server %s address: %s on port %d.", MBED_CONF_APP_ECHO_SERVER,
              host_address.get_ip_address(), host_address.get_port());
 
-    TEST_ASSERT(sock.open(driver) == 0)
+    TEST_ASSERT(sock.open(interface) == 0)
 
     do {
         tr_debug("--- UDP packet size test, test try %d, flushing input buffers", tries + 1);
@@ -645,7 +650,7 @@
     TEST_ASSERT(!packetLoss);
     TEST_ASSERT(!connection_has_gone_down);
     sock.close();
-    drop_connection(driver);
+    drop_connection(interface);
 }
 
 // Test UDP data exchange via the asynchronous sigio() mechanism
@@ -657,17 +662,17 @@
     int x;
     int size;
 
-    driver->deinit();
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    interface->deinit();
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_ECHO_UDP_PORT);
 
     tr_debug("UDP: Server %s address: %s on port %d.", MBED_CONF_APP_ECHO_SERVER,
              host_address.get_ip_address(), host_address.get_port());
 
-    TEST_ASSERT(sock.open(driver) == 0)
+    TEST_ASSERT(sock.open(interface) == 0)
 
     // Set up the async callback and set the timeout to zero
     sock.sigio(callback(async_cb, &callback_triggered));
@@ -686,7 +691,7 @@
 
     sock.close();
 
-    drop_connection(driver);
+    drop_connection(interface);
 
     tr_debug("%d UDP packets of size up to %d byte(s) echoed asynchronously and successfully.",
              x, MBED_CONF_APP_UDP_MAX_FRAG_PACKET_SIZE);
@@ -702,17 +707,17 @@
     char * recv_data;
     Timer timer;
 
-    driver->deinit();
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    interface->deinit();
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_ECHO_TCP_PORT);
 
     tr_debug("TCP: Server %s address: %s on port %d.", MBED_CONF_APP_ECHO_SERVER,
              host_address.get_ip_address(), host_address.get_port());
 
-    TEST_ASSERT(sock.open(driver) == 0)
+    TEST_ASSERT(sock.open(interface) == 0)
 
     TEST_ASSERT(sock.connect(host_address) == 0);
 
@@ -769,7 +774,7 @@
 
     TEST_ASSERT(!connection_has_gone_down);
     sock.close();
-    drop_connection(driver);
+    drop_connection(interface);
 }
 
 // Test TCP data exchange via the asynchronous sigio() mechanism
@@ -780,17 +785,17 @@
     int x;
     int size;
 
-    driver->deinit();
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    interface->deinit();
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_ECHO_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_ECHO_TCP_PORT);
 
     tr_debug("TCP: Server %s address: %s on port %d.", MBED_CONF_APP_ECHO_SERVER,
              host_address.get_ip_address(), host_address.get_port());
 
-    TEST_ASSERT(sock.open(driver) == 0)
+    TEST_ASSERT(sock.open(interface) == 0)
 
     // Set up the async callback and set the timeout to zero
     sock.sigio(callback(async_cb, &callback_triggered));
@@ -808,7 +813,7 @@
 
     sock.close();
 
-    drop_connection(driver);
+    drop_connection(interface);
 
     tr_debug("%d TCP packets of size up to %d byte(s) echoed asynchronously and successfully.",
              x, MBED_CONF_APP_TCP_MAX_PACKET_SIZE);
@@ -821,22 +826,22 @@
     UDPSocket sockNone;
     SocketAddress host_address;
 
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                 MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
 
-    TEST_ASSERT(driver->gethostbyname(MBED_CONF_APP_NTP_SERVER, &host_address) == 0);
+    TEST_ASSERT(interface->gethostbyname(MBED_CONF_APP_NTP_SERVER, &host_address) == 0);
     host_address.set_port(MBED_CONF_APP_NTP_PORT);
 
     // Open the first socket and use it
-    TEST_ASSERT(sock[0].open(driver) == 0)
+    TEST_ASSERT(sock[0].open(interface) == 0)
     sock[0].set_timeout(10000);
     do_ntp_sock(&sock[0], host_address);
 
     // Check that we stop being able to get sockets at the max number
     for (int x = 1; x < (int) (sizeof (sock) / sizeof (sock[0])); x++) {
-        TEST_ASSERT(sock[x].open(driver) == 0)
+        TEST_ASSERT(sock[x].open(interface) == 0)
     }
-    TEST_ASSERT(sockNone.open(driver) < 0);
+    TEST_ASSERT(sockNone.open(interface) < 0);
 
     // Now use the last one
     sock[sizeof (sock) / sizeof (sock[0]) - 1].set_timeout(10000);
@@ -847,131 +852,131 @@
         TEST_ASSERT(sock[x].close() == 0);
     }
 
-    drop_connection(driver);
+    drop_connection(interface);
 }
 
 // Connect with credentials included in the connect request
 void test_connect_credentials() {
 
-    driver->deinit();
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
+    interface->deinit();
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
 }
 
 // Test with credentials preset
 void test_connect_preset_credentials() {
 
-    driver->deinit();
-    TEST_ASSERT(driver->init(MBED_CONF_APP_DEFAULT_PIN));
-    driver->set_credentials(MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
-                            MBED_CONF_APP_PASSWORD);
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN) == 0);
-    use_connection(driver);
-    drop_connection(driver);
+    interface->deinit();
+    TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN));
+    interface->set_credentials(MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
+                               MBED_CONF_APP_PASSWORD);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN) == 0);
+    use_connection(interface);
+    drop_connection(interface);
 }
 
 // Test adding and using a SIM pin, then removing it, using the pending
 // mechanism where the change doesn't occur until connect() is called
 void test_check_sim_pin_pending() {
 
-    driver->deinit();
+    interface->deinit();
 
     // Enable PIN checking (which will use the current PIN)
     // and also flag that the PIN should be changed to MBED_CONF_APP_ALT_PIN,
     // then try connecting
-    driver->set_sim_pin_check(true);
-    driver->set_new_sim_pin(MBED_CONF_APP_ALT_PIN);
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
-    driver->deinit();
+    interface->set_sim_pin_check(true);
+    interface->set_new_sim_pin(MBED_CONF_APP_ALT_PIN);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
+    interface->deinit();
 
     // Now change the PIN back to what it was before
-    driver->set_new_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_ALT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
-    driver->deinit();
+    interface->set_new_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_ALT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
+    interface->deinit();
 
     // Check that it was changed back, and this time
     // use the other way of entering the PIN
-    driver->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
-    TEST_ASSERT(driver->connect(NULL, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
-                                MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
-    driver->deinit();
+    interface->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
+    TEST_ASSERT(interface->connect(NULL, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
+                                   MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
+    interface->deinit();
 
     // Remove PIN checking again and check that it no
     // longer matters what the PIN is
-    driver->set_sim_pin_check(false);
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
-    driver->deinit();
-    TEST_ASSERT(driver->init(NULL));
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_INCORRECT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
+    interface->set_sim_pin_check(false);
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
+    interface->deinit();
+    TEST_ASSERT(interface->init(NULL));
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_INCORRECT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
 
     // Put the SIM pin back to the correct value for any subsequent tests
-    driver->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
+    interface->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
 }
 
 // Test adding and using a SIM pin, then removing it, using the immediate
 // mechanism
 void test_check_sim_pin_immediate() {
 
-    driver->deinit();
-    driver->connection_status_cb(connection_down_cb);
+    interface->deinit();
+    interface->connection_status_cb(connection_down_cb);
 
     // Enable PIN checking (which will use the current PIN), change
     // the PIN to MBED_CONF_APP_ALT_PIN, then try connecting after powering on and
     // off the modem
-    driver->set_sim_pin_check(true, true, MBED_CONF_APP_DEFAULT_PIN);
-    driver->set_new_sim_pin(MBED_CONF_APP_ALT_PIN, true);
-    driver->deinit();
-    TEST_ASSERT(driver->init(NULL));
-    TEST_ASSERT(driver->connect(MBED_CONF_APP_ALT_PIN, MBED_CONF_APP_APN,
-                                MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
+    interface->set_sim_pin_check(true, true, MBED_CONF_APP_DEFAULT_PIN);
+    interface->set_new_sim_pin(MBED_CONF_APP_ALT_PIN, true);
+    interface->deinit();
+    TEST_ASSERT(interface->init(NULL));
+    TEST_ASSERT(interface->connect(MBED_CONF_APP_ALT_PIN, MBED_CONF_APP_APN,
+                                   MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
 
-    driver->connection_status_cb(connection_down_cb);
+    interface->connection_status_cb(connection_down_cb);
 
     // Now change the PIN back to what it was before
-    driver->set_new_sim_pin(MBED_CONF_APP_DEFAULT_PIN, true);
-    driver->deinit();
-    driver->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
-    TEST_ASSERT(driver->init(NULL));
-    TEST_ASSERT(driver->connect(NULL, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
-                                MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
+    interface->set_new_sim_pin(MBED_CONF_APP_DEFAULT_PIN, true);
+    interface->deinit();
+    interface->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
+    TEST_ASSERT(interface->init(NULL));
+    TEST_ASSERT(interface->connect(NULL, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
+                                   MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
 
-    driver->connection_status_cb(connection_down_cb);
+    interface->connection_status_cb(connection_down_cb);
 
     // Remove PIN checking again and check that it no
     // longer matters what the PIN is
-    driver->set_sim_pin_check(false, true);
-    driver->deinit();
-    TEST_ASSERT(driver->init(MBED_CONF_APP_INCORRECT_PIN));
-    TEST_ASSERT(driver->connect(NULL, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
-                                MBED_CONF_APP_PASSWORD) == 0);
-    use_connection(driver);
-    drop_connection(driver);
+    interface->set_sim_pin_check(false, true);
+    interface->deinit();
+    TEST_ASSERT(interface->init(MBED_CONF_APP_INCORRECT_PIN));
+    TEST_ASSERT(interface->connect(NULL, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME,
+                                   MBED_CONF_APP_PASSWORD) == 0);
+    use_connection(interface);
+    drop_connection(interface);
 
     // Put the SIM pin back to the correct value for any subsequent tests
-    driver->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
+    interface->set_sim_pin(MBED_CONF_APP_DEFAULT_PIN);
 }
 
-// Test being able to connect with a local instance of the driver
+// Test being able to connect with a local instance of the interface
 // NOTE: since this local instance will fiddle with bits of HW that the
 // static instance thought it owned, the static instance will no longer
 // work afterwards, hence this must be run as the last test in the list
@@ -1015,7 +1020,7 @@
 
 // IMPORTANT!!! if you make a change to the tests here you should
 // check whether the same change should be made to the tests under
-// the GENERIC driver.
+// the PPP interface.
 
 // Test cases
 Case cases[] = {
@@ -1060,7 +1065,7 @@
     mbed_trace_mutex_release_function_set(unlock);
 #endif
 
-    driver->connection_status_cb(connection_down_cb);
+    interface->connection_status_cb(connection_down_cb);
 
     // Run tests
     return !Harness::run(specification);
--- a/TESTS/unit_tests/default/template_mbed_app.txt	Tue Jun 13 10:09:57 2017 +0100
+++ b/TESTS/unit_tests/default/template_mbed_app.txt	Thu Jun 15 14:04:26 2017 +0100
@@ -1,12 +1,5 @@
 {
     "config": {
-        "platform": {
-            "help": "The platform for the cellular feature, e.g. UBLOX or MTS_DRAGONFLY",
-            "value": "UBLOX"
-        },
-        "buffer-size": {
-            "value": 0
-        },
         "debug-on": {
             "help": "Set to true to get AT interface debug",
             "value": false
@@ -75,10 +68,7 @@
     "target_overrides": {
         "*": {
             "target.features_add": ["COMMON_PAL"],
-            "platform.stdio-convert-newlines": true,
-            "platform.stdio-baud-rate": 9600,
-            "platform.default-serial-baud-rate": 115200,
-            "mbed-trace.enable": 1
+            "platform.stdio-convert-newlines": true
         }
     }
 }
--- a/UbloxATCellularInterface.cpp	Tue Jun 13 10:09:57 2017 +0100
+++ b/UbloxATCellularInterface.cpp	Thu Jun 15 14:04:26 2017 +0100
@@ -986,18 +986,25 @@
     set_pin(pin);
 }
 
+static int count = 0;
+
 // Get the IP address of a host.
 nsapi_error_t UbloxATCellularInterface::gethostbyname(const char *host,
                                                       SocketAddress *address,
                                                       nsapi_version_t version)
 {
     nsapi_error_t nsapi_error = NSAPI_ERROR_DEVICE_ERROR;
+    int at_timeout;
     char ipAddress[NSAPI_IP_SIZE];
 
+    count++;
     if (address->set_ip_address(host)) {
         nsapi_error = NSAPI_ERROR_OK;
     } else {
         LOCK();
+        // This interrogation can sometimes take longer than the usual 8 seconds
+        at_timeout = _at_timeout;
+        at_set_timeout(60000);
         memset (ipAddress, 0, sizeof (ipAddress)); // Ensure terminator
         if (_at->send("AT+UDNSRN=0,\"%s\"", host) &&
             _at->recv("+UDNSRN: \"%" u_stringify(NSAPI_IP_SIZE) "[^\"]\"", ipAddress) &&
@@ -1006,6 +1013,7 @@
                 nsapi_error = NSAPI_ERROR_OK;
             }
         }
+        at_set_timeout(at_timeout);
         UNLOCK();
     }