mqtt: send packets after they are encrypted

This commit is contained in:
Kevin Hester
2021-04-04 09:20:37 +08:00
parent 638cec7f25
commit d19af8b83d
7 changed files with 59 additions and 57 deletions

View File

@@ -3,6 +3,7 @@
#include "configuration.h"
#include "concurrency/OSThread.h"
#include "mesh/Channels.h"
#include <PubSubClient.h>
#include <WiFiClient.h>
@@ -23,8 +24,13 @@ class MQTT : private concurrency::OSThread
/**
* Publish a packet on the glboal MQTT server.
* This hook must be called **after** the packet is encrypted (including the channel being changed to a hash).
* @param chIndex the index of the channel for this message
*
* Note: for messages we are forwarding on the mesh that we can't find the channel for (because we don't have the keys), we
* can not forward those messages to the cloud - becuase no way to find a global channel ID.
*/
void publish(const MeshPacket &mp);
void onSend(const MeshPacket &mp, ChannelIndex chIndex);
protected:
virtual int32_t runOnce();