Cleaning the GPGGA string obtained in PPPoS library

#1

If you are asking a question, please follow this template:

  1. My goal is: To obtain clean GPGGA string from GPS
  2. My actions are: I sent AT commands using Teraterm, each command is runing successfully with OK reply and finally getting clean GPGGA string. But whenever I am trying to perform the same using PPPoS, I am getting GPGGA string with random garbage value. I am using the modem which has both GPS and GSM integrated in it. PPPoS commands for connecting to net are working fine. I am able to connect to net easily.
  3. The result I see is: I am seeing commands getting timed out sometimes and whenever getting the GPGGA string its getting correupted with other garbage values. It seems data.p is not handled well in the library.Sometimes half string can only be seen. I also tried doing %.*s for specific part of string but its not working
  4. My expectation & question is: I expect to get a clean string in some variable so that I can parse it and use lattitude and longitude values obtained by parsing…
    https://drive.google.com/open?id=1Hn6AshcYvi711UXO6UqxjkhlK_eTUGEv
#2

The source code does not look in synch with the log above.

You shouldn’t process the data passed to gnsinf_cb if ok is false.
mgos_pppos_run_cmds may return false if the modem is busy executing another command sequence..

LE. The correct way to log a struct mg_str is

LOG(LL_INFO, ("Scan Sentence %.*s", (int)data.len, data.p));
#3

I have changed the code as you said.
link is as follows:

https://drive.google.com/open?id=1ttRNHSwdIWYz8I9299K1T0ndavVRvEkv
Now the ok status always remains false , it is true only for first command that has been executed.
If I remove the if(!ok) loop then I am getting something at UART as I have uploded LOG in above image. Whenever I try to use %.*s nothing gets printed in LOG, it seems it is updating data.len value to zero after some iterations. AT+CGPS=1 command that our modem supports return OK only for the first time, from second time onward it returns ERROR . Even if we dont give any command MODEM returns GPGGA string at the UART.

#4

It looks like AT+CGPS=1 turns some function ON (returns OK with no other data) and subsequent calls return ERROR (can’t be turned ON again).

#5

AT+CGPS=1 returns the string GPGGA on UART port and we dont need to call it again, it continues to give GPGGA string once its implemented

#6

First image of the Serial Console that I uploaded was obtained when I removed if (!ok) return false, statement and in log I printed value of string data.p, garbage values were stored in that data.p

#7

If AT+CGPS=1 turns on the mode which sends NMEA sentences over the UART, they will not be caught by the ppos library.

You need to find the AT command(s) which return(s) the GPS data. That’s the way the pppos library works.

#8

Ok I will look for the command that modem supports, thank you for your support.

#9

Thank you again for your support. I am able to find out command that gives GPS values whenever it is given command AT+CGPSINFO. In order to turn this ON , AT+CGPS=1 needs to be sent once. This time I am facing different issue now, net is getting disconnected and ATE0 command is getting timed out after some duration.