diff --git a/include/packet.h b/include/packet.h index d045efe..f748a30 100644 --- a/include/packet.h +++ b/include/packet.h @@ -1,6 +1,22 @@ #pragma once #include +/* +This is the struct that gets packed and then sent over LoRa. + +It's packed and uses stdint types because different hardware or compilers may attempt to +optimize it or change the size of different things, completely stuffing up and corrupting +our data. Endianess also matters. + +Version 1: + Message Types: + - message: send a message via plain text to someone + - hello: announce yourself to other nodes, payload should include: + bytes 1-4: node id + byte 5: battery level or 255 for unkown + byte 6: name length + continuing bytes: name +*/ typedef struct { uint8_t version; // version number to prevent breaking older packet formats uint8_t ttl; // the number of hops left in the lifespan of the packet, prevents infinite hopping