Sample code for Enable/Disable GNSS device

//--------------------------------------------------------------------------------------------------
/**
* Test: Legato GNSS functions.
*
*/
//--------------------------------------------------------------------------------------------------
static void TestLeGnssDevice
(
void
)
{
uint32_t ttffValue;
uint32_t acqRate;
uint8_t minElevation;
le_result_t result;
int32_t altitudeOnWgs84=0;
int64_t altitudeOnPZ90;
 
le_gnss_ConstellationBitMask_t constellationMask;
le_gnss_NmeaBitMask_t nmeaMask = 0;
le_gnss_ConstellationArea_t constellationArea;
 
LE_INFO("Start Test Testle_gnss_DeviceTest");
// GNSS device enabled by default
// Disable GNSS device (DISABLED state)
// Check Disabled state
 
&constellationArea)));
 
&constellationArea)));
 
result = le_gnss_SetAcquisitionRate(acqRate);
LE_ASSERT((result == LE_NOT_PERMITTED) || (result == LE_OUT_OF_RANGE));
 
// test le_gnss_Get/SetMinElevation when GNSS device is disabled and the engine is not started.
minElevation = 40;
LE_ASSERT((le_gnss_GetMinElevation(&minElevation)) == LE_OK);
LE_INFO("GNSS min elevation obtained: %d",minElevation);
LE_ASSERT(minElevation == 40);
 
// Enable GNSS device (READY state)
LE_ASSERT_OK(le_gnss_GetConstellation(&constellationMask));
LE_ASSERT(constellationMask == LE_GNSS_CONSTELLATION_GPS);
 
 
&constellationArea));
LE_ASSERT(LE_GNSS_OUTSIDE_US_AREA == constellationArea);
 
&constellationArea));
LE_ASSERT(LE_GNSS_WORLDWIDE_AREA == constellationArea);
 
acqRate = 0;
acqRate = 1100;
LE_INFO("NMEA mask: %x",nmeaMask);
 
// test le_gnss_Get/SetMinElevation when GNSS device is enabled and the engine is not started.
minElevation = 0;
LE_ASSERT((le_gnss_GetMinElevation(&minElevation)) == LE_OK);
LE_INFO("GNSS min elevation obtained: %d",minElevation);
LE_ASSERT(minElevation == 0);
 
// Start GNSS device (ACTIVE state)
result = le_gnss_SetAcquisitionRate(acqRate);
LE_ASSERT((result == LE_NOT_PERMITTED) || (result == LE_OUT_OF_RANGE));
 
// test le_gnss_Get/SetMinElevation when le_gnss_ENABLE ON and le_gnss_Start ON
LE_ASSERT((le_gnss_GetMinElevation(&minElevation)) == LE_OK);
LE_INFO("GNSS min elevation obtained: %d",minElevation);
 
// test le_gnss_SetMinElevation wrong value (when le_gnss_ENABLE ON and le_gnss_Start ON)
 
// Stop GNSS device (READY state)
LE_ASSERT((le_gnss_GetConstellation(&constellationMask)) == LE_OK);
LE_ASSERT(constellationMask == LE_GNSS_CONSTELLATION_GPS);
 
// test le_gnss_ConvertDataCoordinate error cases
altitudeOnWgs84,
NULL)));
altitudeOnWgs84,
&altitudeOnPZ90)));
altitudeOnWgs84,
&altitudeOnPZ90)));
altitudeOnWgs84,
&altitudeOnPZ90)));
altitudeOnWgs84,
&altitudeOnPZ90)));
}