Files
firmware/src/mqtt/ServiceEnvelope.cpp
T
Jorropo beb268ff25 Revert "add a .clang-format file (#9154)" (#9172)
I thought git would be smart enough to understand all the whitespace changes but even with all the flags I know to make it ignore theses it still blows up if there are identical changes on both sides.

I have a solution but it require creating a new commit at the merge base for each conflicting PR and merging it into develop.

I don't think blowing up all PRs is worth for now, maybe if we can coordinate this for V3 let's say.

This reverts commit 0d11331d18.
2026-01-04 05:15:53 -06:00

23 lines
793 B
C++

#include "ServiceEnvelope.h"
#include "mesh-pb-constants.h"
#include <pb_decode.h>
DecodedServiceEnvelope::DecodedServiceEnvelope(const uint8_t *payload, size_t length)
: meshtastic_ServiceEnvelope(meshtastic_ServiceEnvelope_init_default),
validDecode(pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, this))
{
}
DecodedServiceEnvelope::DecodedServiceEnvelope(DecodedServiceEnvelope &&other)
: meshtastic_ServiceEnvelope(meshtastic_ServiceEnvelope_init_zero), validDecode(other.validDecode)
{
std::swap(packet, other.packet);
std::swap(channel_id, other.channel_id);
std::swap(gateway_id, other.gateway_id);
}
DecodedServiceEnvelope::~DecodedServiceEnvelope()
{
if (validDecode)
pb_release(&meshtastic_ServiceEnvelope_msg, this);
}