Can't get GPS location updates


#1

Hello everyone,

I’m using the AirPrime AR7 and I’m trying to get location updates over the legato API, but it doesn’t work.
My app searches for the GPS signal in a do-while-loop, but le_pos_Get2DLocation() returns LE_OUT_OF_RANGE.
When I start TeraTerm on the NMEA port, it shows that there are 13 satellites in view.

Is there a way to change the configuration of the GPS receiver? Or is there any other way to solve that problem?

Regards,
Daniel


#2

Hi,

Did you call le_posCtrl_Request() once (e.g. in COMPONENT_INIT) prior to use le_pos_Get2DLocation()?

Below a simple code running fine on my side (Legato 15.01):

[code]#include “legato.h”
#include “interfaces.h”

le_timer_Ref_t posQueryTimerRef;
le_clk_Time_t posQueryTimerInterval={1, 0};

void posQueryTimerHandler(le_timer_Ref_t timerRef)
{
le_result_t res;
int32_t latitude = 0;
int32_t longitude = 0;
int32_t hAccuracy = 0;

res = le_pos_Get2DLocation(&latitude, &longitude, &hAccuracy);

if (res == LE_OK)
{
    LE_INFO("Location: latitude=%d, longitude=%d, hAccuracy=%d", latitude, longitude, hAccuracy);
}
else if (res == LE_FAULT)
{
    LE_INFO("Failed to get the 2D location's data");
}
else if (res == LE_OUT_OF_RANGE)
{
    LE_INFO("One of the retrieved parameter is invalid (set to INT32_MAX)");
}
else
{
    LE_INFO("unknown location error (%d)", res);
}

}

COMPONENT_INIT
{
LE_INFO(“start posDemo app”);

le_posCtrl_Request();
posQueryTimerRef = le_timer_Create("POSQUERYTIMER");
le_timer_SetHandler(posQueryTimerRef, posQueryTimerHandler);
le_timer_SetInterval(posQueryTimerRef, posQueryTimerInterval);
le_timer_SetRepeat(posQueryTimerRef, 0);
le_timer_Start(posQueryTimerRef);

LE_INFO("posDemo app is started.");

}[/code]

Regards,
Jay


#3

Hello Jay,

thanks for the reply!
Yes, I use le_posCtrl_Request() to activate the GPS service. Still not working.

Regards,
Daniel


#4

Hi,

Can you check if there is any errors related to GNSS in the log:

Regards,

Jay