2025-01-01 16:40:14 -08:00
|
|
|
#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),
|
2026-01-03 21:19:24 +01:00
|
|
|
validDecode(pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, this)) {}
|
2025-01-01 16:40:14 -08:00
|
|
|
|
|
|
|
|
DecodedServiceEnvelope::DecodedServiceEnvelope(DecodedServiceEnvelope &&other)
|
2026-01-03 21:19:24 +01:00
|
|
|
: 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);
|
2025-01-01 16:40:14 -08:00
|
|
|
}
|
|
|
|
|
|
2026-01-03 21:19:24 +01:00
|
|
|
DecodedServiceEnvelope::~DecodedServiceEnvelope() {
|
|
|
|
|
if (validDecode)
|
|
|
|
|
pb_release(&meshtastic_ServiceEnvelope_msg, this);
|
2025-01-01 16:40:14 -08:00
|
|
|
}
|