Functions | |
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... | |
bool | ltrx_mqtt_client_is_connected (struct ltrx_mqtt_client *lmc) |
Test MQTT connection. 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.
int ltrx_mqtt_client_connect | ( | struct ltrx_mqtt_client * | lmc | ) |
Establish client connection to MQTT broker.
enum | ltrx_mqtt_client_return_code |
[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.
non-NULL | Pointer to the new MQTT client instance. |
NULL | Failed. |
[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.
enum | ltrx_mqtt_client_return_code |
[in] | lmc | Pointer to a MQTT client instance |
int ltrx_mqtt_client_disconnect | ( | struct ltrx_mqtt_client * | lmc | ) |
Disconnect client connection from MQTT broker.
enum | ltrx_mqtt_client_return_code |
[in] | lmc | Pointer to a MQTT client instance |
bool ltrx_mqtt_client_is_connected | ( | struct ltrx_mqtt_client * | lmc | ) |
Test MQTT connection.
true | if connected |
[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.
enum | ltrx_mqtt_client_return_code |
[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.
enum | ltrx_mqtt_client_return_code |
[in] | lmc | Pointer to a MQTT client instance |
[in] | cleansession | cleansession flag. |
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.
enum | ltrx_mqtt_client_return_code |
[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.
enum | ltrx_mqtt_client_return_code |
[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.
enum | ltrx_mqtt_client_return_code |
[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.
enum | ltrx_mqtt_client_return_code |
[in] | lmc | Pointer to a MQTT client instance |
[in] | topic | The will message topic |
[in] | msg | The will message info |
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.
enum | ltrx_mqtt_client_return_code |
[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.
enum | ltrx_mqtt_client_return_code |
[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.
enum | ltrx_mqtt_client_return_code |
[in] | lmc | Pointer to a MQTT client instance |
[in] | topic_filter | The message topic filter |