ublox-at-cellular-interface
Diff: TESTS/unit_tests/default/main.cpp
- Revision:
- 30:0f571a4920c8
- Parent:
- 27:3d709ee8c3e1
--- 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