Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Typedefs | Enumerations
mqtt.h File Reference

MQTT client. More...

#include "lwip/apps/mqtt_opts.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/prot/iana.h"

Go to the source code of this file.

Data Structures

struct  mqtt_connect_client_info_t
 Client information and connection parameters. More...
 

Macros

#define MQTT_PORT   LWIP_IANA_PORT_MQTT
 Default MQTT port (non-TLS) More...
 
#define MQTT_TLS_PORT   LWIP_IANA_PORT_SECURE_MQTT
 Default MQTT TLS port. More...
 
#define mqtt_subscribe(client, topic, qos, cb, arg)   mqtt_sub_unsub(client, topic, qos, cb, arg, 1)
 Subscribe to topic. More...
 
#define mqtt_unsubscribe(client, topic, cb, arg)   mqtt_sub_unsub(client, topic, 0, cb, arg, 0)
 Unsubscribe to topic. More...
 

Typedefs

typedef void(* mqtt_connection_cb_t) (mqtt_client_t *client, void *arg, mqtt_connection_status_t status)
 Function prototype for mqtt connection status callback. More...
 
typedef void(* mqtt_incoming_data_cb_t) (void *arg, const u8_t *data, u16_t len, u8_t flags)
 Function prototype for MQTT incoming publish data callback function. More...
 
typedef void(* mqtt_incoming_publish_cb_t) (void *arg, const char *topic, u32_t tot_len)
 Function prototype for MQTT incoming publish function. More...
 
typedef void(* mqtt_request_cb_t) (void *arg, err_t err)
 Function prototype for mqtt request callback. More...
 

Enumerations

Detailed Description

MQTT client.

Definition in file mqtt.h.

Macro Definition Documentation

#define MQTT_PORT   LWIP_IANA_PORT_MQTT

Default MQTT port (non-TLS)

Definition at line 57 of file mqtt.h.

#define mqtt_subscribe (   client,
  topic,
  qos,
  cb,
  arg 
)    mqtt_sub_unsub(client, topic, qos, cb, arg, 1)

Subscribe to topic.

Definition at line 193 of file mqtt.h.

#define MQTT_TLS_PORT   LWIP_IANA_PORT_SECURE_MQTT

Default MQTT TLS port.

Definition at line 60 of file mqtt.h.

#define mqtt_unsubscribe (   client,
  topic,
  cb,
  arg 
)    mqtt_sub_unsub(client, topic, 0, cb, arg, 0)

Unsubscribe to topic.

Definition at line 196 of file mqtt.h.

Typedef Documentation

typedef void(* mqtt_connection_cb_t) (mqtt_client_t *client, void *arg, mqtt_connection_status_t status)

Function prototype for mqtt connection status callback.

Called when client has connected to the server after initiating a mqtt connection attempt by calling mqtt_client_connect() or when connection is closed by server or an error

Parameters
clientMQTT client itself
argAdditional argument to pass to the callback function
statusConnect result code or disconnection notification
See also
mqtt_connection_status_t

Definition at line 126 of file mqtt.h.

typedef void(* mqtt_incoming_data_cb_t) (void *arg, const u8_t *data, u16_t len, u8_t flags)

Function prototype for MQTT incoming publish data callback function.

Called when data arrives to a subscribed topic

See also
mqtt_subscribe
Parameters
argAdditional argument to pass to the callback function
dataUser data, pointed object, data may not be referenced after callback return, NULL is passed when all publish data are delivered
lenLength of publish data fragment
flagsMQTT_DATA_FLAG_LAST set when this call contains the last part of data from publish message

Definition at line 149 of file mqtt.h.

typedef void(* mqtt_incoming_publish_cb_t) (void *arg, const char *topic, u32_t tot_len)

Function prototype for MQTT incoming publish function.

Called when an incoming publish arrives to a subscribed topic

See also
mqtt_subscribe
Parameters
argAdditional argument to pass to the callback function
topicZero terminated Topic text string, topic may not be referenced after callback return
tot_lenTotal length of publish data, if set to 0 (no publish payload) data callback will not be invoked

Definition at line 161 of file mqtt.h.

typedef void(* mqtt_request_cb_t) (void *arg, err_t err)

Function prototype for mqtt request callback.

Called when a subscribe, unsubscribe or publish request has completed

Parameters
argPointer to user data supplied when invoking request
errERR_OK on success ERR_TIMEOUT if no response was received within timeout, ERR_ABRT if (un)subscribe was denied

Definition at line 173 of file mqtt.h.

Enumeration Type Documentation

anonymous enum

Data callback flags.

Enumerator
MQTT_DATA_FLAG_LAST 

Flag set when last fragment of data arrives in data callback.

Definition at line 132 of file mqtt.h.

Connection status codes.

Enumerator
MQTT_CONNECT_ACCEPTED 

Accepted.

MQTT_CONNECT_REFUSED_PROTOCOL_VERSION 

Refused protocol version.

MQTT_CONNECT_REFUSED_IDENTIFIER 

Refused identifier.

MQTT_CONNECT_REFUSED_SERVER 

Refused server.

MQTT_CONNECT_REFUSED_USERNAME_PASS 

Refused user credentials.

MQTT_CONNECT_REFUSED_NOT_AUTHORIZED_ 

Refused not authorized.

MQTT_CONNECT_DISCONNECTED 

Disconnected.

MQTT_CONNECT_TIMEOUT 

Timeout.

Definition at line 95 of file mqtt.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.