MQTT Client: D:/my_data/GIT/network_apps/netapps/mqtt/client/mqtt_client.h File Reference

Message Queuing Telemetry Transport Protocol

D:/my_data/GIT/network_apps/netapps/mqtt/client/mqtt_client.h File Reference
#include "mqtt_common.h"

Go to the source code of this file.

Classes

struct  mqtt_client_ctx_cbs
struct  mqtt_client_ctx_cfg
struct  mqtt_client_lib_cfg

Defines

#define MQTT_CLIENT_VERSTR   "1.0.0"
#define VHB_CONNACK_RC(vh_buf)   (vh_buf[1])
#define MQP_CONNACK_RC(mqp)   (mqp->buffer[3])
#define VHB_CONNACK_SP(vh_buf)   (vh_buf[0] & 0x1)
#define MQP_CONNACK_SP(mqp)   (mqp->buffer[2] & 0x1)
#define VHB_CONNACK_VH16(vh_buf)   ((vh_buf[0] << 8) | vh_buf[1])
#define MQP_CONNACK_VH16(mqp)   ((mqp->buffer[2] << 8) | mqp->buffer[3])
#define MQTT_CFG_PROTOCOL_V31   0x0001
#define MQTT_CFG_APP_HAS_RTSK   0x0002
#define MQTT_CFG_MK_GROUP_CTX   0x0004
#define MQTT_NETCONN_OPT_IP6   DEV_NETCONN_OPT_IP6
#define MQTT_NETCONN_OPT_URL   DEV_NETCONN_OPT_URL
#define MQTT_NETCONN_OPT_SEC   DEV_NETCONN_OPT_SEC

Functions

u16 mqtt_client_new_msg_id (void)
bool mqtt_client_is_connected (void *ctx)
i32 mqtt_connect_msg_send (void *ctx, bool clean_session, u16 ka_secs)
i32 mqtt_client_pub_msg_send (void *ctx, const struct utf8_string *topic, const u8 *data_buf, u32 data_len, enum mqtt_qos qos, bool retain)
i32 mqtt_client_pub_dispatch (void *ctx, struct mqtt_packet *mqp, enum mqtt_qos qos, bool retain)
i32 mqtt_sub_msg_send (void *ctx, const struct utf8_strqos *qos_topics, u32 count)
i32 mqtt_sub_dispatch (void *ctx, struct mqtt_packet *mqp)
i32 mqtt_unsub_msg_send (void *ctx, const struct utf8_string *topics, u32 count)
i32 mqtt_unsub_dispatch (void *ctx, struct mqtt_packet *mqp)
i32 mqtt_pingreq_send (void *ctx)
i32 mqtt_disconn_send (void *ctx)
i32 mqtt_client_send_progress (void *ctx)
i32 mqtt_client_ctx_await_msg (void *ctx, u8 msg_type, struct mqtt_packet *mqp, u32 wait_secs)
i32 mqtt_client_ctx_run (void *ctx, u32 wait_secs)
i32 mqtt_client_await_msg (struct mqtt_packet *mqp, u32 wait_secs, void **app)
i32 mqtt_client_run (u32 wait_secs)
struct mqtt_packetmqp_client_alloc (u8 msg_type, u8 offset)
i32 mqtt_client_buffers_register (u32 num_mqp, struct mqtt_packet *mqp_vec, u32 buf_len, u8 *buf_vec)
i32 mqtt_client_ctx_info_register (void *ctx, const struct utf8_string *client_id, const struct utf8_string *user_name, const struct utf8_string *pass_word)
i32 mqtt_client_ctx_will_register (void *ctx, const struct utf8_string *will_top, const struct utf8_string *will_msg, enum mqtt_qos will_qos, bool retain)
i32 mqtt_client_net_svc_register (const struct device_net_services *net)
i32 mqtt_client_ctx_create (const struct mqtt_client_ctx_cfg *ctx_cfg, const struct mqtt_client_ctx_cbs *ctx_cbs, void *app, void **ctx)
i32 mqtt_client_ctx_delete (void *ctx)
i32 mqtt_client_lib_init (const struct mqtt_client_lib_cfg *cfg)
i32 mqtt_client_lib_exit (void)

Detailed Description

This C library provisions the interface / API(s) for the MQTT Client.

This is a light-weight library to enable the services of the MQTT protocol for one or more client applications (that would typically run on a resource constrained system). The key consideration in the design of small footprint library has been the abstraction of the low level details of the message transactions with the server and yet, provide rudimentary API(s), such that, the capabilities and features of the protocol are availalbe to be utilized by existing and new applications in an un-restrictive manner.

The library is targeted to conform to MQTT 3.1.1 specification.

The MQTT Client library is a highly portable software and implies a very limited set of dependencies on a platform. Importantly, these limited dependencies are the commonly used features used in the embedded and the networking world, and can be easily adapted to the target platforms.

The services of the library are multi-task safe. Platform specific atomicity constructs are used, through abstractions, by the library to maintain data coherency and synchronization. In addition, the library can be configured to support several in-flight messages.

The client library supports multiple and simultaneous MQTT connections to one or more servers. In this client LIB, the reference to an individual connection in conjunction with the associated configuration parameters has been termed as a 'context'. Therefore, the client library supports multiple 'contexts'. An application that intends to make use of the client library must set-up or create a 'context' prior to establishing a connection with the server. The application can choose to destroy the 'context' after the connection with the server has been terminated. The client LIB can only support a finite set of 'contexts' and the number can be configured by using a compiler line option / flag -DCFG_CL_MQTT_CTXS .

Once, the 'context' is set-up, the application can send and receive the MQTT packets to / from the server. Among several features supported by the client LIB, the 'context' manages the keep-alive mechanism by automatically sending PING request to the server, if there has been no other packet send to the server with the keep-alive duration.

Note:
Any future extensions & development must follow the following guidelines. A new API or an extension to the existing API a) must be rudimentary b) must not imply a rule or policy (including a state machine) b) must ensure simple design and implementation
Generated on Mon Nov 17 2014 12:11:04 for MQTT Client by  doxygen 1.7.4