Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] paho.mqtt.embedded-c code


I am trying to run down a couple of issues with the paho.mqtt.embedded-c  MQTTClient.h. (Issues #201 and #202, if anybody's interested). As a precursor, I have had an initial look at the code and I have a question on which I would welcome guidance:

In MQTTClient.h, I am struggling to understand the use case for the MQTT_QOS0,1,2 preprocessor #defines. For example, lines 32-37 (of the current repo version):

#if !defined(MQTTCLIENT_QOS1)
    #define MQTTCLIENT_QOS1 1
#if !defined(MQTTCLIENT_QOS2)
    #define MQTTCLIENT_QOS2 0

The second conditional seems to downgrade QoS2 to QoS0 unless MQTT_QOS2 is defined. But unless the Paho code is copied into a project's source tree to build in situ, and the relevant #defines are placed before #include <MQTTClient.h>, I cannot see how these #defines are set. Surely the normal use case is to build this code as a library - this is what PlatformIO does?  Am I overlooking something obvious about these #defines?

Can anybody offer any guidance on what these #defines are intended to do? They seem to be used a lot throughout the code to modify the functionality.


Back to the top