I’m using a WP85 with Legato 19.02.0 and I have a strange issue. When I remove the GPS antenna is start getting the same time value returned when I call le_pos_GetTime(). I check the state of the GPS and it still says it has a 2D fix (I have an internal antenna as well like the MangOH red design.
If I run a gnss get time command on the command line then the time updates but subsequent read of le_pos_GetTime() return the updated time value.
Per understanding, le_pos_GetTime() return time based on last position sample, thus if no change in position sample, le_pos_GetTime() will continue to get the same fixed time from same position sample reference.
Using “gnss get time”, it calls le_gnss_AddPositionHandler(), so position sample is updated and le_pos_GetTime() may return new time.
Can you try call le_gnss_AddPositionHandler() or le_pos_AddMovementHandler() in your app code and observe any change in le_pos_GetTime() return?
Hope it helps and please mark solution if this answer your questions.
Thx
I’ll admit I’m a little confused by you statement “return time based on last position sample”. If I still have a 2D fix, confirmed with the gnss command then why is the Position service no longer receiving updates to change the last position sample?
Hi Darren,
Sorry if I replying too fast…
Are you using le_pos_Get2DLocation() to get 2D fix?
And is the 2D fix actually still updating? Or it just return the same location?
Originally I was using le_pos_Get2DLocation() to get a 2D fix. But there were inconsistencies when the reported time and position. This is when I noticed that under certain low GPS signal conditions the time would stay the same even though the gnsss get posState reported a 2D fix. Adding the le_gnss_AddPositionHandler seems to have fixed the issue but I’m trying to understand the reason for the behavior.
First of all, Positioning service is implemented on top of Legato GNSS service. It is NOT recommend to use Positioning and GNSS API in the same application.
Legato Positioning service is a “high level” service with limited API and information regarding GNSS . That Positioning service was designed to manage several Positioning sources like GNSS, WiFi, sensors, gyro… Currently, Positioning service is based only on GNSS service.
Therefore, I would recommend to use GNSS Legato API (le_gnss functions) instead of “POSITIONING” Legato API (le_pos functions).
About that issue, the le_pos_GetTime function is implemented on top of le_gnss_GetTime function, so I cannot explain that issue and different behavior from those functions.
As GNSS rate is 1Hz, please note that you will have the same time info by calling le_pos_GetTime during that period. Similar behavior expected using le_gnss_GetTime.
As you mentioned that adding the le_gnss_AddPositionHandler seems to have fixed the issue, I had a look on source code and le_gnss_AddPositionHandler must be called to get information from GNSS indeed, but it is done from Positioning Service COMPONENT_INIT, calling gnss_init function. By calling le_pos_AddMovementHandler, it will also call le_gnss_AddPositionHandler.
So my recommendation is to check that le_gnss_AddPositionHandler function is called, or definitively to use GNSS Legato API (le_gnss functions).