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
+4 -1
View File
@@ -47,7 +47,9 @@
// NOTE the crossover: SPATEM is BTP port 2004 but ItsPduHeader messageID 4, while MAPEM is port
// 2003 and messageID 5. Port and messageID are NOT the same number - mixing them up routes every
// message to the wrong decoder on the phone.
#define BTP_DEST_PORT_MAPEM (2003)
#define BTP_DEST_PORT_SPATEM (2004)
#define BTP_DEST_PORT_VAM (2018)
static const uint8_t s_llc_snap_prefix[6] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
@@ -249,7 +251,8 @@ bool gn_unwrap_its(const uint8_t *frame, int frame_len, gn_rx_t *out)
}
uint16_t dest_port = be16(frame + offset);
if (dest_port != BTP_DEST_PORT_CAM && dest_port != BTP_DEST_PORT_DENM &&
dest_port != BTP_DEST_PORT_SPATEM) {
dest_port != BTP_DEST_PORT_MAPEM && dest_port != BTP_DEST_PORT_SPATEM &&
dest_port != BTP_DEST_PORT_VAM) {
return false;
}