added docs to packet struct
This commit is contained in:
@@ -1,6 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
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 {
|
typedef struct {
|
||||||
uint8_t version; // version number to prevent breaking older packet formats
|
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
|
uint8_t ttl; // the number of hops left in the lifespan of the packet, prevents infinite hopping
|
||||||
|
|||||||
Reference in New Issue
Block a user