ublox-at-cellular-interface_tests
Revision 38:7d053638b3f1, committed 2019-09-23
- Comitter:
- wajahat.abbas@u-blox.com
- Date:
- Mon Sep 23 15:13:42 2019 +0500
- Parent:
- 37:9b7fbce50d88
- Commit message:
- Updated test cases
Changed in this revision
--- a/TESTS/unit_tests/default/main.cpp Tue Sep 17 16:15:33 2019 +0500 +++ b/TESTS/unit_tests/default/main.cpp Mon Sep 23 15:13:42 2019 +0500 @@ -162,6 +162,7 @@ // Connection flag static bool connection_has_gone_down = false; +#ifdef MBED_CONF_APP_ECHO_SERVER // Data to exchange static const char send_data[] = "_____0000:0123456789012345678901234567890123456789" "01234567890123456789012345678901234567890123456789" @@ -205,6 +206,7 @@ "01234567890123456789012345678901234567890123456789" "_____2000:0123456789012345678901234567890123456789" "01234567890123456789012345678901234567890123456789"; +#endif // ---------------------------------------------------------------- // PRIVATE FUNCTIONS @@ -1057,7 +1059,7 @@ drop_connection(pLocalInterface); delete pLocalInterface; } - +#if defined (TARGET_UBLOX_C030_U201) || defined (TARGET_UBLOX_C030_R412M) void test_set_new_rat() { int currentSelectedRat = -1, currentPreferredRat = -1, currentSecondPreferredRat = -1; @@ -1087,11 +1089,10 @@ // Check RAT configured correctly TEST_ASSERT((currentSelectedRat == UbloxATCellularInterface::GSM_UMTS) && (currentPreferredRat == UbloxATCellularInterface::UMTS)); -#endif -#ifdef TARGET_UBLOX_C030_R412M +#elif TARGET_UBLOX_C030_R412M // Set new RAT - TEST_ASSERT(interface->set_modem_rat(UbloxATCellularInterface::LTE_CATM1, UbloxATCellularInterface::LTE_CATNB1)); + TEST_ASSERT(interface->set_modem_rat(UbloxATCellularInterface::LTE_CATM1, UbloxATCellularInterface::LTE_CATNB1, UbloxATCellularInterface::GPRS_EGPRS)); tr_debug("RAT configured\n"); // Get latest set RAT on modem @@ -1135,6 +1136,7 @@ // Rebooting modem for settings to take effect TEST_ASSERT(interface->reboot_modem()); } +#endif #ifdef TARGET_UBLOX_C030_R41XM void test_mno_profile() { @@ -1142,7 +1144,7 @@ int previous_profile, current_profile; // Power-up the modem - TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); + interface->init(MBED_CONF_APP_DEFAULT_PIN); //do not assert as if MNO profile 0 is set, init can return false // Check if modem is registered with network if (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) { @@ -1170,16 +1172,13 @@ TEST_ASSERT(interface->get_mno_profile(¤t_profile)); tr_debug("New MNO profile is: %d\n", current_profile); - //Profile 100 enables the PSM so disable it - TEST_ASSERT(interface->set_power_saving_mode(0, 0)); + TEST_ASSERT(interface->disable_psm()); TEST_ASSERT((UbloxATCellularInterface::MNOProfile)current_profile == (UbloxATCellularInterface::MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE); TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0); - interface->get_receive_period(); - drop_connection(interface); }
--- a/TESTS/unit_tests/dynamic/main.cpp Tue Sep 17 16:15:33 2019 +0500 +++ b/TESTS/unit_tests/dynamic/main.cpp Mon Sep 23 15:13:42 2019 +0500 @@ -221,7 +221,6 @@ // Test that sleep is possible both // before and after running the driver. void test_sleep() { - TEST_ASSERT(sleep_manager_can_deep_sleep() == true); // Create an instance of the cellular interface @@ -232,10 +231,23 @@ interface->connection_status_cb(connection_down_cb); // Use it +#ifdef TARGET_UBLOX_C030_R41XM + int mno_profile; + if (interface->init(MBED_CONF_APP_DEFAULT_PIN) == false) //init can return false if profile set is SW_DEFAULT + { + TEST_ASSERT(interface->get_mno_profile(&mno_profile)); + if (mno_profile == UbloxATCellularInterface::SW_DEFAULT) { + TEST_ASSERT(interface->set_mno_profile((UbloxATCellularInterface::MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE)); + TEST_ASSERT(interface->reboot_modem()); + tr_debug("Reboot successful\n"); + wait_ms(5000); + } + } TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); -#ifdef TARGET_UBLOX_C030_R41XM - //PSM may be enabled so disable it - TEST_ASSERT(interface->set_power_saving_mode(0, 0)); + + TEST_ASSERT(interface->disable_psm()); +#else + TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); #endif TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0);
--- a/UbloxATCellularInterface.cpp Tue Sep 17 16:15:33 2019 +0500 +++ b/UbloxATCellularInterface.cpp Mon Sep 23 15:13:42 2019 +0500 @@ -346,9 +346,10 @@ nsapi_security_t auth) { bool success = false; + +#ifndef TARGET_UBLOX_C030_R41XM int at_timeout = _at_timeout; -#ifndef TARGET_UBLOX_C030_R41XM if (_at->send("AT+CGDCONT=%d,\"IP\",\"%s\"", cid, apn) && _at->recv("OK") && _at->send("AT+UAUTHREQ=%d,%d,\"%s\",\"%s\"", cid, nsapi_security_to_modem_security(auth), username, password) && _at->recv("OK") &&