Make the MQTT client example a little more configurable and verbose

Suitable for native run testing
This commit is contained in:
George Oikonomou 2018-10-21 17:13:17 +01:00
parent 543ab20333
commit 6d4cddeec1
2 changed files with 7 additions and 0 deletions

View File

@ -47,7 +47,11 @@
#include <strings.h>
/*---------------------------------------------------------------------------*/
#define LOG_MODULE "mqtt-client"
#ifdef MQTT_CLIENT_CONF_LOG_LEVEL
#define LOG_LEVEL MQTT_CLIENT_CONF_LOG_LEVEL
#else
#define LOG_LEVEL LOG_LEVEL_NONE
#endif
/*---------------------------------------------------------------------------*/
/* Controls whether the example will work in IBM Watson IoT platform mode */
#ifdef MQTT_CLIENT_CONF_WITH_IBM_WATSON
@ -305,6 +309,7 @@ pub_handler(const char *topic, uint16_t topic_len, const uint8_t *chunk,
}
if(strncmp(&topic[10], "leds", 4) == 0) {
LOG_DBG("Received MQTT SUB\n");
if(chunk[0] == '1') {
leds_on(LEDS_RED);
} else if(chunk[0] == '0') {

View File

@ -52,7 +52,9 @@
* devices, set your Org ID here and then make sure you set the correct token
* through MQTT_CLIENT_CONF_AUTH_TOKEN.
*/
#ifndef MQTT_CLIENT_CONF_ORG_ID
#define MQTT_CLIENT_CONF_ORG_ID "quickstart"
#endif
/*
* The MQTT username.