Files
Manuel 405ca49532 feat: ethernet client support for MUI (#129)
* preliminary impl

* update initialization

* adapt to limited Portduino Ethernet(WiFi)Client

* fixed space left calculation

* inherit from SerialClient

* updates Eth/SerialClient

* update cmake files

* protected declaration (for unit tests)

* fix warning

* tryfix: call lv_tick_inc() directly instead of lv_tick_set_cb()

* added isStandalone() to determine use case

* add reboot/shutdown for standalone; suppress animations during startup

* add debug log

* add error log

* revert lv_tick_inc / lv_tick_set_cb

* fix debug log

* workaround sporadic map error

* connection status handling

* define pure virtual functions

* adapt dimensions to allow map resize

* replace [] by .at() when erasing

* fix all communication issues; add thread names for logging

* fix warnings

* trunk fmt

* cleanup

* fix lv_tick interface for esp32 (revert to previous one as Indicator is frozen)

* added client connection states to boot screen

* fix reboot for standalone case

* fix warning

* fix UART connection timeout
2025-05-22 18:07:39 +02:00

36 lines
1.1 KiB
C++

#pragma once
#include "mesh-pb-constants.h"
#include <stddef.h>
#include <vector>
const size_t PB_BUFSIZE = 512;
const int MT_HEADER_SIZE = 4;
/**
* @brief This class encodes/decodes protobuf streams with magic headers
*
*/
class MeshEnvelope
{
public:
// ctor (1) creates empty vector to add bytes later for encoding
MeshEnvelope(void);
// ctor (2) creates envelope with validated bytestream for decoding
MeshEnvelope(const uint8_t *pb_buf, size_t length);
// encode envelope created in (1) with data in toRadio
std::vector<uint8_t> &encode(const meshtastic_ToRadio &toRadio);
// decode buffer given in (2)
meshtastic_FromRadio decode(void);
// check for valid packet in byte stream, strip all bytes in front of packet
static bool validate(uint8_t *pb_buf, size_t &pb_size, size_t &payload_len);
// invalidate first packet that has been handled already, prepare for next
static void invalidate(uint8_t *pb_buf, size_t &pb_size, size_t &payload_len);
~MeshEnvelope() {}
protected:
std::vector<uint8_t> envelope;
};