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_INFO("Start Test le_pos_RestartTest");LE_ASSERT((le_gnss_Start()) == LE_OK);/* Wait for a position fix */LE_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_INFO("TTFF start = %d msec", ttff);}else{LE_INFO("TTFF start not available");}/* HOT Restart */LE_INFO("Ask for a Hot restart in 3 seconds...");sleep(3);LE_ASSERT(le_gnss_ForceHotRestart() == LE_OK);// Wait for a 3D fixLE_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_INFO("TTFF Hot restart = %d msec", ttff);}else{LE_INFO("TTFF Hot restart not available");}/* WARM Restart */LE_INFO("Ask for a Warm restart in 3 seconds...");sleep(3);LE_ASSERT(le_gnss_ForceWarmRestart() == LE_OK);// Wait for a 3D fixLE_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_INFO("TTFF Warm restart = %d msec", ttff);}else{LE_INFO("TTFF Warm restart not available");}/* COLD Restart */LE_INFO("Ask for a Cold restart in 3 seconds...");sleep(3);LE_ASSERT(le_gnss_ForceColdRestart() == LE_OK);sleep(1);// Get Epoch time : it should be 0 after a COLD restartpositionSampleRef = le_gnss_GetLastSampleRef();LE_ASSERT(0 == epochTime);// Wait for a 3D fixLE_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_INFO("TTFF Cold restart = %d msec", ttff);}else{LE_INFO("TTFF Cold restart not available");}/* FACTORY Restart */LE_INFO("Ask for a Factory restart in 3 seconds...");sleep(3);LE_ASSERT(le_gnss_ForceFactoryRestart() == LE_OK);// Get TTFF,position fix should be still in progress for the FACTORY startresult = le_gnss_GetTtff(&ttff);LE_INFO("TTFF is checked as not available immediatly after a FACTORY start");sleep(1);// Get Epoch time : it should be 0 after a FACTORY restartpositionSampleRef = le_gnss_GetLastSampleRef();LE_ASSERT(0 == epochTime);// Wait for a 3D fixLE_INFO("Wait 60 seconds for a 3D fix");sleep(60);// Get TTFFresult = le_gnss_GetTtff(&ttff);if(result == LE_OK){LE_INFO("TTFF Factory restart = %d msec", ttff);}else{LE_INFO("TTFF Factory restart not available");}/* Stop GNSS engine*/sleep(1);LE_ASSERT((le_gnss_Stop()) == LE_OK);EpochTime=0;TimeAccuracy=0;}