LoRaMesher Library  0.0.5
A LoRa Mesh library for the IoT
All Classes Functions Variables Pages
PacketHeader.h
1#ifndef _LORAMESHER_PACKET_HEADER_H
2#define _LORAMESHER_PACKET_HEADER_H
3
4#include <Arduino.h>
5
6#include "ArduinoLog.h"
7
8#pragma pack(1)
9class PacketHeader {
10public:
11 uint16_t dst;
12 uint16_t src;
13 uint8_t type;
14 //TODO: REMOVE THIS ID
15 uint8_t id;
16 uint8_t payloadSize = 0;
17
23 size_t getPayloadLength() { return this->payloadSize; }
24
30 size_t getPacketLength() { return sizeof(PacketHeader) + getPayloadLength(); }
31
37 void operator delete(void* p) {
38 Log.traceln(F("Deleting Header packet"));
39 free(p);
40 }
41
42};
43#pragma pack()
44
45#endif