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;
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;
int32_t vSpeedAccuracy;
uint32_t direction;
uint32_t directionAccuracy;
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);
}
result =
le_gnss_GetTime(positionSampleRef, &hours, &minutes, &seconds, &milliseconds);
LE_INFO(
"%02d:%02d:%02d %d-%02d-%02d,", hours, minutes, seconds, year, month, day);
LE_INFO(
"epoch time: %llu:", (
unsigned long long int) EpochTime);
LE_INFO(
"GPS time W %02d:ToW %dms", gpsWeek, gpsTimeOfWeek);
LE_INFO(
"GPS time acc %d", TimeAccuracy);
LE_INFO(
"UTC leap seconds in advance %d", leapSeconds);
: "Unknown");
{
LE_INFO(
"Position lat.%f, long.%f, hAccuracy.%f",
(float)latitude/1000000.0,
(float)longitude/1000000.0,
(float)hAccuracy/100.0);
latitude,
&latitudeOnPZ90);
{
LE_INFO(
"Latitude: On WGS84 %d, On PZ90 %" PRId64
", float %f",
latitude,
latitudeOnPZ90,
(float)latitudeOnPZ90/1000000.0);
}
longitude,
&longitudeOnPZ90);
{
LE_INFO(
"Longitude: On WGS84 %d, On PZ90 %" PRId64
", float %f",
longitude,
longitudeOnPZ90,
(float)longitudeOnPZ90/1000000.0);
}
}
else
{
if (INT32_MAX != latitude)
{
LE_INFO(
"Latitude %f", (
float)latitude/1000000.0);
}
else
{
LE_INFO(
"Latitude unknown %d", latitude);
}
if (INT32_MAX != longitude)
{
LE_INFO(
"Latitude %f", (
float)longitude/1000000.0);
}
else
{
LE_INFO(
"Longitude unknown %d", longitude);
}
if (INT32_MAX != hAccuracy)
{
LE_INFO(
"Horizontal accuracy %f", (
float)hAccuracy/100.0);
}
else
{
LE_INFO(
"Horizontal accuracy unknown %d", hAccuracy);
}
}
LE_INFO(
"Test SetDataResolution() for vAccuracy parameter of le_gnss_GetAltitude() function");
{
{
switch(dataRes)
{
LE_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy);
break;
LE_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy/10.0);
break;
LE_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy/100.0);
break;
LE_INFO(
"Resolution: %d decimal place, altitude.%f, vAccuracy.%f",
dataRes, (float)altitude/1000.0, (float)vAccuracy/1000.0);
break;
default:
break;
}
}
else
{
LE_INFO(
"Altitude unknown [%d,%d]", altitude, vAccuracy);
}
}
{
LE_INFO(
"AltitudeOnWgs84: %f", (
float)altitudeOnWgs84/1000.0);
altitudeOnWgs84,
&altitudeOnPZ90);
{
LE_INFO(
"Altitude: On WGS84: %d, On PZ90 %" PRId64
", float %f",
altitudeOnWgs84,
altitudeOnPZ90,
(float)altitudeOnPZ90/1000.0);
}
}
else
{
LE_INFO(
"AltitudeOnWgs84 unknown [%d]", altitudeOnWgs84);
}
if (LE_GNSS_RES_UNKNOWN == ++DopRes)
{
}
LE_INFO(
"Set DOP resolution: %d decimal place\n", DopRes);
do
{
{
switch(DopRes)
{
LE_INFO(
"resolution: %d decimal place, %s %.1f\n",
DopRes, tabDop[dopType], (float)dop);
break;
LE_INFO(
"resolution: %d decimal place, %s %.1f\n",
DopRes, tabDop[dopType], (float)(dop)/10);
break;
LE_INFO(
"resolution: %d decimal place, %s %.2f\n",
DopRes, tabDop[dopType], (float)(dop)/100);
break;
default:
LE_INFO(
"resolution: %d decimal place, %s %.3f\n",
DopRes, tabDop[dopType], (float)(dop)/1000);
break;
}
}
else
{
LE_INFO(
"%s invalid %d\n", tabDop[dopType], dop);
}
dopType++;
}
while (dopType != LE_GNSS_DOP_LAST);
LE_INFO(
"Test SetDataResolution() for hSpeedAccuracy parameter of le_gnss_GetHorizontalSpeed() \ function");
{
{
switch(dataRes)
{
LE_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy);
break;
LE_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy/10);
break;
LE_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy/100);
break;
LE_INFO(
"Resolution: %d decimal place, hSpeed %u - Accuracy %.3f",
dataRes, hSpeed/100, (float)hSpeedAccuracy/1000);
break;
default:
break;
}
}
else
{
LE_INFO(
"hSpeed unknown [%u,%.3f]", hSpeed, (
float)hSpeedAccuracy);
}
}
LE_INFO(
"Test SetDataResolution() for vSpeedAccuracy parameter of le_gnss_GetVerticalSpeed() \ function");
{
{
switch(dataRes)
{
LE_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy);
break;
LE_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy/10);
break;
LE_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy/100);
break;
LE_INFO(
"Resolution: %d decimal place, vSpeed %d - Accuracy %.3f",
dataRes, vSpeed/100, (float)vSpeedAccuracy/1000);
break;
default:
break;
}
}
else
{
LE_INFO(
"vSpeed unknown [%d,%.3f]", vSpeed, (
float)vSpeedAccuracy);
}
}
{
LE_INFO(
"direction %u - Accuracy %u", direction/10, directionAccuracy/10);
}
else
{
LE_INFO(
"direction unknown [%u,%u]", direction, directionAccuracy);
}
{
LE_INFO(
"magnetic deviation %d", magneticDeviation/10);
}
else
{
LE_INFO(
"magnetic deviation unknown [%d]",magneticDeviation);
}
uint8_t satsInViewCount;
uint8_t satsTrackingCount;
uint8_t satsUsedCount;
&satsInViewCount,
&satsTrackingCount,
&satsUsedCount);
LE_INFO(
"satsInView %d - satsTracking %d - satsUsed %d",
satsInViewCount,
satsTrackingCount,
satsUsedCount);
int i;
satIdPtr,
&satIdNumElements,
satConstPtr,
&satConstNumElements,
satUsedPtr,
&satUsedNumElements,
satSnrPtr,
&satSnrNumElements,
satAzimPtr,
&satAzimNumElements,
satElevPtr,
&satElevNumElements);
for (i=0; i<satIdNumElements; i++)
{
if ((0 != satIdPtr[i]) && (UINT16_MAX != satIdPtr[i]))
{
LE_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 ========");
return NULL;
}
static void TestLeGnssPositionHandler
(
void
)
{
uint64_t epochTime;
uint32_t ttff = 0;
uint8_t minElevation;
LE_INFO(
"Start Test Testle_gnss_PositionHandlerTest");
minElevation = 10;
{
LE_INFO(
"Set minElevation %d",minElevation);
}
LE_INFO(
"Sanity test for le_gnss_SetDataResolution");
sleep(5);
LE_GNSS_RES_UNKNOWN));
sleep(2);
LE_INFO(
"TimeAccuracy %d EpochTime %llu",TimeAccuracy, (
unsigned long long int)EpochTime);
LE_INFO(
"TTFF is checked as not available immediatly after a Cold restart");
LE_INFO(
"Wait 60 seconds for a 3D fix");
sleep(60);
{
LE_INFO(
"TTFF cold restart = %d msec", ttff);
}
else
{
LE_INFO(
"TTFF cold restart not available");
}
sleep(5);
LE_INFO(
"epoch time: %llu:", (
unsigned long long int) epochTime);
EpochTime=0;
TimeAccuracy=0;
}