static void PositionHandlerFunction
(
void* contextPtr
)
{
uint16_t year;
uint16_t month;
uint16_t day;
uint16_t hours;
uint16_t minutes;
uint16_t seconds;
uint16_t milliseconds;
uint32_t gpsWeek;
uint32_t gpsTimeOfWeek;
uint8_t leapSeconds = 0;
int32_t latitude;
int32_t longitude;
int64_t latitudeOnPZ90;
int64_t longitudeOnPZ90;
int32_t altitude;
int32_t altitudeOnWgs84;
int64_t altitudeOnPZ90;
int32_t hAccuracy;
int32_t vAccuracy;
int32_t magneticDeviation;
uint16_t dop;
uint32_t hSpeed;
uint32_t hSpeedAccuracy;
int32_t vSpeed = 0;
int32_t vSpeedAccuracy = 0;
uint32_t direction = 0;
uint32_t directionAccuracy = 0;
uint8_t satsInViewCount;
uint8_t satsTrackingCount;
uint8_t satsUsedCount;
int i;
static const char *tabDop[] =
{
"Position dilution of precision (PDOP)",
"Horizontal dilution of precision (HDOP)",
"Vertical dilution of precision (VDOP)",
"Geometric dilution of precision (GDOP)",
"Time dilution of precision (TDOP)"
};
if (NULL == positionSampleRef)
{
LE_ERROR(
"New Position sample is NULL!");
}
else
{
LE_DEBUG(
"New Position sample %p", positionSampleRef);
}
{
return;
}
: "Unknown");
result =
le_gnss_GetTime(positionSampleRef, &hours, &minutes, &seconds, &milliseconds);
LE_TEST_INFO(
"%02d:%02d:%02d %d-%02d-%02d,", hours, minutes, seconds, year, month, day);
LE_TEST_INFO(
"epoch time: %llu:", (
unsigned long long int) EpochTime);
LE_TEST_INFO(
"GPS time W %02d:ToW %dms", gpsWeek, gpsTimeOfWeek);
LE_TEST_INFO(
"UTC leap seconds in advance %d", leapSeconds);
{
LE_INFO(
"Position lat.%f, long.%f, hAccuracy.%f",
(float)latitude/1000000.0,
(float)longitude/1000000.0,
(float)hAccuracy/100.0);
latitude,
&latitudeOnPZ90);
"Convert latitude from WGS84 to PZ90");
{
LE_INFO(
"Latitude: On WGS84 %d, On PZ90 %" PRId64
", float %f",
latitude,
latitudeOnPZ90,
(float)latitudeOnPZ90/1000000.0);
}
longitude,
&longitudeOnPZ90);
"Convert longitude from WGS84 to PZ90");
{
LE_TEST_INFO(
"Longitude: On WGS84 %d, On PZ90 %" PRId64
", float %f",
longitude,
longitudeOnPZ90,
(float)longitudeOnPZ90/1000000.0);
}
}
else
{
if (INT32_MAX != latitude)
{
}
else
{
}
if (INT32_MAX != longitude)
{
}
else
{
}
if (INT32_MAX != hAccuracy)
{
LE_TEST_INFO(
"Horizontal accuracy %f", (
float)hAccuracy/100.0);
}
else
{
}
}
LE_TEST_INFO(
"Test SetDataResolution() for vAccuracy parameter of le_gnss_GetAltitude() function");
{
"Set data resolution for vAccuracy");
{
switch(dataRes)
{
LE_TEST_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy/10.0);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy/100.0);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy/1000.0);
break;
default:
break;
}
}
else
{
LE_TEST_INFO(
"Altitude unknown [%d,%d]", altitude, vAccuracy);
}
}
{
LE_TEST_INFO(
"AltitudeOnWgs84: %f", (
float)altitudeOnWgs84/1000.0);
altitudeOnWgs84,
&altitudeOnPZ90);
"Convert altitude from WGS84 to PZ90");
{
LE_TEST_INFO(
"Altitude: On WGS84: %d, On PZ90 %" PRId64
", float %f",
altitudeOnWgs84,
altitudeOnPZ90,
(float)altitudeOnPZ90/1000.0);
}
}
else
{
LE_TEST_INFO(
"AltitudeOnWgs84 unknown [%d]", altitudeOnWgs84);
}
LE_TEST_INFO(
"Set DOP resolution: %d decimal place\n", DopRes);
do
{
{
switch(DopRes)
{
DopRes, tabDop[dopType], (float)dop);
break;
DopRes, tabDop[dopType], (float)(dop)/10);
break;
DopRes, tabDop[dopType], (float)(dop)/100);
break;
default:
DopRes, tabDop[dopType], (float)(dop)/1000);
break;
}
}
else
{
}
dopType++;
}
while (dopType != LE_GNSS_DOP_LAST);
LE_TEST_INFO(
"Test SetDataResolution() for hSpeedAccuracy parameter of le_gnss_GetHorizontalSpeed() \ function");
{
"Set data resolution for hSpeedAccuracy");
{
switch(dataRes)
{
LE_TEST_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy/10);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy/100);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy/1000);
break;
default:
break;
}
}
else
{
LE_TEST_INFO(
"hSpeed unknown [%u,%.3f]", hSpeed, (
float)hSpeedAccuracy);
}
}
{
"Set data resolution for vSpeedAccuracy");
{
switch(dataRes)
{
LE_TEST_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy/10);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy/100);
break;
LE_TEST_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy/1000);
break;
default:
break;
}
}
else
{
LE_TEST_INFO(
"vSpeed unknown [%d,%.3f]", vSpeed, (
float)vSpeedAccuracy);
}
}
{
LE_TEST_INFO(
"direction %u - Accuracy %u", direction/10, directionAccuracy/10);
}
else
{
LE_TEST_INFO(
"direction unknown [%u,%u]", direction, directionAccuracy);
}
{
LE_TEST_INFO(
"magnetic deviation %d", magneticDeviation/10);
}
else
{
LE_TEST_INFO(
"magnetic deviation unknown [%d]",magneticDeviation);
}
&satsInViewCount,
&satsTrackingCount,
&satsUsedCount);
"Get satellite status");
LE_TEST_INFO(
"satsInView %d - satsTracking %d - satsUsed %d",
satsInViewCount,
satsTrackingCount,
satsUsedCount);
satIdPtr,
&satIdNumElements,
satConstPtr,
&satConstNumElements,
satUsedPtr,
&satUsedNumElements,
satSnrPtr,
&satSnrNumElements,
satAzimPtr,
&satAzimNumElements,
satElevPtr,
&satElevNumElements);
"Get satellite info");
for (i=0; i<satIdNumElements; i++)
{
if ((0 != satIdPtr[i]) && (UINT16_MAX != satIdPtr[i]))
{
LE_TEST_INFO(
"[%02d] SVid %03d - C%01d - U%d - SNR%02d - Azim%03d - Elev%02d",
i,
satIdPtr[i],
satConstPtr[i],
satUsedPtr[i],
satSnrPtr[i],
satAzimPtr[i],
satElevPtr[i]);
{
}
}
}
}
static void* PositionThread
(
void* context
)
{
LE_INFO(
"======== Position Handler thread ========");
"Confirm position handler was added successfully");
return NULL;
}
static void TestLeGnssPositionHandler
(
void
)
{
uint32_t ttff = 0;
uint8_t minElevation;
LE_GNSS_NMEA_MASK_GPRMC | LE_GNSS_NMEA_MASK_GPGNS |
LE_GNSS_NMEA_MASK_GPVTG | LE_GNSS_NMEA_MASK_GPZDA |
LE_GNSS_NMEA_MASK_GPGST | LE_GNSS_NMEA_MASK_GPGSA |
LE_GNSS_NMEA_MASK_GPGSV;
minElevation = 10;
{
LE_INFO(
"Set minElevation %d",minElevation);
}
"Set invalid data resolution");
LE_GNSS_RES_UNKNOWN),
"Set invalid data resolution for vAccuracy");
LE_TEST_OK(0 != EpochTime,
"Confirm EpochTime is not 0");
LE_TEST_INFO(
"TimeAccuracy %d EpochTime %llu",TimeAccuracy, (
unsigned long long int)EpochTime);
time.
sec = WAIT_MAX_FOR_3DFIX;
"Wait until position handler has executed successfully");
{
}
else
{
}
#ifdef LE_CONFIG_LINUX
#endif
EpochTime=0;
TimeAccuracy=0;
}