ublox-at-cellular-interface_R412M
Revision 12:ff6fac481487, committed 2018-01-09
- Comitter:
- RobMeades
- Date:
- Tue Jan 09 13:20:44 2018 +0000
- Parent:
- 10:ba18f4418ee8
- Child:
- 13:39264b492ce7
- Commit message:
- Remove spurious debug parameter.
Changed in this revision
--- a/TESTS/unit_tests/default/main.cpp Mon Oct 30 14:48:14 2017 +0000 +++ b/TESTS/unit_tests/default/main.cpp Tue Jan 09 13:20:44 2018 +0000 @@ -489,6 +489,65 @@ // TESTS // ---------------------------------------------------------------- +// Tests of stuff in the base class +void test_base_class() { + const char *imei; + const char *meid; + const char *imsi; + const char *iccid; + int rssi; + + // Power-up the modem + interface->init(); + + // Check all of the IMEI, MEID, IMSI and ICCID calls + imei = interface->imei(); + if (imei != NULL) { + tr_debug("IMEI is %s.", imei); + } else { + TEST_ASSERT(false); + } + + meid = interface->meid(); + if (meid != NULL) { + tr_debug("MEID is %s.", meid); + } else { + TEST_ASSERT(false); + } + + imsi = interface->imsi(); + if (imsi != NULL) { + tr_debug("IMSI is %s.", imsi); + } else { + TEST_ASSERT(false); + } + + iccid = interface->iccid(); + if (iccid != NULL) { + tr_debug("ICCID is %s.", iccid); + } else { + TEST_ASSERT(false); + } + + // Check the RSSI call at least doesn't assert + rssi = interface->rssi(); + tr_debug("RSSI is %d dBm.", rssi); + + // Now connect and check that the answers for the + // static fields are the same while connected + TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN, + MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0); + + TEST_ASSERT(strcmp(imei, interface->imei()) == 0); + TEST_ASSERT(strcmp(meid, interface->meid()) == 0); + TEST_ASSERT(strcmp(imsi, interface->imsi()) == 0); + TEST_ASSERT(strcmp(iccid, interface->iccid()) == 0); + + // Check that the RSSI call still doesn't assert + rssi = interface->rssi(); + tr_debug("RSSI is %d dBm.", rssi); +} + // Call srand() using the NTP server void test_set_randomise() { UDPSocket sock; @@ -1024,6 +1083,7 @@ // Test cases Case cases[] = { + Case("Base class tests", test_base_class), Case("Set randomise", test_set_randomise), #ifdef MBED_CONF_APP_ECHO_SERVER Case("UDP echo test", test_udp_echo), @@ -1072,4 +1132,3 @@ } // End Of File -
--- a/UbloxATCellularInterface.cpp Mon Oct 30 14:48:14 2017 +0000 +++ b/UbloxATCellularInterface.cpp Tue Jan 09 13:20:44 2018 +0000 @@ -990,12 +990,11 @@ } // Set PIN. -void UbloxATCellularInterface::set_sim_pin(const char *pin) { +void UbloxATCellularInterface::set_sim_pin(const char *pin) +{ set_pin(pin); } -static int count = 0; - // Get the IP address of a host. nsapi_error_t UbloxATCellularInterface::gethostbyname(const char *host, SocketAddress *address, @@ -1005,7 +1004,6 @@ int at_timeout; char ipAddress[NSAPI_IP_SIZE]; - count++; if (address->set_ip_address(host)) { nsapi_error = NSAPI_ERROR_OK; } else {