Get to where we're actually finding airspy packet boundaries.

This commit is contained in:
Ian Gulliver
2016-02-14 06:20:17 +00:00
parent 34fec2dee8
commit 51690ba0df
6 changed files with 127 additions and 53 deletions

20
airspy_adsb.c Normal file
View File

@@ -0,0 +1,20 @@
#include <string.h>
#include "common.h"
#include "airspy_adsb.h"
bool airspy_adsb_parse(struct buf *buf, struct packet *packet) {
if (buf->length < 35) {
// Minimum frame length
return false;
}
if (buf->buf[buf->start] != '*') {
return false;
}
char *last = memchr(&buf->buf[buf->start], '\n', buf->length);
if (!last) {
return false;
}
buf_consume(buf, last - &buf->buf[buf->start] + 1);
return true;
}