Fork of ublox-at-cellular-interface to add LARA-R2 support

Dependents:  

Fork of ublox-at-cellular-interface by u-blox

Revision:
6:63dad754c267
Parent:
1:bc228becc45d
Child:
12:ff6fac481487
diff -r f6706249d076 -r 63dad754c267 TESTS/unit_tests/default/main.cpp
--- 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);