#include <string.h>
#include <stdbool.h>
#include <ti/net/mqtt/common/mqtt_common.h>
Go to the source code of this file.
|
MQTTClient_Handle | MQTTClient_create (MQTTClient_CallBack defaultCallback, MQTTClient_Params *params) |
|
int16_t | MQTTClient_delete (MQTTClient_Handle handle) |
|
int16_t | MQTTClient_run (MQTTClient_Handle handle) |
|
int16_t | MQTTClient_connect (MQTTClient_Handle handle) |
|
int16_t | MQTTClient_disconnect (MQTTClient_Handle handle) |
|
int16_t | MQTTClient_publish (MQTTClient_Handle handle, char *topic, uint16_t topicLen, char *msg, uint16_t msgLen, uint32_t flags) |
|
int16_t | MQTTClient_subscribe (MQTTClient_Handle handle, MQTTClient_SubscribeParams *value, uint8_t numberOfTopics) |
|
int16_t | MQTTClient_unsubscribe (MQTTClient_Handle handle, MQTTClient_UnsubscribeParams *value, uint8_t numberOfTopics) |
|
int16_t | MQTTClient_set (MQTTClient_Handle handle, uint16_t option, void *value, uint16_t valueLength) |
|
int16_t | MQTTClient_get (MQTTClient_Handle handle, uint16_t option, void *value, uint16_t valueLength) |
|
§ MQTTClient_OperationMetaDataCB
§ MQTTClient_RecvMetaDataCB
§ MQTTClient_ConnParams
Secure Socket Parameters to open a secure connection
§ MQTTClient_Params
§ MQTTClient_CallBack
typedef void(* MQTTClient_CallBack) (int32_t event, void *metaData, uint32_t metaDateLen, void *data, uint32_t dataLen) |
§ MQTTClient_Handle
§ MQTTClient_SubscribeParams
§ MQTTClient_UnsubscribeParams
§ MQTTClient_Will
§ MQTTClient_Option
Enumerator |
---|
MQTTClient_USER_NAME | |
MQTTClient_PASSWORD | |
MQTTClient_WILL_PARAM | |
MQTTClient_CALLBACKS | |
MQTTClient_KEEPALIVE_TIME | |
MQTTClient_CLEAN_CONNECT | |
MQTTClient_MAX_PARAM | |
§ MQTTClient_EventCB
Enumerator |
---|
MQTTClient_RECV_CB_EVENT | |
MQTTClient_OPERATION_CB_EVENT | |
MQTTClient_DISCONNECT_CB_EVENT | |
§ MQTTClient_create()
Creates the SL MQTT Implementation. A caller must call this function in order the create and initialize the MQTT implementation prior to using its services.
- Parameters
-
[in] | defaultCallback | async event handler |
[in] | params | parameters |
- Returns
- Success Handle or Failure NULL
§ MQTTClient_delete()
This function deletes an MQTT Client instance. It closes the connection if it exists and releases all resources.
- Parameters
-
[in] | handle | to the client context |
- Returns
- Success (0) or Failure (-1)
§ MQTTClient_run()
MQTT client state machine This function need to be called from the context created by the user in case of OS environment.
- Parameters
-
[in] | handle | to the client context |
- Returns
- Success (0) or Failure (Negative number)
§ MQTTClient_connect()
Function connects MQTT client to a broker
- Parameters
-
[in] | handle | to the client context |
- Returns
- Success (0) or Failure (Negative number)
§ MQTTClient_disconnect()
DISCONNECT from the server. The caller must use this service to close the connection with the server.
- Parameters
-
[in] | handle | to the client context |
- Returns
- Success (0) or Failure (Negative number)
§ MQTTClient_publish()
int16_t MQTTClient_publish |
( |
MQTTClient_Handle |
handle, |
|
|
char * |
topic, |
|
|
uint16_t |
topicLen, |
|
|
char * |
msg, |
|
|
uint16_t |
msgLen, |
|
|
uint32_t |
flags |
|
) |
| |
PUBLISH a named message to the server. In addition to the PUBLISH specific parameters, the caller can indicate whether the routine should block until the time, the message has been acknowledged by the server. This is applicable only for non-QoS0 messages.
In case, the app has chosen not to await for the ACK from the server, the SL MQTT implementation will notify the app about the subscription through the callback routine.
- Parameters
-
[in] | handle | refers to the handle to the client context |
[in] | topic | topic of the data to be published. It is NULL terminated. |
[in] | topicLen | topic length. |
[in] | msg | binary data to be published |
[in] | msgLen | length of the msg |
[in] | flags | QOS define MQTT_PUBLISH_QOS_0, MQTT_PUBLISH_QOS_1 or MQTT_PUBLISH_QOS_2 use MQTT_PUBLISH_RETAIN is message should be retained |
- Returns
- Success(transaction Message ID) or Failure(Negative number)
§ MQTTClient_subscribe()
SUBSCRIBE a set of topics. To receive data about a set of topics from the server, the app through this routine must subscribe to those topic names with the server. The caller can indicate whether the routine should block until a time, the message has been acknowledged by the server.
In case, the app has chosen not to await for the ACK from the server, the SL MQTT implementation will notify the app about the subscription through the callback routine.
- Parameters
-
[in] | handle | refers to the handle to the client context |
[in] | value | a pointer to a struct of subscribe parameters which hold:
Topic name to subscribe. It is a pointer to NULL terminated strings.
Qos value for the topic.
persistent session flag in order to enable or disable persistent session.
callback function which is optional - if NULL use the default callback
|
[in] | numberOfTopics | number of such topics |
- Returns
- Success(transaction Message ID) or Failure(Negative number)
§ MQTTClient_unsubscribe()
UNSUBSCRIBE a set of topics. The app should use this service to stop receiving data for the named topics from the server.
- Parameters
-
[in] | handle | refers to the handle to the client context |
[in] | value | topics set of topics to be unsubscribed. It is an array of pointers to NULL terminated strings. |
[in] | numberOfTopics | count number of topics to be unsubscribed |
- Returns
- Success(transaction Message ID) or Failure(Negative number)
§ MQTTClient_set()
int16_t MQTTClient_set |
( |
MQTTClient_Handle |
handle, |
|
|
uint16_t |
option, |
|
|
void * |
value, |
|
|
uint16_t |
valueLength |
|
) |
| |
Setting client parameters. This function can set different parameters to the client. Will message params, user name and password, keep alive time and clean/persistent session.
- Parameters
-
[in] | handle | refers to the handle to the client context |
[in] | option | Define the actual option to set. Applicable values:
|
[in] | value | Specifies a value for the option |
[in] | valueLength | Specifies the length of the value |
- Returns
- Success(0) or Failure(Negative number)
- See also
- MQTTClient_Will
§ MQTTClient_get()
int16_t MQTTClient_get |
( |
MQTTClient_Handle |
handle, |
|
|
uint16_t |
option, |
|
|
void * |
value, |
|
|
uint16_t |
valueLength |
|
) |
| |
Getting client parameters. This function can get different parameters from the client. Will message params, user name and password, keep alive time and clean/persistent session.
- Parameters
-
[in] | handle | refers to the handle to the client context |
[in] | option | Define the actual option to set. Applicable values:
|
[in] | value | Specifies a value for the option |
[in] | valueLength | Specifies the length of the value |
- Returns
- Success(0) or Failure(Negative number)
- See also
- MQTTClient_Will