const DecodedServiceEnvelope e

This commit is contained in:
Eric Severance 2024-12-16 20:24:58 -08:00
parent 2fda5400c1
commit af5a6e82a1
No known key found for this signature in database
GPG Key ID: 340D1DA2A5A64A62

View File

@ -35,6 +35,11 @@ static MemoryDynamic<meshtastic_ServiceEnvelope> staticMqttPool;
Allocator<meshtastic_ServiceEnvelope> &mqttPool = staticMqttPool;
// FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets
static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for channel name and 16 for nodeid
static bool isMqttServerAddressPrivate = false;
// meshtastic_ServiceEnvelope that automatically releases dynamically allocated memory when it goes out of scope.
struct DecodedServiceEnvelope : public meshtastic_ServiceEnvelope {
DecodedServiceEnvelope() = delete;
@ -48,14 +53,9 @@ struct DecodedServiceEnvelope : public meshtastic_ServiceEnvelope {
const bool validDecode;
};
// FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets
static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for channel name and 16 for nodeid
static bool isMqttServerAddressPrivate = false;
inline void onReceiveProto(char *topic, byte *payload, size_t length)
{
DecodedServiceEnvelope e(payload, length);
const DecodedServiceEnvelope e(payload, length);
if (!e.validDecode) {
LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!", topic, length);
return;