From 8b21bccac229ae826614e00f47fa4519b95ccbe0 Mon Sep 17 00:00:00 2001 From: UA1ZBE Date: Wed, 22 Jul 2026 13:44:50 +0300 Subject: [PATCH] fix beacon: add onAdvertRecv to display received beacons --- src/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 06bed5a..adb791f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -305,6 +305,20 @@ public: NVIC_SystemReset(); } } + + void onAdvertRecv(mesh::Packet* pkt, const mesh::Identity& id, uint32_t ts, const uint8_t* app_data, size_t app_data_len) override { + char buf[128]; + int n = 0; + n += snprintf(buf + n, sizeof(buf) - n, "beacon:"); + if (app_data_len > 0 && app_data[0]) { + int l = app_data_len; if (l > 20) l = 20; + memcpy(buf + n, app_data, l); n += l; + } else { + for (int i = 0; i < 4 && i < (int)PUB_KEY_SIZE; i++) { n += snprintf(buf + n, sizeof(buf) - n, "%02X", id.pub_key[i]); } + } + buf[n] = 0; + send_text(buf); + } }; SecurityMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables);