Get to where we're actually finding airspy packet boundaries.
This commit is contained in:
20
airspy_adsb.c
Normal file
20
airspy_adsb.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user