#include "meshtastic_header.h" #include namespace roro::meshtastic { static uint32_t le32(const uint8_t* p) { return p[0] | p[1] << 8 | p[2] << 16 | static_cast(p[3]) << 24; } bool parseHeader(const uint8_t* data, size_t len, PacketHeader& out) { if (!data || len < kHeaderSize) return false; out.to = le32(data); out.from = le32(data + 4); out.id = le32(data + 8); out.flags = data[12]; out.channelHash = data[13]; out.nextHop = data[14]; out.relayNode = data[15]; return true; } std::string nodeId(uint32_t node) { if (node == kBroadcast) return "all"; char s[10]; std::snprintf(s, sizeof s, "!%08x", static_cast(node)); return s; } } // namespace roro::meshtastic