Enables to only process valid frames.
Used in embedded / esptic to only send valid frames on the wire.
index 78e88de5c2a6955b5a6d58c81754df97fe998338..56d91ecc8bcbc2e940d4c4b5a750d9da619a3153 100644 (file)
}
-static void ticframecb(char * buf, size_t size)
+static void ticframecb(char * buf, size_t size, bool valid)
{
- sendto(Gsockfd, buf, size, 0, &Gai_addr, Gai_addrlen);
+ if (valid)
+ sendto(Gsockfd, buf, size, 0, &Gai_addr, Gai_addrlen);
}
static void tic_task(void *pvParameter)
index d74ccd2f961c641857d65d1ee14d485153451c98..277ad231ee661e3602b1f384cbe9f30920a93d80 100644 (file)
#ifdef PRINT2BUF
static char * ticbuf;
static size_t ticbufsize, ticbufavail;
-
- /**
- * TIC frame callback
- * @param buf the buffer received from tic2json_main(), filled with JSON data
- * @param size the length of JSON data currently in the buffer
- */
static tic2json_framecb_t ticframecb;
#include <stdarg.h>
char fdelim;
int optflags;
unsigned int skipframes, framecount;
- char ferr;
+ bool ferr;
} tp;
/** TIC units representation strings */
#ifdef PRINT2BUF
ticprintf("%c\n", tp.framedelims[1]);
if (ticframecb)
- ticframecb(ticbuf, ticbufsize-ticbufavail);
+ ticframecb(ticbuf, ticbufsize-ticbufavail, !tp.ferr);
ticbufavail = ticbufsize; // reset buffer
ticprintf("%c", tp.framedelims[0]);
#else
index 439e99ab70dc026a0b7a3ff5cbb7e9c9a70455a1..afd70f50be914c5bdf78bc0d4c80d2c4804188c9 100644 (file)
TIC2JSON_OPT_PARSESTGE = 0x20,
};
-typedef void (*tic2json_framecb_t)(char * buf, size_t size);
+/**
+ * TIC frame callback
+ * @param buf the buffer received from tic2json_main(), filled with JSON data
+ * @param size the length of JSON data currently in the buffer
+ * @param valid true if TIC frame is valid, false otherwise
+ */
+typedef void (*tic2json_framecb_t)(char * buf, size_t size, bool valid);
#endif /* tic2json_h */