ublox-at-cellular-interface
Revision 45:14fb8a6a5c03, committed 2020-04-09
- Comitter:
- mudassar0121
- Date:
- Thu Apr 09 15:10:07 2020 +0500
- Parent:
- 42:98808477a691
- Commit message:
- Added set Rat test for target C030_R41XM
Changed in this revision
diff -r 98808477a691 -r 14fb8a6a5c03 TESTS/unit_tests/default/main.cpp --- a/TESTS/unit_tests/default/main.cpp Mon Jan 06 14:29:40 2020 +0500 +++ b/TESTS/unit_tests/default/main.cpp Thu Apr 09 15:10:07 2020 +0500 @@ -1151,6 +1151,32 @@ #endif #ifdef TARGET_UBLOX_C030_R41XM +void test_set_initial_rat() { + + int currentSelectedRat = -1, currentPreferredRat = -1, currentSecondPreferredRat = -1; + + // Power-up the modem + TEST_ASSERT(interface->init()); + + // Check if modem is registered with network + if (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) { + tr_error("RAT should only be set in detached state"); + // Deregister from Network + drop_connection(interface); + } + + // Set RAT + TEST_ASSERT(interface->set_modem_rat(UbloxATCellularInterface::LTE_CATM1)); + tr_debug("RAT configured\n"); + + // Get latest set RAT on modem + TEST_ASSERT(interface->get_modem_rat(¤tSelectedRat, ¤tPreferredRat, ¤tSecondPreferredRat)); + tr_debug("new selected RAT: %d\n", currentSelectedRat); + + // Check RAT configured correctly + TEST_ASSERT(currentSelectedRat == UbloxATCellularInterface::LTE_CATM1); +} + void test_mno_profile() { int previous_profile, current_profile; @@ -1250,6 +1276,7 @@ // Test cases Case cases[] = { #ifdef TARGET_UBLOX_C030_R41XM + Case("Set initial RAT test", test_set_initial_rat), Case("MNO profile test", test_mno_profile), Case("edrx test", test_edrx), #endif
diff -r 98808477a691 -r 14fb8a6a5c03 TESTS/unit_tests/dynamic/main.cpp --- a/TESTS/unit_tests/dynamic/main.cpp Mon Jan 06 14:29:40 2020 +0500 +++ b/TESTS/unit_tests/dynamic/main.cpp Thu Apr 09 15:10:07 2020 +0500 @@ -218,6 +218,40 @@ // TESTS // ---------------------------------------------------------------- +#ifdef TARGET_UBLOX_C030_R41XM +void test_set_initial_rat() { + + int currentSelectedRat = -1, currentPreferredRat = -1, currentSecondPreferredRat = -1; + + // Create an instance of the cellular interface + UbloxATCellularInterface *interface = + new UbloxATCellularInterface(MDMTXD, MDMRXD, + MBED_CONF_UBLOX_CELL_BAUD_RATE, + MBED_CONF_APP_DEBUG_ON); + + // Power-up the modem + TEST_ASSERT(interface->init()); + + // Check if modem is registered with network + if (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) { + tr_error("RAT should only be set in detached state"); + // Deregister from Network + drop_connection(interface); + } + + // Set RAT + TEST_ASSERT(interface->set_modem_rat(UbloxATCellularInterface::LTE_CATM1)); + tr_debug("RAT configured\n"); + + // Get latest set RAT on modem + TEST_ASSERT(interface->get_modem_rat(¤tSelectedRat, ¤tPreferredRat, ¤tSecondPreferredRat)); + tr_debug("new selected RAT: %d\n", currentSelectedRat); + + // Check RAT configured correctly + TEST_ASSERT(currentSelectedRat == UbloxATCellularInterface::LTE_CATM1); +} +#endif + // Test that sleep is possible both // before and after running the driver. void test_sleep() { @@ -240,7 +274,7 @@ TEST_ASSERT(interface->set_mno_profile(UbloxATCellularInterface::STANDARD_EU)); TEST_ASSERT(interface->reboot_modem()); tr_debug("Reboot successful\n"); - hisThread::sleep_for(5000); + ThisThread::sleep_for(5000); } } TEST_ASSERT(interface->init(MBED_CONF_APP_DEFAULT_PIN)); @@ -334,6 +368,9 @@ // Test cases Case cases[] = { +#ifdef TARGET_UBLOX_C030_R41XM + Case("Set initial RAT test", test_set_initial_rat), +#endif Case("Sleep test", test_sleep), Case("Sleep test with failed modem comms", test_sleep_failed_connection) #if MBED_HEAP_STATS_ENABLED