TI's MQTT Demo with freertos CM4F

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

SlMqttServerCbs_t Struct Reference

SlMqttServerCbs_t Struct Reference
[SL MQTT Server APIs]

Callbacks Routines The routines are invoked by SL MQTT Server Implementation onto Server application. More...

#include <sl_mqtt_server.h>

Data Fields

uint8_t(* sl_ExtLib_MqttConn )(const char *clientId_str, int32_t clientId_len, const char *username_str, int32_t username_len, const char *password_str, int32_t password_len, void **usr)
 Connect Request: Callback routine to indicate to server application that a CONNECT request has been received by the server.
void(* sl_ExtLib_MqttRecv )(const char *topstr, int32_t toplen, const void *payload, int32_t pay_len, bool dup, uint8_t qos, bool retain)
 Callback routine to receive a PUBLISH from a client.
void(* sl_ExtLib_MqttDisconn )(void *usr, bool due2err)
 DISCONNECT: Callback routine to indicate to the Server Application that a client has disconnected.
void(* sl_ExtLib_MqttEvent )(void *usr, int32_t evt, const void *buf, uint32_t len)
 Indication of event either from the server library or implementation generated.

Detailed Description

Callbacks Routines The routines are invoked by SL MQTT Server Implementation onto Server application.

Note:
The user applications implement the callbacks that are registered with the libraries. While using the MQTT library, invoking the core library APIs from a callback should be avoided and can lead to lockup scenarios. It is recommended to signal another task from the callback routines invoked from the library and invoke the core library API calls from that task.

Definition at line 144 of file sl_mqtt_server.h.


Field Documentation

uint8_t(* sl_ExtLib_MqttConn)(const char *clientId_str, int32_t clientId_len, const char *username_str, int32_t username_len, const char *password_str, int32_t password_len, void **usr)

Connect Request: Callback routine to indicate to server application that a CONNECT request has been received by the server.

Parameters:
[in]clientId_strclientId field in the CONNECT message received.
[in]clientId_lenlength of ClientId
[in]username_strUsername field in teh CONNECT message received.
[in]username_lenlength of username
[in]password_strPassword field in the CONNECT message received.
[in]password_lenlength of password
[out]usrplaceholder to provision app's handle to this connection.
Returns:
0x0000 or 0x0100 for success; Otherwise 0x02, 0x04 or 0x05 refer to spec for connack codes

Definition at line 160 of file sl_mqtt_server.h.

void(* sl_ExtLib_MqttDisconn)(void *usr, bool due2err)

DISCONNECT: Callback routine to indicate to the Server Application that a client has disconnected.

Parameters:
[in]usrapp's handle to this connection.
[in]due2errset to 1, if connection has been closed, without server receiving a DISCONNECT messsage.
Returns:
none.

Definition at line 195 of file sl_mqtt_server.h.

void(* sl_ExtLib_MqttEvent)(void *usr, int32_t evt, const void *buf, uint32_t len)

Indication of event either from the server library or implementation generated.

TBD - Reserved for future use.

Parameters:
[in]usrapp's handle to this connection.
[in]evtidentifier to the reported event. Refer to SL MQTT Server Events - TBD
[in]bufpoints to buffer
[in]lenlength of buffer
Returns:
none.

Definition at line 207 of file sl_mqtt_server.h.

void(* sl_ExtLib_MqttRecv)(const char *topstr, int32_t toplen, const void *payload, int32_t pay_len, bool dup, uint8_t qos, bool retain)

Callback routine to receive a PUBLISH from a client.

The server app must provide this routine for the instances where it receives PUBLISH messages from clients. The callback is invoked in the context of the internal SL MQTT server Receive Task.

Parameters:
[in]topstrname of topic on which PUBLISH is received by the server. Not NULL terminated.
[in]toplenlength of the topic name
[in]payloadrefers to payload published by the server.
[in]pay_lenlength of the payload.
[in]dupassert to indicate that it is a duplicate message sent by the client
[in]qoSquality of service of the received published message.
[in]retainasserted to indicate that a retained message has been received
Returns:
none.

Definition at line 180 of file sl_mqtt_server.h.