GPS application unable to get a fix

Hi I am working with the GNSS module of Legato; it seems my application is unable to get a position fix.

If I use “gnss get posInfo” command on the terminal while my app is running, the app also gets the info and subsequently gets the information.

It also works if I run the whole process, from enable to getdata in a single sequence, without letting anything but getData happen in a sequence ie if I put getData sequence in a while 1 loop after setting parameters and le_gnss_Start().

I am not using le_gnss_AddpositionHandler() and is relying on le_gnss_GetLastSampleRef().

Hi,

Using gnss target tool is a good way to check that GNSS works and you can get a position fix:
# gnss start
# gnss watch 60
You can also check position information from NMEA flow:
# cat /dev/nmea

For GNSS app implementation, you can use gnss target tool source code (apps/tools/gnss/gnss.c) or gnssTest app (legato/apps/test/positioning/gnssTest/gnssTest/gnssTest.c) as sample code to develop your app. “while 1 loop” is really not recommended.
In COMPONENT_INIT (main thread), you should create a thread to add a position handler:
positionThreadRef = le_thread_Create(“PositionThread”,PositionThread,NULL);
le_thread_Start(positionThreadRef);
A position handler should be added from that “PositionThread”, and then runs the event loop for the calling thread:
le_gnss_Start();
PositionHandlerRef = le_gnss_AddPositionHandler(PositionHandlerFunction, NULL);
le_event_RunLoop();
referring to Event-driven Programming .
Then you will be notified for position information at 1Hz (default update rate).
From “PositionHandlerFunction”, you can check position state using the le_gnss_GetPositionState function. When the position is fixed (2D/3D), you can get position information using le_gnss_getXXXX functions.

Hope it helps!

No, I had to disconnect WiFi to make it work.

Can you let us know if this issue is fixed?

I have the same issue with le_gnss_GetLastSampleRef(). The problem happens when several conditions are met (le_gnss_Stop and after that le_gnss_Start), but “gnss get satStat” or similar help the application to receive the position fix again. I’m using WP7702 module with Legato 19.07.0.

Hello,
sometimes we fall in same situation… how do you handle in code?

Regards

It is several years back, but I have rewritten the code to use position handler instead.