Skip to content

Commit

Permalink
added NMEA field handling
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jan 31, 2025
1 parent ee5f6f1 commit 60e101a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions hcxpcapngtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -5742,10 +5742,10 @@ static bool processnmeainfile(char *eigenname, char *nmeainname)
{
static int nlen;
static int c;
static int nfc;
static FILE *fh_nmeain;
static uint8_t ccs;
static uint8_t ncs;
static char *ntok;
static char *nres;
const uint8_t hashmap[] =
{
Expand All @@ -5764,8 +5764,10 @@ const uint8_t hashmap[] =
0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, // `abcdefg
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // hijklmno
};
static char *nfield[NMEA_FIELD_MAX];
static char linein[NMEA_MAX];


nmeagoodcscount = 0;
nmeabadcscount = 0;

Expand All @@ -5787,10 +5789,12 @@ while((nlen = fgetline(fh_nmeain, NMEA_MAX, linein)) != -1)
nmeagoodcscount++;
nres = linein;
printf("Original string: %s\n", linein);

while ((ntok = strsep(&nres, ",*")) != NULL)
nfc = 0;
while ((nfield[nfc] = strsep(&nres, ",*")) != NULL)
{
printf("Token: %s\n", ntok);
printf("Token: %s\n", nfield[nfc]);
nfc++;
if(nfc >= NMEA_FIELD_MAX) break;
}
printf("cs: %0x %0x\n", ccs, ncs);
}
Expand Down
2 changes: 1 addition & 1 deletion include/hcxpcapngtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define OPTIONLEN_MAX 1024
#define GPX_MAX 256
#define NMEA_MAX 256

#define NMEA_FIELD_MAX 60
#define MAX_INTERFACE_ID 255

#define RAW_LEN_MAX 131072
Expand Down

0 comments on commit 60e101a

Please sign in to comment.