|
int | ltrx_mqtt_client_connect (struct ltrx_mqtt_client *lmc) |
| Establish client connection to MQTT broker. More...
|
|
struct ltrx_mqtt_client * | ltrx_mqtt_client_create (uint32_t command_timeout_ms, size_t sendbuf_size, size_t recvbuf_size) |
| Create a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_destroy (struct ltrx_mqtt_client *lmc) |
| Destroy a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_disconnect (struct ltrx_mqtt_client *lmc) |
| Disconnect client connection from MQTT broker. More...
|
|
int | ltrx_mqtt_client_publish (struct ltrx_mqtt_client *lmc, const char *topic, struct ltrx_mqtt_message *msg) |
| Publish a message to the MQTT broker. More...
|
|
int | ltrx_mqtt_client_set_cleansession (struct ltrx_mqtt_client *lmc, bool cleansession) |
| Set cleansession flag for a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_set_connect_info (struct ltrx_mqtt_client *lmc, const struct ltrx_mqtt_client_connect_info *lmcci) |
| Set connection info for a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_set_keepalive_interval (struct ltrx_mqtt_client *lmc, uint16_t keepalive_interval_sec) |
| Set keepalive interval for a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_set_log_verbosity (struct ltrx_mqtt_client *lmc, uint8_t verbosity) |
| Set logging level for a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_set_lwt (struct ltrx_mqtt_client *lmc, const char *topic, struct ltrx_mqtt_message *msg) |
| Set Last Will and Testament for a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_set_network_info (struct ltrx_mqtt_client *lmc, struct ltrx_mqtt_client_network_info *lmcni) |
| Set network info for a MQTT client instance. More...
|
|
int | ltrx_mqtt_client_subscribe (struct ltrx_mqtt_client *lmc, const char *topic_filter, int max_qos, void(*callback)(struct ltrx_mqtt_message_data *)) |
| Subscribe to message topic(s) from a MQTT broker. More...
|
|
int | ltrx_mqtt_client_unsubscribe (struct ltrx_mqtt_client *lmc, const char *topic_filter) |
| Unsubscribe from message topic(s) from a MQTT broker. More...
|
|
MQTT Client is compliant with MQTT 3.1.1.
SSL Client is compliant with SSLv3, TLS 1.0, TLS 1.1, and TLS 1.2. Due to severe memory limitations, only a single connection instance is provided.
To use this API, follow these steps:
(1) Include the header file:
#include "mqtt_module_libs.h"
(2) Declare the global pointer:
const struct mqtt_external_functions *
g_mqttExternalFunctionEntry_pointer = 0;
(3) Initialize the pointer in your _module_startup
routine:
void <your_module>_module_startup(void)
{
g_mqttExternalFunctionEntry_pointer =
ltrx_module_functions_lookup("mqtt");
// Your module startup goes here.
}
int ltrx_mqtt_client_connect |
( |
struct ltrx_mqtt_client * |
lmc | ) |
|
Establish client connection to MQTT broker.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
struct ltrx_mqtt_client* ltrx_mqtt_client_create |
( |
uint32_t |
command_timeout_ms, |
|
|
size_t |
sendbuf_size, |
|
|
size_t |
recvbuf_size |
|
) |
| |
Create a MQTT client instance.
- Return values
-
non-NULL | Pointer to the new MQTT client instance. |
NULL | Failed. |
- Parameters
-
[in] | command_timeout_ms | Timeout in ms to wait for ACK of sent command. |
[in] | sendbuf_size | Size of send buffer in bytes. |
[in] | recvbuf_size | Size of receive buffer in bytes. |
int ltrx_mqtt_client_destroy |
( |
struct ltrx_mqtt_client * |
lmc | ) |
|
Destroy a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
int ltrx_mqtt_client_disconnect |
( |
struct ltrx_mqtt_client * |
lmc | ) |
|
Disconnect client connection from MQTT broker.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
int ltrx_mqtt_client_publish |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
const char * |
topic, |
|
|
struct ltrx_mqtt_message * |
msg |
|
) |
| |
Publish a message to the MQTT broker.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | topic | The message topic |
[in] | msg | The message info |
int ltrx_mqtt_client_set_cleansession |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
bool |
cleansession |
|
) |
| |
Set cleansession flag for a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | cleansession | cleansession flag. |
Set connection info for a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | lmcci | Connection info for MQTT session. |
int ltrx_mqtt_client_set_keepalive_interval |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
uint16_t |
keepalive_interval_sec |
|
) |
| |
Set keepalive interval for a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | keepalive_interval_sec | keepalive interval in seconds. |
int ltrx_mqtt_client_set_log_verbosity |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
uint8_t |
verbosity |
|
) |
| |
Set logging level for a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | verbosity | Requested verbosity. |
int ltrx_mqtt_client_set_lwt |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
const char * |
topic, |
|
|
struct ltrx_mqtt_message * |
msg |
|
) |
| |
Set Last Will and Testament for a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | topic | The will message topic |
[in] | msg | The will message info |
Set network info for a MQTT client instance.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | lmcni | Network connection info for MQTT session. |
int ltrx_mqtt_client_subscribe |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
const char * |
topic_filter, |
|
|
int |
max_qos, |
|
|
void(*)(struct ltrx_mqtt_message_data *) |
callback |
|
) |
| |
Subscribe to message topic(s) from a MQTT broker.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | topic_filter | The message topic filter |
[in] | max_qos | The max qos level at which the broker can send matching messages |
[in] | callback | The message handler to call when a matching message is received |
int ltrx_mqtt_client_unsubscribe |
( |
struct ltrx_mqtt_client * |
lmc, |
|
|
const char * |
topic_filter |
|
) |
| |
Unsubscribe from message topic(s) from a MQTT broker.
- Return values
-
enum | ltrx_mqtt_client_return_code |
- Parameters
-
[in] | lmc | Pointer to a MQTT client instance |
[in] | topic_filter | The message topic filter |