27#include "ove_config.h"
36#define OVE_MQTT_QOS0 ((ove_mqtt_qos_t)0)
37#define OVE_MQTT_QOS1 ((ove_mqtt_qos_t)1)
54typedef void (*
ove_mqtt_msg_cb)(
const char *topic,
size_t topic_len,
const void *payload,
55 size_t payload_len,
void *user_data);
82#ifdef CONFIG_OVE_NET_MQTT
159#ifdef OVE_HEAP_NET_MQTT
179#ifndef CONFIG_OVE_NET_MQTT
182} ove_mqtt_client_storage_t;
186 ove_mqtt_client_storage_t *storage)
void ove_mqtt_client_deinit(ove_mqtt_client_t client)
De-initialise an MQTT client.
#define OVE_MQTT_QOS1
Definition net_mqtt.h:37
int ove_mqtt_connect(ove_mqtt_client_t client, const ove_mqtt_config_t *cfg)
Connect to an MQTT broker.
int ove_mqtt_publish(ove_mqtt_client_t client, const char *topic, const void *payload, size_t payload_len, ove_mqtt_qos_t qos)
Publish a message.
void ove_mqtt_disconnect(ove_mqtt_client_t client)
Disconnect from the MQTT broker.
void(* ove_mqtt_msg_cb)(const char *topic, size_t topic_len, const void *payload, size_t payload_len, void *user_data)
MQTT message callback.
Definition net_mqtt.h:54
void ove_mqtt_client_destroy(ove_mqtt_client_t client)
Destroy a heap-allocated MQTT client.
int ove_mqtt_client_init(ove_mqtt_client_t *client, ove_mqtt_client_storage_t *storage)
Initialise an MQTT client from caller-supplied storage.
#define OVE_MQTT_QOS0
Definition net_mqtt.h:36
uint8_t ove_mqtt_qos_t
MQTT QoS level.
Definition net_mqtt.h:35
int ove_mqtt_loop(ove_mqtt_client_t client, uint64_t timeout_ns)
Process incoming packets and send keep-alive pings.
int ove_mqtt_client_create(ove_mqtt_client_t *client)
Heap-allocate and initialise an MQTT client.
int ove_mqtt_unsubscribe(ove_mqtt_client_t client, const char *topic)
Unsubscribe from a topic.
int ove_mqtt_subscribe(ove_mqtt_client_t client, const char *topic, ove_mqtt_qos_t qos)
Subscribe to a topic.
struct ove_mqtt_client * ove_mqtt_client_t
Opaque handle for an MQTT client.
Definition types.h:259
@ OVE_ERR_NOT_SUPPORTED
Definition types.h:98
MQTT connection configuration.
Definition net_mqtt.h:64
size_t tls_ca_cert_len
Definition net_mqtt.h:74
int use_tls
Definition net_mqtt.h:71
const char * username
Definition net_mqtt.h:68
const char * password
Definition net_mqtt.h:69
const unsigned char * tls_ca_cert
Definition net_mqtt.h:73
int tls_allow_insecure
Definition net_mqtt.h:75
uint16_t keep_alive_s
Definition net_mqtt.h:70
void * user_data
Definition net_mqtt.h:77
const char * host
Definition net_mqtt.h:65
uint16_t port
Definition net_mqtt.h:66
ove_mqtt_msg_cb on_message
Definition net_mqtt.h:76
const char * client_id
Definition net_mqtt.h:67