SELKIELogger  1.0.0
LoggerMQTT.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "SELKIELoggerBase.h"
#include "SELKIELoggerMQTT.h"
Include dependency graph for LoggerMQTT.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mqtt_params
 MQTT source specific parameters. More...
 

Functions

void * mqtt_setup (void *ptargs)
 Device thread setup. More...
 
void * mqtt_logging (void *ptargs)
 Network source main logging loop. More...
 
void * mqtt_shutdown (void *ptargs)
 Network source shutdown. More...
 
void * mqtt_channels (void *ptargs)
 Channel map. More...
 
device_callbacks mqtt_getCallbacks (void)
 Fill out device callback functions for logging. More...
 
mqtt_params mqtt_getParams (void)
 Fill out default MP source parameters. More...
 
bool mqtt_parseConfig (log_thread_args_t *lta, config_section *s)
 Take a configuration section and parse parameters. More...
 

Function Documentation

◆ mqtt_channels()

void* mqtt_channels ( void *  ptargs)

Channel map.

Create channel map from configured IDs and push to queue.

Terminates thread on error.

Parameters
[in]ptargsPointer to log_thread_args_t
Returns
NULL - Error code stored in ptarges->returnCode

Definition at line 156 of file LoggerMQTT.c.

◆ mqtt_getCallbacks()

device_callbacks mqtt_getCallbacks ( void  )

Fill out device callback functions for logging.

Returns
device_callbacks for MQTT network sources

Definition at line 200 of file LoggerMQTT.c.

◆ mqtt_getParams()

mqtt_params mqtt_getParams ( void  )

Fill out default MP source parameters.

Returns
Default parameters for MQTT network sources

Definition at line 211 of file LoggerMQTT.c.

◆ mqtt_logging()

void* mqtt_logging ( void *  ptargs)

Network source main logging loop.

MQTT Logging thread

Handles sending keepalive commands (if enabled) and popping items from within the MQTT specific queue and moving them into the main message queue.

Unlike the _logging function for other sources, this doesn't read anything directly. Message processing is handled in a thread managed by the mosquitto library and we pass in a callback function to format and enqueue the messages.

Terminates thread on error

Parameters
[in]ptargsPointer to log_thread_args_t
Returns
NULL - Error code stored in ptarges->returnCode

Definition at line 72 of file LoggerMQTT.c.

◆ mqtt_parseConfig()

bool mqtt_parseConfig ( log_thread_args_t lta,
config_section s 
)

Take a configuration section and parse parameters.

Parameters
[in]ltaPointer to log_thread_args_t
[in]sPointer to config_section to be parsed
Returns
True on success, false on error

Definition at line 231 of file LoggerMQTT.c.

◆ mqtt_setup()

void* mqtt_setup ( void *  ptargs)

Device thread setup.

Sets up MQTT server connection

Parameters
[in]ptargsPointer to log_thread_args_t
Returns
NULL - Error code stored in ptarges->returnCode

Definition at line 33 of file LoggerMQTT.c.

◆ mqtt_shutdown()

void* mqtt_shutdown ( void *  ptargs)

Network source shutdown.

Cleanly shutdown MQTT connection and release resources.

Parameters
[in]ptargsPointer to log_thread_args_t
Returns
NULL

Definition at line 128 of file LoggerMQTT.c.