Forward MAPEM and VAM from the ESP32-C5, and add a bench listener

gn_unwrap.c now passes BTP ports 2003 (MAPEM) and 2018 (VAM), signed or
not, besides CAM, DENM and SPATEM. A message over 494 bytes still does not
fit one 512-octet link message (also the largest GATT value) and is dropped
and counted, not fragmented. The bench RSU's MAPEM is 295 bytes.

CONFIG_MICROBU_BENCH_LISTEN (off in sdkconfig) is for a board whose only PC
connection is the UART0 console: it configures itself receive-only at boot
and logs every V2X_RX message; tools/bench_listen_watch.py tallies the log.
On air on 2026-10-28 it forwarded 104 MAPEM, 185 SPATEM and 472 CAM in
90 s, with nothing oversize. The RSU sent all of them unsigned.

Host tests: signed GeoBroadcast SPATEM/MAPEM frames of 58 to 1243 bytes
with every truncation length; the replay cuts frames at c5_radio.cpp's
2346 bytes (not the old C firmware's 800) and checks MAPEMs with asn1tools.
This commit is contained in:
Ashin Walpola
2026-10-28 16:48:37 +01:00
parent 9f77f9f0e4
commit fc3354a4ba
12 changed files with 246 additions and 55 deletions
+10 -7
View File
@@ -17,14 +17,15 @@
#include "gn_unwrap.h"
#include "test_util.h"
// main.c's RX_FRAME_MAX_LEN: the promiscuous callback copies at most this many bytes of a frame,
// so it is the most gn_unwrap_its ever sees on the board. Keep in step with main.c.
#define RX_FRAME_MAX_LEN 800
// c5_radio.cpp's Raw::bytes: the promiscuous callback copies at most this many bytes of a frame,
// so it is the most gn_unwrap_its ever sees on the board. Keep in step with c5_radio.cpp. (The old
// C firmware's main.c cut frames at 800 bytes.)
#define RX_FRAME_MAX_LEN 2346
typedef struct {
FILE *out;
const char *path;
long records, capped, accepted, cam, denm, spatem, signed_frames, truncated, bad;
long records, capped, accepted, cam, denm, mapem, spatem, vam, signed_frames, truncated, bad;
} replay_t;
static void on_frame(const uint8_t *frame, int len, int index, void *ctx)
@@ -57,7 +58,9 @@ static void on_frame(const uint8_t *frame, int len, int index, void *ctx)
r->accepted++;
r->cam += rx.btp_dest_port == 2001;
r->denm += rx.btp_dest_port == 2002;
r->mapem += rx.btp_dest_port == 2003;
r->spatem += rx.btp_dest_port == 2004;
r->vam += rx.btp_dest_port == 2018;
r->signed_frames += rx.signed_unverified;
r->truncated += rx.truncated;
}
@@ -91,9 +94,9 @@ int main(int argc, char **argv)
}
fclose(r.out);
printf("test_replay: %ld records (%ld cut to %d bytes as main.c does), %ld accepted (CAM %ld, "
"DENM %ld, SPATEM %ld; %ld signed, %ld truncated), %ld bad\n",
r.records, r.capped, RX_FRAME_MAX_LEN, r.accepted, r.cam, r.denm, r.spatem,
printf("test_replay: %ld records (%ld cut to %d bytes as c5_radio.cpp does), %ld accepted (CAM %ld, "
"DENM %ld, MAPEM %ld, SPATEM %ld, VAM %ld; %ld signed, %ld truncated), %ld bad\n",
r.records, r.capped, RX_FRAME_MAX_LEN, r.accepted, r.cam, r.denm, r.mapem, r.spatem, r.vam,
r.signed_frames, r.truncated, r.bad);
return (r.bad || unreadable) ? 1 : 0;
}