Unify Framework Lib 1.6.0
uic_mqtt.c File Reference
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "sys/etimer.h"
#include "sys/process.h"
#include "sl_log.h"
#include "config.h"
#include "uic_main_externals.h"
#include "uic_mqtt.h"
#include "uic_mqtt_int.h"
#include "mqtt_client.h"
#include "mqtt_client_id.h"

Macros

#define LOG_TAG   "uic_mqtt"
 

Functions

 PROCESS (uic_mqtt_process, "Unify MQTT Client")
 
int uic_mqtt_process_post (const int event, void *procdata)
 
void uic_mqtt_process_post_delayed (const int event, unsigned long milliseconds)
 
int uic_mqtt_process_count_events (const int event, void *procdata)
 
void uic_mqtt_process_on_connect (mqtt_client_t instance, const int file_descriptor)
 
void uic_mqtt_process_on_disconnect (mqtt_client_t instance, const int file_descriptor)
 
sl_status_t uic_mqtt_setup ()
 
int uic_mqtt_teardown ()
 
void uic_mqtt_subscribe (const char *topic, mqtt_message_callback_t callBack)
 Subscribe to a topic. More...
 
void uic_mqtt_subscribe_ex (const char *topic, mqtt_message_callback_ex_t callBack, void *user)
 Subscribe to a topic. More...
 
void uic_mqtt_publish (const char *topic, const char *message, const size_t message_length, bool retain)
 Add the message and topic to publisher queue system. More...
 
int uic_mqtt_count_topics (const char *prefix_pattern)
 Count the number of topics published. More...
 
void uic_mqtt_unretain (const char *prefix)
 Un-retain a previously retained message. More...
 
void uic_mqtt_unretain_by_regex (const char *regex)
 Un-retain a previously retained message. More...
 
void uic_mqtt_unsubscribe (const char *topic, mqtt_message_callback_t callback)
 Unsubscribe from a topic. More...
 
void uic_mqtt_unsubscribe_ex (const char *topic, mqtt_message_callback_ex_t callback, void *user)
 Unsubscribe from a topic. More...
 
void uic_mqtt_set_before_disconnect_callback (mqtt_connection_callbacks_t before_disconnect)
 Set a callback which will be executed before calling a disconnect. More...
 
void uic_mqtt_set_after_connect_callback (mqtt_connection_callbacks_t after_connect)
 Set a callback which will be executed after having connected. More...
 
const char * uic_mqtt_get_client_id ()
 Gets the MQTT Client ID in used by the MQTT Client. More...
 
bool uic_mqtt_is_connected_to_broker ()
 Checks if we are currently connected to an MQTT Broker. More...
 
 PROCESS_THREAD (uic_mqtt_process, ev, data)
 

Variables

mqtt_client_t client_instance = NULL
 
static struct etimer uic_mqtt_loop_timer
 
static struct etimer uic_mqtt_post_delay_timer
 
static bool uic_mqtt_post_delay_timer_flag = false
 
static int delayed_event = 0
 

Macro Definition Documentation

◆ LOG_TAG

#define LOG_TAG   "uic_mqtt"

Function Documentation

◆ PROCESS()

PROCESS ( uic_mqtt_process  ,
"Unify MQTT Client"   
)

◆ PROCESS_THREAD()

PROCESS_THREAD ( uic_mqtt_process  ,
ev  ,
data   
)

◆ uic_mqtt_process_count_events()

int uic_mqtt_process_count_events ( const int  event,
void *  procdata 
)

◆ uic_mqtt_process_on_connect()

void uic_mqtt_process_on_connect ( mqtt_client_t  instance,
const int  file_descriptor 
)

◆ uic_mqtt_process_on_disconnect()

void uic_mqtt_process_on_disconnect ( mqtt_client_t  instance,
const int  file_descriptor 
)

◆ uic_mqtt_process_post()

int uic_mqtt_process_post ( const int  event,
void *  procdata 
)

◆ uic_mqtt_process_post_delayed()

void uic_mqtt_process_post_delayed ( const int  event,
unsigned long  milliseconds 
)

Variable Documentation

◆ client_instance

mqtt_client_t client_instance = NULL

◆ delayed_event

int delayed_event = 0
static

◆ uic_mqtt_loop_timer

struct etimer uic_mqtt_loop_timer
static

◆ uic_mqtt_post_delay_timer

struct etimer uic_mqtt_post_delay_timer
static

◆ uic_mqtt_post_delay_timer_flag

bool uic_mqtt_post_delay_timer_flag = false
static