Skip to content

Commit

Permalink
mqtt: fix ci issue with prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Mar 14, 2020
1 parent d590ef7 commit 7297f20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions code/espurna/mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Updated secure client support by Niek van der Maas < mail at niekvandermaas dot
using mqtt_callback_f = std::function<void(unsigned int type, const char * topic, char * payload)>;
using mqtt_msg_t = std::pair<String, String>; // topic, payload

// TODO: need this prototype for .ino
class AsyncMqttClientMessageProperties;

#if MQTT_SUPPORT

#if MQTT_LIBRARY == MQTT_LIBRARY_ASYNCMQTTCLIENT
Expand Down
6 changes: 4 additions & 2 deletions code/espurna/mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ bool _mqttMaybeSkipRetained(char* topic) {

#if MQTT_LIBRARY == MQTT_LIBRARY_ASYNCMQTTCLIENT

// MQTT Client can sometimes send messages in bulk. Even when message size is less than MQTT_MAX_PACKET_SIZE, we *could*
// MQTT broker can sometimes send messages in bulk. Even when message size is less than MQTT_MAX_PACKET_SIZE, we *could*
// receive a message with `len != total`, this requiring buffering of the received data. Prepare a static memory to store the
// data until `(len + index) == total`.
// TODO: One pending issue is streaming arbitrary data (e.g. binary, for OTA). We always set '\0' and expect text data.
Expand Down Expand Up @@ -636,7 +636,9 @@ void _mqttOnMessageAsync(char* topic, char* payload, AsyncMqttClientMessagePrope
#else

// Sync client already implements buffering. We *do need* to set '\0' to display stuff, though, so creating another buffer :)
// TODO: Consider just not displaying stuff, most of the time it is hidden to the user of the device.
// TODO: Consider just not logging or logging optionally, most of the time it is hidden to the user of the device.
// Callback receivers would need to expect the raw data and don't rely on things like strlen() / strcpy() / ... etc.
// TODO: callback() would need to pass `len`

void _mqttOnMessage(char* topic, char* payload, unsigned int len) {

Expand Down

0 comments on commit 7297f20

Please sign in to comment.