ublox-at-cellular-interface_tests

Revision:
38:7d053638b3f1
Parent:
37:9b7fbce50d88
--- 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);