ublox-at-cellular-interface_tests_pr
Revision 40:0ceb2dfc746c, committed 2019-10-09
- Comitter:
- wajahat.abbas@u-blox.com
- Date:
- Wed Oct 09 14:48:57 2019 +0500
- Parent:
- 36:9d48ec522cb4
- Commit message:
- Updated test cases for C030_R41XM
Changed in this revision
diff -r 9d48ec522cb4 -r 0ceb2dfc746c TESTS/unit_tests/default/main.cpp --- a/TESTS/unit_tests/default/main.cpp Mon Aug 19 17:36:04 2019 +0500 +++ b/TESTS/unit_tests/default/main.cpp Wed Oct 09 14:48:57 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 @@ -1056,19 +1058,8 @@ use_connection(pLocalInterface); drop_connection(pLocalInterface); delete pLocalInterface; - - pLocalInterface = new UbloxATCellularInterface(MDMTXD, MDMRXD, - MBED_CONF_UBLOX_CELL_BAUD_RATE, - MBED_CONF_APP_DEBUG_ON); - pLocalInterface->connection_status_cb(connection_down_cb); - - TEST_ASSERT(pLocalInterface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN, - MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0); - use_connection(pLocalInterface); - 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; @@ -1098,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 @@ -1146,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() { @@ -1153,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); //init can return false if profile set is SW_DEFAULT // Check if modem is registered with network if (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) { @@ -1164,10 +1155,10 @@ // Getting current mno profile TEST_ASSERT(interface->get_mno_profile(&previous_profile)); - tr_debug("Previous MNO profile is: %d\n\n", previous_profile); + tr_debug("Previous MNO profile is: %d\n", previous_profile); // Set MNO profile - TEST_ASSERT(interface->set_mno_profile((UbloxATCellularInterface::MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE)); + TEST_ASSERT(interface->set_mno_profile(UbloxATCellularInterface::STANDARD_EU)); tr_debug("MNO configured\n"); // Rebooting modem for settings to take effect @@ -1175,17 +1166,19 @@ tr_debug("Reboot successful\n"); wait_ms(5000); + TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); + // Check MNO profile configured correctly TEST_ASSERT(interface->get_mno_profile(¤t_profile)); - tr_debug("New MNO profile is: %d\n\n", current_profile); + tr_debug("New MNO profile is: %d\n", current_profile); - TEST_ASSERT((UbloxATCellularInterface::MNOProfile)current_profile == (UbloxATCellularInterface::MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE); + TEST_ASSERT(interface->disable_psm()); + + TEST_ASSERT((UbloxATCellularInterface::MNOProfile)current_profile == UbloxATCellularInterface::STANDARD_EU); 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); } @@ -1201,20 +1194,15 @@ // Deregister from Network drop_connection(interface); } - // Set MNO profile - TEST_ASSERT(interface->set_mno_profile((UbloxATCellularInterface::MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE)); - tr_debug("MNO configured\n"); + //disable edrx + interface->set_receive_period(3, UbloxCellularBase::EDRXEUTRAN_WB_S1_mode); + interface->set_receive_period(3, UbloxCellularBase::EDRXEUTRAN_NB_S1_mode); + + //set edrx interface->set_receive_period(2, UbloxCellularBase::EDRXEUTRAN_WB_S1_mode, c_edrx_value); interface->set_receive_period(2, UbloxCellularBase::EDRXEUTRAN_NB_S1_mode, c_edrx_value); - // Rebooting modem for settings to take effect - TEST_ASSERT(interface->reboot_modem()); - tr_debug("Reboot successful\n"); - wait_ms(5000); - - //TEST_ASSERT(interface->get_receive_period() == c_edrx_value); - TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0); @@ -1222,26 +1210,12 @@ drop_connection(interface); - interface->set_receive_period(3, UbloxCellularBase::EDRXEUTRAN_WB_S1_mode); - interface->set_receive_period(3, UbloxCellularBase::EDRXEUTRAN_NB_S1_mode); - - // Set MNO profile - TEST_ASSERT(interface->set_mno_profile((UbloxATCellularInterface::MNOProfile)(MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE+1))); - tr_debug("MNO configured\n"); - - // Rebooting modem for settings to take effect + //re-apply default mno profile + TEST_ASSERT(interface->set_mno_profile(UbloxATCellularInterface::STANDARD_EU)); TEST_ASSERT(interface->reboot_modem()); - tr_debug("Reboot successful\n"); wait_ms(5000); - - // Set MNO profile - TEST_ASSERT(interface->set_mno_profile((UbloxATCellularInterface::MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE)); - tr_debug("MNO configured\n"); - - // Rebooting modem for settings to take effect - TEST_ASSERT(interface->reboot_modem()); - tr_debug("Reboot successful\n"); - wait_ms(5000); + TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); + TEST_ASSERT(interface->disable_psm()); } #endif
diff -r 9d48ec522cb4 -r 0ceb2dfc746c TESTS/unit_tests/dynamic/main.cpp --- a/TESTS/unit_tests/dynamic/main.cpp Mon Aug 19 17:36:04 2019 +0500 +++ b/TESTS/unit_tests/dynamic/main.cpp Wed Oct 09 14:48:57 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,7 +231,24 @@ 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::STANDARD_EU)); + TEST_ASSERT(interface->reboot_modem()); + tr_debug("Reboot successful\n"); + wait_ms(5000); + } + } TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); + + 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); use_connection(interface);
diff -r 9d48ec522cb4 -r 0ceb2dfc746c UbloxATCellularInterface.cpp --- a/UbloxATCellularInterface.cpp Mon Aug 19 17:36:04 2019 +0500 +++ b/UbloxATCellularInterface.cpp Wed Oct 09 14:48:57 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") &&