Structures and Enumerations

group mqtt_struct

mqtt library data structures and type definitions

Typedefs

typedef cy_mqtt_publish_info_t cy_mqtt_received_msg_info_t

MQTT received message information structure.

note

This type is defined for improving readability and for library backward compatibility.

typedef cy_mqtt_subscribe_info_t cy_mqtt_unsubscribe_info_t

MQTT unsubscribe information structure.

Enums

enum cy_mqtt_qos_t

cy_mqtt_qos_t: MQTT QoS levels.

Values:

enumerator CY_MQTT_QOS0

Delivery at most once.

enumerator CY_MQTT_QOS1

Delivery at least once.

enumerator CY_MQTT_QOS2

Delivery exactly once.

enumerator CY_MQTT_QOS_INVALID

Invalid QoS.

enum cy_mqtt_event_type_t

cy_mqtt_event_type_t: MQTT event types.

Values:

enumerator CY_MQTT_EVENT_TYPE_SUBSCRIPTION_MESSAGE_RECEIVE

Message from the subscribed topic.

enumerator CY_MQTT_EVENT_TYPE_DISCONNECT

Disconnected from MQTT broker.

enum cy_mqtt_disconn_type_t

cy_mqtt_disconn_type_t: MQTT disconnect type.

Values:

enumerator CY_MQTT_DISCONN_TYPE_BROKER_DOWN

Keep-alive not received from broker, possibly broker is down.

enumerator CY_MQTT_DISCONN_TYPE_NETWORK_DOWN

Network is disconnected.

struct cy_mqtt_subscribe_info_t
#include <cy_mqtt_api.h>

MQTT subscribe information structure.

Public Members

cy_mqtt_qos_t qos

Requested quality of Service for the subscription.

const char *topic

Topic filter to subscribe to.

uint16_t topic_len

Length of subscription topic filter.

cy_mqtt_qos_t allocated_qos

QoS allocated by the broker for the subscription.

CY_MQTT_QOS_INVALID indicates subscription failure.

struct cy_mqtt_publish_info_t
#include <cy_mqtt_api.h>

MQTT publish information structure.

MQTT messages received on the subscribed topic is also represented using this structure.

Public Members

cy_mqtt_qos_t qos

Quality of Service for message.

bool retain

Whether this is a retained message.

bool dup

Whether this is a duplicate publish message.

const char *topic

Topic name on which the message is published.

uint16_t topic_len

Length of topic name.

const char *payload

Message payload.

size_t payload_len

Message payload length.

struct cy_mqtt_broker_info_t
#include <cy_mqtt_api.h>

MQTT broker information structure.

Public Members

const char *hostname

Server host name.

Must be Non NULL-terminated. This memory needs to be maintained until MQTT object is deleted.

uint16_t hostname_len

Length of the server host name.

uint16_t port

Server port in host-order.

struct cy_mqtt_connect_info_t
#include <cy_mqtt_api.h>

MQTT connect information structure.

Public Members

const char *client_id

MQTT client identifier.

Must be unique per client. This memory needs to be maintained until MQTT object is deleted.

uint16_t client_id_len

Length of the client identifier.

const char *username

MQTT user name.

Set to NULL if not used. This memory needs to be maintained until MQTT object is deleted.

uint16_t username_len

Length of MQTT user name.

Set to 0 if not used.

const char *password

MQTT password.

Set to NULL if not used. This memory needs to be maintained until MQTT object is deleted.

uint16_t password_len

Length of MQTT password.

Set to 0 if not used.

bool clean_session

Whether to establish a new, clean session or resume a previous session.

uint16_t keep_alive_sec

MQTT keep alive period.

cy_mqtt_publish_info_t *will_info

MQTT will message.

This will info can be NULL.

struct cy_mqtt_message_t
#include <cy_mqtt_api.h>

Received MQTT publish message information structure.

Public Members

uint16_t packet_id

Packet ID of the MQTT message.

cy_mqtt_received_msg_info_t received_message

Received MQTT message from the subscribed topic.

struct cy_mqtt_event_t
#include <cy_mqtt_api.h>

MQTT event information structure.

Public Members

cy_mqtt_event_type_t type

Event type.

cy_mqtt_disconn_type_t reason

Disconnection reason for event type CY_MQTT_EVENT_TYPE_DISCONNECT.

cy_mqtt_message_t pub_msg

Received MQTT message for event type CY_MQTT_EVENT_TYPE_SUBSCRIPTION_MESSAGE_RECEIVE.

union cy_mqtt_event_t::[anonymous] data

Event data.