Ejemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
static void TestLeGnssStart
(
    void
)
{
    uint32_t rate = 0;
    le_gnss_ConstellationBitMask_t constellationMask;


    LE_INFO("Start Test Testle_gnss_StartTest");

    LE_ASSERT((le_gnss_GetAcquisitionRate(&rate)) == LE_OK);
    LE_INFO("Acquisition rate %d ms", rate);
    LE_ASSERT((le_gnss_SetAcquisitionRate(rate)) == LE_OK);

    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_INFO("Constellation 0x%X", constellationMask);
    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);

    LE_INFO("Start GNSS");
    LE_ASSERT((le_gnss_Start()) == LE_OK);

    /* Wait for a position fix */
    LE_INFO("Wait 120 seconds for a 3D fix");
    sleep(120);

    LE_INFO("Stop GNSS");
    LE_ASSERT((le_gnss_Stop()) == LE_OK);
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
void Testle_gnss_DeviceTest
(
    void
)
{
    LE_INFO("Start Test Testle_gnss_DeviceTest");
    // GNSS device enabled by default
    LE_ASSERT((le_gnss_Enable()) == LE_DUPLICATE);
    // Disable GNSS device (DISABLED state)
    LE_ASSERT((le_gnss_Disable()) == LE_OK);
    LE_ASSERT((le_gnss_Disable()) == LE_DUPLICATE);
    // Check Disabled state
    LE_ASSERT((le_gnss_Start()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_Stop()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_NOT_PERMITTED);
    // Enable GNSS device (READY state)
    LE_ASSERT((le_gnss_Enable()) == LE_OK);
    LE_ASSERT((le_gnss_Disable()) == LE_OK);
    LE_ASSERT((le_gnss_Enable()) == LE_OK);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_OK);
    LE_ASSERT((le_gnss_Stop()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_NOT_PERMITTED);
    // Start GNSS device (ACTIVE state)
    LE_ASSERT((le_gnss_Start()) == LE_OK);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_OK);
    LE_ASSERT((le_gnss_Start()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_Enable()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_Disable()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_NOT_PERMITTED);
    // Stop GNSS device (READY state)
    LE_ASSERT((le_gnss_Stop()) == LE_OK);
    LE_ASSERT((le_gnss_Enable()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_Disable()) == LE_OK);
    LE_ASSERT((le_gnss_Enable()) == LE_OK);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_OK);
    LE_ASSERT((le_gnss_Stop()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_NOT_PERMITTED);
}
Ejemplo n.º 3
0
//--------------------------------------------------------------------------------------------------
static void TestLeGnssConstellations
(
    void
)
{
    le_gnss_ConstellationBitMask_t constellationMask;

    LE_INFO("Start Test TestLeGnssConstellationsTest");

    // test1: error test
    constellationMask = 0;
    LE_ASSERT((le_gnss_SetConstellation(constellationMask)) == LE_UNSUPPORTED);
    sleep(2);

    // test2 : Gps selection
    constellationMask = LE_GNSS_CONSTELLATION_GPS;
    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_ASSERT(constellationMask == LE_GNSS_CONSTELLATION_GPS)
    sleep(2);

    // test3: Gps+Glonass selection
    constellationMask = LE_GNSS_CONSTELLATION_GPS | LE_GNSS_CONSTELLATION_GLONASS;
    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_ASSERT(constellationMask == (LE_GNSS_CONSTELLATION_GPS |
                                    LE_GNSS_CONSTELLATION_GLONASS))
    sleep(2);

    // test4: error test (GPS constallation is not set)
    //        and Beidou is unknown for mdm9x15
    constellationMask = LE_GNSS_CONSTELLATION_BEIDOU;
#if defined(SIERRA_MDM9X40)
    LE_ASSERT((le_gnss_SetConstellation(constellationMask)) == LE_FAULT);
#else
    LE_ASSERT((le_gnss_SetConstellation(constellationMask)) == LE_UNSUPPORTED);
#endif
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    // test constellationMask has not changed after error
    LE_ASSERT(constellationMask == (LE_GNSS_CONSTELLATION_GPS |
                                    LE_GNSS_CONSTELLATION_GLONASS))
    sleep(2);

    // next tests have same results as test4 for mdm9x15
#if defined(SIERRA_MDM9X40)

    // test5: Gps+Glonass+Beidou selection
    constellationMask = LE_GNSS_CONSTELLATION_GPS |
                        LE_GNSS_CONSTELLATION_GLONASS |
                        LE_GNSS_CONSTELLATION_BEIDOU;

    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_ASSERT(constellationMask == (LE_GNSS_CONSTELLATION_GPS |
                                    LE_GNSS_CONSTELLATION_GLONASS |
                                    LE_GNSS_CONSTELLATION_BEIDOU))
    sleep(2);

    // test6: Gps+Beidou selection
    constellationMask = LE_GNSS_CONSTELLATION_GPS |
                        LE_GNSS_CONSTELLATION_BEIDOU;
    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_ASSERT(constellationMask == (LE_GNSS_CONSTELLATION_GPS |
                                    LE_GNSS_CONSTELLATION_BEIDOU))
    sleep(2);

    // test6: Gps+Glonass+Beidou+Galileo selection
    constellationMask = LE_GNSS_CONSTELLATION_GPS |
                        LE_GNSS_CONSTELLATION_GLONASS |
                        LE_GNSS_CONSTELLATION_BEIDOU |
                        LE_GNSS_CONSTELLATION_GALILEO;

    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_ASSERT(constellationMask == (LE_GNSS_CONSTELLATION_GPS |
                                    LE_GNSS_CONSTELLATION_GLONASS |
                                    LE_GNSS_CONSTELLATION_BEIDOU |
                                    LE_GNSS_CONSTELLATION_GALILEO))
    sleep(2);

    // test7: Gps+Glonass+Beidou+Galileo+unknown selection
    constellationMask = LE_GNSS_CONSTELLATION_GPS |
                        LE_GNSS_CONSTELLATION_GLONASS |
                        LE_GNSS_CONSTELLATION_BEIDOU |
                        LE_GNSS_CONSTELLATION_GALILEO |
                        LE_GNSS_CONSTELLATION_GALILEO+5;

    LE_ASSERT(le_gnss_SetConstellation(constellationMask) == LE_OK);
    LE_ASSERT(le_gnss_GetConstellation(&constellationMask) == LE_OK);
    LE_ASSERT(constellationMask == (LE_GNSS_CONSTELLATION_GPS |
                                    LE_GNSS_CONSTELLATION_GLONASS |
                                    LE_GNSS_CONSTELLATION_BEIDOU |
                                    LE_GNSS_CONSTELLATION_GALILEO))

#endif
}
Ejemplo n.º 4
0
//--------------------------------------------------------------------------------------------------
static void TestLeGnssDevice
(
    void
)
{
    uint32_t ttffValue;
    uint32_t acqRate;
    le_gnss_ConstellationBitMask_t constellationMask;

    LE_INFO("Start Test Testle_gnss_DeviceTest");
    // GNSS device enabled by default
    LE_ASSERT((le_gnss_Enable()) == LE_DUPLICATE);
    // Disable GNSS device (DISABLED state)
    LE_ASSERT((le_gnss_Disable()) == LE_OK);
    LE_ASSERT((le_gnss_Disable()) == LE_DUPLICATE);
    // Check Disabled state
    LE_ASSERT((le_gnss_Start()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceHotRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceWarmRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceFactoryRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetTtff(&ttffValue)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_Stop()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetConstellation(&constellationMask)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetAcquisitionRate(&acqRate)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_SetAcquisitionRate(acqRate)) == LE_NOT_PERMITTED);
    // Enable GNSS device (READY state)
    LE_ASSERT((le_gnss_Enable()) == LE_OK);
    LE_ASSERT((le_gnss_Disable()) == LE_OK);
    LE_ASSERT((le_gnss_Enable()) == LE_OK);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_OK);
    LE_ASSERT((le_gnss_GetConstellation(&constellationMask)) == LE_OK);
    LE_ASSERT(constellationMask == LE_GNSS_CONSTELLATION_GPS);
    LE_ASSERT((le_gnss_Stop()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_ForceHotRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceWarmRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceFactoryRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetAcquisitionRate(&acqRate)) == LE_OK);
    LE_ASSERT((le_gnss_SetAcquisitionRate(acqRate)) == LE_OK);
    // Start GNSS device (ACTIVE state)
    LE_ASSERT((le_gnss_Start()) == LE_OK);
    LE_ASSERT((le_gnss_Start()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_Enable()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_Disable()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetConstellation(&constellationMask)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetAcquisitionRate(&acqRate)) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_SetAcquisitionRate(acqRate)) == LE_NOT_PERMITTED);
    // Stop GNSS device (READY state)
    LE_ASSERT((le_gnss_Stop()) == LE_OK);
    LE_ASSERT((le_gnss_Enable()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_Disable()) == LE_OK);
    LE_ASSERT((le_gnss_Enable()) == LE_OK);
    LE_ASSERT((le_gnss_SetConstellation(LE_GNSS_CONSTELLATION_GPS)) == LE_OK);
    LE_ASSERT((le_gnss_GetConstellation(&constellationMask)) == LE_OK);
    LE_ASSERT(constellationMask == LE_GNSS_CONSTELLATION_GPS);
    LE_ASSERT((le_gnss_Stop()) == LE_DUPLICATE);
    LE_ASSERT((le_gnss_ForceHotRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceWarmRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceColdRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_ForceFactoryRestart()) == LE_NOT_PERMITTED);
    LE_ASSERT((le_gnss_GetAcquisitionRate(&acqRate)) == LE_OK);
    LE_ASSERT((le_gnss_SetAcquisitionRate(acqRate)) == LE_OK);
}