Public Access
LoRa Scanner: MeshCore searches for nodes and their answers, read
The first two MeshCore packets heard were these: a search for repeaters and a repeater answering. Both are in clear; they are the test's bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
This commit is contained in:
@@ -27,7 +27,10 @@ std::string meshcoreRow(const meshcore::Packet& m, size_t room) {
|
||||
std::string out = meshcore::payloadShort(m.type);
|
||||
std::string hops = m.hops ? " " + std::to_string(m.hops) + "h" : "";
|
||||
meshcore::Advert a;
|
||||
if (meshcore::parseAdvert(m, a)) {
|
||||
meshcore::Discover d;
|
||||
if (meshcore::parseDiscover(m, d)) {
|
||||
out = d.response ? "here " + hex(d.id, 2) : "who's there?";
|
||||
} else if (meshcore::parseAdvert(m, a)) {
|
||||
size_t used = out.size() + 1 + hops.size();
|
||||
out += " " + (a.name.empty() ? hex(a.key, 2) : a.name.substr(0, room > used ? room - used : 0));
|
||||
} else if (m.addressed() && m.payloadLen >= 2)
|
||||
@@ -65,7 +68,19 @@ std::vector<std::string> meshcoreLines(const uint8_t* data, size_t len) {
|
||||
lines.push_back(m.flood() ? "Heard first hand: no repeater yet" : "No route in it: to a neighbour");
|
||||
}
|
||||
meshcore::Advert a;
|
||||
if (meshcore::parseAdvert(m, a)) {
|
||||
meshcore::Discover d;
|
||||
if (meshcore::parseDiscover(m, d) && d.response) {
|
||||
lines.push_back(std::string(meshcore::kindName(d.kind)) + " answering a search");
|
||||
lines.push_back("Key " + hex(d.id, 8) + "...");
|
||||
std::snprintf(s, sizeof s, "It heard the search at %.1f dB SNR", d.snr);
|
||||
lines.push_back(s);
|
||||
} else if (meshcore::parseDiscover(m, d)) {
|
||||
std::string who;
|
||||
for (int kind = 1; kind <= 4; ++kind)
|
||||
if (d.kinds & (1 << kind)) who += std::string(who.empty() ? "" : ", ") + meshcore::kindName(static_cast<uint8_t>(kind));
|
||||
lines.push_back("A search for nodes nearby");
|
||||
lines.push_back("Wanted: " + (who.empty() ? std::string("any") : who));
|
||||
} else if (meshcore::parseAdvert(m, a)) {
|
||||
lines.push_back(std::string(meshcore::kindName(a.kind)) + (a.name.empty() ? "" : " " + a.name));
|
||||
lines.push_back("Key " + hex(a.key, 8) + "...");
|
||||
if (a.hasLocation) {
|
||||
|
||||
Reference in New Issue
Block a user