fix beacon: add onAdvertRecv to display received beacons

This commit is contained in:
UA1ZBE
2026-07-22 13:44:50 +03:00
parent d487b84926
commit 8b21bccac2

View File

@@ -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);