Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
mqtt-subscribe.c File Reference

MQTT Publish client. More...

#include <string.h>
#include <sol-log.h>
#include <sol-mainloop.h>
#include <sol-mqtt.h>

Functions

int main (int argc, char *argv[])
 
static void on_connect (void *data, struct sol_mqtt *mqtt)
 
static void on_disconnect (void *data, struct sol_mqtt *mqtt)
 
static void on_message (void *data, struct sol_mqtt *mqtt, const struct sol_mqtt_message *message)
 
static bool try_reconnect (void *data)
 

Variables

static char * topic
 

Detailed Description

MQTT Publish client.

Sample client that connects a broker at host:port and subscribes to the provided topic. Whenever a new message is published to that topic, it is printed in the console.

Function Documentation

int main ( int  argc,
char *  argv[] 
)
static void on_connect ( void *  data,
struct sol_mqtt mqtt 
)
static
static void on_disconnect ( void *  data,
struct sol_mqtt mqtt 
)
static

References SOL_INF, sol_timeout_add(), and try_reconnect().

Referenced by main().

static void on_message ( void *  data,
struct sol_mqtt mqtt,
const struct sol_mqtt_message message 
)
static
static bool try_reconnect ( void *  data)
static

References sol_mqtt_reconnect().

Referenced by on_connect(), and on_disconnect().

Variable Documentation

char* topic
static

Referenced by main(), and on_connect().