Sample code for restart GNSS device and get TTFF
//--------------------------------------------------------------------------------------------------/*** Test: Restart to Cold start.**///--------------------------------------------------------------------------------------------------static void TestLeGnssRestart(void){uint32_t ttff = 0;uint64_t epochTime;le_gnss_SampleRef_t positionSampleRef;le_result_t result = LE_FAULT;LE_TEST_INFO("Start Test le_pos_RestartTest");/* Wait for a position fix */LE_TEST_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_TEST_INFO("TTFF start = %d msec", ttff);}else{LE_TEST_INFO("TTFF start not available");}/* HOT Restart */LE_TEST_INFO("Ask for a Hot restart in 3 seconds...");sleep(3);// Wait for a 3D fixLE_TEST_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_TEST_INFO("TTFF Hot restart = %d msec", ttff);}else{LE_TEST_INFO("TTFF Hot restart not available");}/* WARM Restart */LE_TEST_INFO("Ask for a Warm restart in 3 seconds...");sleep(3);// Wait for a 3D fixLE_TEST_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_TEST_INFO("TTFF Warm restart = %d msec", ttff);}else{LE_TEST_INFO("TTFF Warm restart not available");}/* COLD Restart */LE_TEST_INFO("Ask for a Cold restart in 3 seconds...");sleep(3);sleep(5);// Get Epoch time : it should be 0 after a COLD restartpositionSampleRef = le_gnss_GetLastSampleRef();"Get epoch time after cold restart");LE_TEST_OK(0 == epochTime, "Confirm epoch time is invalid");// Wait for a 3D fixLE_TEST_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_TEST_INFO("TTFF Cold restart = %d msec", ttff);}else{LE_TEST_INFO("TTFF Cold restart not available");}/* FACTORY Restart */LE_TEST_INFO("Ask for a Factory restart in 3 seconds...");sleep(3);// Get TTFF,position fix should be still in progress for the FACTORY startresult = le_gnss_GetTtff(&ttff);LE_TEST_INFO("TTFF is checked as not available immediatly after a FACTORY start");sleep(5);// Get Epoch time : it should be 0 after a FACTORY restartpositionSampleRef = le_gnss_GetLastSampleRef();"Get epoch time after factory restart");LE_TEST_OK(0 == epochTime, "Confirm epoch time is invalid");// Wait for a 3D fixLE_TEST_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_TEST_INFO("TTFF Factory restart = %d msec", ttff);}else{LE_TEST_INFO("TTFF Factory restart not available");}/* Stop GNSS engine*/sleep(1);EpochTime=0;TimeAccuracy=0;}