edrx change set
Revision 30:0f571a4920c8, committed 2019-08-01
- Comitter:
- fahimalavi
- Date:
- Thu Aug 01 18:06:44 2019 +0500
- Parent:
- 29:773cfb0fe56c
- Commit message:
- edrx test case added and UPSND support added in disconnect modem stack
Changed in this revision
diff -r 773cfb0fe56c -r 0f571a4920c8 TESTS/unit_tests/default/main.cpp --- a/TESTS/unit_tests/default/main.cpp Mon Jul 29 14:49:01 2019 +0500 +++ b/TESTS/unit_tests/default/main.cpp Thu Aug 01 18:06:44 2019 +0500 @@ -1153,7 +1153,7 @@ int previous_profile, current_profile; // Power-up the modem - TEST_ASSERT(interface->init()); + TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); // Check if modem is registered with network if (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) { @@ -1184,20 +1184,64 @@ 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); +} + +void test_edrx() { + const int c_edrx_value = 2; + + // Power-up the modem + TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); - // Restore MNO profile to previous settings - TEST_ASSERT(interface->set_mno_profile((UbloxATCellularInterface::MNOProfile)previous_profile)); - tr_debug("Previous MNO configured\n"); + // Check if modem is registered with network + if (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) { + tr_error("set edrx in detached state"); + // 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"); + + 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->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); + + TEST_ASSERT(interface->get_receive_period() == c_edrx_value); + + drop_connection(interface); + + interface->set_receive_period(3, UbloxCellularBase::EDRXEUTRAN_WB_S1_mode); + interface->set_receive_period(3, UbloxCellularBase::EDRXEUTRAN_NB_S1_mode); - // Check MNO profile configured correctly - TEST_ASSERT(interface->get_mno_profile(¤t_profile)); - TEST_ASSERT((current_profile == previous_profile)); + // 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 + 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); } #endif @@ -1218,6 +1262,10 @@ // Test cases Case cases[] = { +#ifdef TARGET_UBLOX_C030_R41XM + Case("MNO profile test", test_mno_profile), + Case("edrx test", test_edrx), +#endif Case("Base class tests", test_base_class), Case("Set randomise", test_set_randomise), #ifdef MBED_CONF_APP_ECHO_SERVER @@ -1246,9 +1294,6 @@ Case("Register with network test", test_registration), Case("Set previous RAT test", test_set_previous_rat), #endif -#ifdef TARGET_UBLOX_C030_R41XM - Case("MNO profile test", test_mno_profile), -#endif #ifndef TARGET_UBLOX_C027 // Not enough RAM on little 'ole C027 for this Case("Connect using local instance, must be last test", test_connect_local_instance_last_test) #endif
diff -r 773cfb0fe56c -r 0f571a4920c8 UbloxATCellularInterface.cpp --- a/UbloxATCellularInterface.cpp Mon Jul 29 14:49:01 2019 +0500 +++ b/UbloxATCellularInterface.cpp Thu Aug 01 18:06:44 2019 +0500 @@ -467,6 +467,8 @@ bool UbloxATCellularInterface::disconnect_modem_stack() { bool success = false; + int active; + Timer t1; LOCK(); if (get_ip_address() != NULL) { @@ -477,6 +479,21 @@ } } } + t1.start(); + while (!(t1.read() >= 180)) { + if (_at->send("AT+UPSND=" PROFILE ",8") && _at->recv("+UPSND: %*d,%*d,%d\n", &active) && _at->recv("OK")) { + + if (active == 0) { //If context is deactivated, exit while loop and return status + tr_debug("Profile deactivated successfully"); + break; + } + else { + tr_error("Profile still active"); + rtos::ThisThread::sleep_for(5000); //Wait for 5 seconds and then try again + } + } + } + t1.stop(); UNLOCK(); return success;