How capture an specific whole NMEA sentence ?

I am using the TINY GPS++. It is OK to parse NMEA sentences but I need also have the whole sentence available in the same pass. My option now is reconstruct the sentence from its parts and add a recalculated CRC.
There are any other way to extract the whole from TINY GPS++ ?
Modifying the .h or .cpp ?
Or a code that capture in the same pass ?
All my wanted sentences starts with "$GPRMC" and stops with CR/LF
NMEA sentences are coming in a HW serial port at 1Hz.

Thanks for any suggestions.

Google is your friend.

$GPRMC

Recommended minimum specific GPS/Transit data

eg1. $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62
eg2. $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68


           225446       Time of fix 22:54:46 UTC
           A            Navigation receiver warning A = OK, V = warning
           4916.45,N    Latitude 49 deg. 16.45 min North
           12311.12,W   Longitude 123 deg. 11.12 min West
           000.5        Speed over ground, Knots
           054.7        Course Made Good, True
           191194       Date of fix  19 November 1994
           020.3,E      Magnetic variation 20.3 deg East
           *68          mandatory checksum


eg3. $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70
              1    2    3    4    5     6    7    8      9     10  11 12


      1   220516     Time Stamp
      2   A          validity - A-ok, V-invalid
      3   5133.82    current Latitude
      4   N          North/South
      5   00042.24   current Longitude
      6   W          East/West
      7   173.8      Speed in knots
      8   231.8      True course
      9   130694     Date Stamp
      10  004.2      Variation
      11  W          East/West
      12  *70        checksum


eg4. $GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh
1    = UTC of position fix
2    = Data status (V=navigation receiver warning)
3    = Latitude of fix
4    = N or S
5    = Longitude of fix
6    = E or W
7    = Speed over ground in knots
8    = Track made good in degrees True
9    = UT date
10   = Magnetic variation degrees (Easterly var. subtracts from true course)
11   = E or W
12   = Checksum

-jim lee

Looking at the example sketches for TinyGPS++, the serial input is being read a character at a time and fed into TinyGPS, so it would be fairly simple to make a copy of the serial data as it is being received. Just watch for the start sequence of "$GPRMC" to indicate the beginning of the line, and CR/LF as the termination, then do whatever you want with the line of text.

A modification of some of the examples in Serial Input Basics would work to capture the desired line. Probably be easiest to just watch for the beginning $ and ending LF, then discard all lines that do not begin with GPRMC.

TinyGPS++ does provide a method of extracting individual elements from any received NMEA sentence. So you could set it up to extract each element of $GPRMC and reconstruct it.

Perhaps explain why you want to do this.

The srnet solution was my first aproach. After the TINY GPS++ has encoded the sentence I am able to reconstruct a string with the all elements and finally add a CRC. that is not parsed by the TINY GPS++.
I know how do that.

The ideal solution should be construct the whole string at the moment of TINY GPS are capturing each character.
Should perhaps modify the TINY GPS++ library , .h or .cpp files to add this feature but I dont know
where I could insert a code to do this and how make this new string available for my program.

Go back and read Reply #2.

It seems you are doing this the hard way. Why not try something more like this.

My application needs to extract some elements from the serial NMEA incoming sentences. This are being done very well by the TINY GPS++ library. But I need also have available to my program the complete string sentence exactly as was captured and parsed. Not the next sentence. I could not loose any data. Unfortunatelly the TINYGPS++ have not such complete string available. I need both data : the parsed elements AND the whole string same that was captured.
I was minding if that was possible in the same instance of the TINY GPS++ in a simple way.

Of couse I could specify a Custom NMEA to capture all fields and reconstruct the complete string, recalculate and add the checksum. an but I was looking for an easy mode .

gfvalvo:
Go back and read Reply #2.

Again, go back and read Reply #2.

gfvalvo;

that is not aplicable because I can't not capture the SAME sentence that will be captured by the TINY GPS++

acjacques:
gfvalvo;
that is not aplicable because I can't not capture the SAME sentence that will be captured by the TINY GPS++

Of course you can. You build the "captured" sentence one character at a time, just before you send that same character to Tiny GPS++'s encode() function.

acjacques:
gfvalvo;

that is not aplicable because I can’t not capture the SAME sentence that will be captured by the TINY GPS++

Then capture the complete sentence first, then send it to TinyGPS, then you will know you are in sync.
(edit) Would probably be a good idea to verify the checksum, since TinyGPS should be ignoring invalid nmea sentences.

However we might all be wasting our time advising you, since you have not revealed why you want to do this.

david_2018:
Then capture the complete sentence first, then send it to TinyGPS, then you will know you are in sync.
(edit) Would probably be a good idea to verify the checksum, since TinyGPS should be ignoring invalid nmea sentences.

It would be even easier to let the library do the heavy lifting. Here’s a modification to the loop() function from the DeviceExample.ino example. Compiles but not tested.

void loop() {
  constexpr size_t bufferSize = 200;  // What is longest possible NMEA sentence?
  static size_t bufferIndex = 0;
  static bool startedSentence = false;
  static char captureBuffer[bufferSize];

  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0) {
    char gpsChar = ss.read();
    if (gpsChar == '

) {
     startedSentence = true;
     bufferIndex = 0;
   }

if ((startedSentence) && (bufferIndex < bufferSize - 1)) {
     captureBuffer[bufferIndex++] = gpsChar;
   }

if (gps.encode(gpsChar)) {
     displayInfo();
     if (startedSentence) {
       startedSentence = false;
       captureBuffer[bufferIndex] = ‘\0’;
       if (strncmp(captureBuffer, “$GPRMC”, 6) == 0) {
         //
         // We know we have a valid $GPRMC sentence here
         //
       }
     }
   }
 }

if (millis() > 5000 && gps.charsProcessed() < 10) {
   Serial.println(F(“No GPS detected: check wiring.”));
   while (true);
 }
}

Thanks gfvalvo;

I have add compiled and run. It runs like the unmodified.
But where is the string ?

Best regards

Here, in this very cleverly-named array:

static char captureBuffer[bufferSize];