I have finally fixed all issues I had so far. Those were mainly in GSV sentences.
Now the parser can handle such GSV sentences :
$GPGSV,3,1,11,03,03,111,00,04,15,270,00,06,01,010,00,13,06,292,00*74
$GPGSV,3,3,11,22,42,067,42,24,14,311,43,27,05,244,00,,,,*4D
$GPGSV,4,4,13,30,31,066,28*40
$GLGSV,3,3,10,84,06,036,,,,,18*52
$GLGSV,1,1,02,72,,,29,74,,,19*62
$GLGSV,1,1,02,65,50,140,28,,,,32*5F
$GPGSV,4,4,14,36,29,144,31,49,35,178,*74
$GPGSV,1,1,00*79
There are some sentences with “inconsistent data”, others with partial data and others with missing expected data…
Many of the sentences above have been received by real hardware (GNSS Click, GNSS 4 Click and GNSS Zoe Click), so I’m pretty confident in the parser.
FYI, parsing 16.000 sentences (1.000 * 16) is using only 19KB of memory. Again, this is a stable consumption. No matter if you parse 1, 10, 100 or 10.000 sentences.
Before loop :
+-----------+------------+------------+
| Memory | Used | Free |
+-----------+------------+------------+
| Managed | 173,968 | 333,824 |
| Unmanaged | 0 | 33,554,404 |
+-----------+------------+------------+
After loop :
+-----------+------------+------------+
| Memory | Used | Free |
+-----------+------------+------------+
| Managed | 193,008 | 314,784 |
| Unmanaged | 0 | 33,554,404 |
+-----------+------------+------------+
Parser is available now on our Github repo.
I have reactivated a PR on TinyCLR/Drivers repository.
Edit : Here is the program I’ve used for memory stress tests.
class Program
{
private static readonly String GGAString1 = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47";
private static readonly String GGAString2 = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,0123*47";
private static readonly String GSAString = "$GLGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39";
private static readonly String GSVString1 = "$GPGSV,3,1,11,03,03,111,00,04,15,270,00,06,01,010,00,13,06,292,00*74";
private static readonly String GSVString2 = "$GPGSV,3,3,11,22,42,067,42,24,14,311,43,27,05,244,00,,,,*4D";
private static readonly String GSVString3 = "$GPGSV,4,4,13,30,31,066,28*40";
private static readonly String GSVString4 = "$GLGSV,3,3,10,84,06,036,,,,,18*52";
private static readonly String GSVString5 = "$GLGSV,1,1,02,72,,,29,74,,,19*62";
private static readonly String GSVString6 = "$GLGSV,1,1,02,65,50,140,28,,,,32*5F";
private static readonly String GSVString7 = "$GPGSV,4,4,14,36,29,144,31,49,35,178,*74";
private static readonly String GSVString8 = "$GPGSV,1,1,00*79";
private static readonly String RMCString = "$GBRMC,221030,A,4807.038,N,01131.000,E,022.4,084.4,101120,003.1,W*6A";
private static readonly String VTGString = "$INVTG,220.86,T,,M,2.550,N,4.724,K,A*34";
private static readonly String HDTString = "$GAHDT,274.07,T*03";
private static readonly String GLLString = "$GNGLL,4404.14012,N,12118.85993,W,001037.00,A,A*67";
private static readonly String UNKString = "$GNUNK,4404.14012,N,12118.85993,W,001037.00,A,A*67";
static void Main()
{
TestByteArray();
Thread.Sleep(Timeout.Infinite);
}
static void TestByteArray()
{
Byte[] GGA1 = Encoding.UTF8.GetBytes(GGAString1);
Byte[] GGA2 = Encoding.UTF8.GetBytes(GGAString2);
Byte[] GSA = Encoding.UTF8.GetBytes(GSAString);
Byte[] RMC = Encoding.UTF8.GetBytes(RMCString);
Byte[] GSV1 = Encoding.UTF8.GetBytes(GSVString1);
Byte[] GSV2 = Encoding.UTF8.GetBytes(GSVString2);
Byte[] GSV3 = Encoding.UTF8.GetBytes(GSVString3);
Byte[] GSV4 = Encoding.UTF8.GetBytes(GSVString4);
Byte[] GSV5 = Encoding.UTF8.GetBytes(GSVString5);
Byte[] GSV6 = Encoding.UTF8.GetBytes(GSVString6);
Byte[] GSV7 = Encoding.UTF8.GetBytes(GSVString7);
Byte[] GSV8 = Encoding.UTF8.GetBytes(GSVString8);
Byte[] VTG = Encoding.UTF8.GetBytes(VTGString);
Byte[] HDT = Encoding.UTF8.GetBytes(HDTString);
Byte[] GLL = Encoding.UTF8.GetBytes(GLLString);
Byte[] UNK = Encoding.UTF8.GetBytes(UNKString);
Info();
for (var i = 0; i < 1000; i++)
{
NMEAParser.Parse(GGA1);
NMEAParser.Parse(GGA2);
NMEAParser.Parse(GSA);
NMEAParser.Parse(RMC);
NMEAParser.Parse(GSV1);
NMEAParser.Parse(GSV2);
NMEAParser.Parse(GSV3);
NMEAParser.Parse(GSV4);
NMEAParser.Parse(GSV5);
NMEAParser.Parse(GSV6);
NMEAParser.Parse(GSV7);
NMEAParser.Parse(GSV8);
NMEAParser.Parse(VTG);
NMEAParser.Parse(HDT);
NMEAParser.Parse(GLL);
NMEAParser.Parse(UNK);
Thread.Sleep(20);
}
Info();
}
private static void Info()
{
Debug.WriteLine($"+-----------+------------+------------+");
Debug.WriteLine($"| Memory | Used | Free |");
Debug.WriteLine($"+-----------+------------+------------+");
Debug.WriteLine($"| Managed | {Memory.ManagedMemory.UsedBytes,10:N0} | {Memory.ManagedMemory.FreeBytes,10:N0} |");
Debug.WriteLine($"| Unmanaged | {Memory.UnmanagedMemory.UsedBytes,10:N0} | {Memory.UnmanagedMemory.FreeBytes,10:N0} |");
Debug.WriteLine($"+-----------+------------+------------+\r\n");
}
}
Hopefully it will be useful to others.