mqtt_sn_client.c
error_t mqttSnClientDisconnect(MqttSnClientContext *context, systime_t duration)
Disconnect from the MQTT-SN gateway.
Definition: mqtt_sn_client.c:1374
error_t mqttSnClientUpdateWillMessage(MqttSnClientContext *context, const char_t *topic, const void *message, size_t length, MqttSnQosLevel qos, bool_t retain)
Update the Will message.
Definition: mqtt_sn_client.c:1171
error_t mqttSnClientProcessEvents(MqttSnClientContext *context, systime_t timeout)
Process MQTT-SN client events.
Definition: mqtt_sn_client_misc.c:53
void mqttSnClientDeinit(MqttSnClientContext *context)
Release MQTT-SN client context.
Definition: mqtt_sn_client.c:1468
error_t mqttSnClientSendPubRel(MqttSnClientContext *context, uint16_t msgId)
Send PUBREL message.
Definition: mqtt_sn_client_message.c:1372
uint32_t netGetRandRange(uint32_t min, uint32_t max)
Generate a random value in the specified range.
Definition: net.c:413
error_t mqttSnClientSendDisconnect(MqttSnClientContext *context, uint16_t duration)
Send DISCONNECT message.
Definition: mqtt_sn_client_message.c:1686
error_t(* MqttSnClientDtlsInitCallback)(MqttSnClientContext *context, TlsContext *dtlsContext)
DTLS initialization callback.
Definition: mqtt_sn_client.h:184
error_t mqttSnClientSendRegister(MqttSnClientContext *context, const char_t *topicName)
Send REGISTER message.
Definition: mqtt_sn_client_message.c:1094
error_t mqttSnClientTask(MqttSnClientContext *context, systime_t timeout)
Process MQTT-SN client events.
Definition: mqtt_sn_client.c:1340
error_t mqttSnClientSendSubscribe(MqttSnClientContext *context, const char_t *topicName, MqttSnQosLevel qos)
Send SUBSCRIBE message.
Definition: mqtt_sn_client_message.c:1454
error_t mqttSnClientGetReturnCode(MqttSnClientContext *context, MqttSnReturnCode *returnCode)
Retrieve return code.
Definition: mqtt_sn_client.c:1318
error_t mqttSnClientSendSearchGw(MqttSnClientContext *context, uint8_t radius, const IpAddr *destIpAddr, uint16_t destPort)
Send SEARCHGW message.
Definition: mqtt_sn_client_message.c:920
error_t mqttSnClientSendUnsubscribe(MqttSnClientContext *context, const char_t *topicName)
Send UNSUBSCRIBE message.
Definition: mqtt_sn_client_message.c:1536
error_t mqttSnClientSubscribe(MqttSnClientContext *context, const char_t *topicName, MqttSnQosLevel qos)
Subscribe to topic.
Definition: mqtt_sn_client.c:874
MQTT-SN message formatting and parsing.
error_t mqttSnClientSetPredefinedTopics(MqttSnClientContext *context, MqttSnPredefinedTopic *predefinedTopics, uint_t size)
Set the list of predefined topics.
Definition: mqtt_sn_client.c:170
#define MQTT_SN_CLIENT_MAX_WILL_PAYLOAD_LEN
Definition: mqtt_sn_client.h:90
error_t mqttSnClientSetKeepAlive(MqttSnClientContext *context, systime_t keepAlive)
Set keep-alive value.
Definition: mqtt_sn_client.c:218
error_t mqttSnClientSetIdentifier(MqttSnClientContext *context, const char_t *clientId)
Set client identifier.
Definition: mqtt_sn_client.c:239
void tlsFreeSessionState(TlsSessionState *session)
Properly dispose a session state.
Definition: tls.c:2753
error_t mqttSnClientSendPingReq(MqttSnClientContext *context)
Send PINGREQ message.
Definition: mqtt_sn_client_message.c:1616
uint16_t mqttSnClientFindTopicName(MqttSnClientContext *context, const char_t *topicName)
Retrieve the topic ID associated with a given topic name.
Definition: mqtt_sn_client_misc.c:362
error_t mqttSnClientOpenConnection(MqttSnClientContext *context, bool_t secure)
Open network connection.
Definition: mqtt_sn_client_transport.c:51
error_t mqttSnClientAddTopic(MqttSnClientContext *context, const char_t *topicName, uint16_t topicId)
Add a new entry to the topic table.
Definition: mqtt_sn_client_misc.c:244
error_t mqttSnClientPublish(MqttSnClientContext *context, const char_t *topicName, const void *message, size_t length, MqttSnQosLevel qos, bool_t retain, bool_t dup, uint16_t *msgId)
Publish message.
Definition: mqtt_sn_client.c:633
error_t mqttSnClientSetWillMessage(MqttSnClientContext *context, const char_t *topic, const void *message, size_t length, MqttSnQosLevel qos, bool_t retain)
Specify the Will message.
Definition: mqtt_sn_client.c:269
error_t mqttSnClientBindToInterface(MqttSnClientContext *context, NetInterface *interface)
Bind the MQTT-SN client to a particular network interface.
Definition: mqtt_sn_client.c:319
uint16_t mqttSnClientGenerateMessageId(MqttSnClientContext *context)
Generate a new message identifier.
Definition: mqtt_sn_client_misc.c:472
error_t mqttSnClientSendWillMsgUpd(MqttSnClientContext *context)
Send WILLMSGUPD message.
Definition: mqtt_sn_client_message.c:1773
bool_t mqttSnClientIsShortTopicName(const char_t *topicName)
Check whether a topic name is a short topic name.
Definition: mqtt_sn_client_misc.c:606
error_t mqttSnClientEstablishConnection(MqttSnClientContext *context)
Establish network connection.
Definition: mqtt_sn_client_transport.c:138
error_t mqttSnClientUnsubscribe(MqttSnClientContext *context, const char_t *topicName)
Unsubscribe from topic.
Definition: mqtt_sn_client.c:983
error_t mqttSnClientSetTimeout(MqttSnClientContext *context, systime_t timeout)
Set communication timeout.
Definition: mqtt_sn_client.c:197
#define MQTT_SN_CLIENT_DEFAULT_KEEP_ALIVE
Definition: mqtt_sn_client.h:111
@ MQTT_SN_CLIENT_STATE_DISCONNECTED
Definition: mqtt_sn_client.h:164
error_t mqttSnClientSendPublish(MqttSnClientContext *context, uint16_t msgId, const char_t *topicName, const uint8_t *data, size_t length, MqttSnQosLevel qos, bool_t retain, bool_t dup)
Send PUBLISH message.
Definition: mqtt_sn_client_message.c:1186
@ MQTT_SN_CLIENT_STATE_RESP_RECEIVED
Definition: mqtt_sn_client.h:169
error_t mqttSnClientSetTransportProtocol(MqttSnClientContext *context, MqttSnTransportProtocol transportProtocol)
Set the transport protocol to be used.
Definition: mqtt_sn_client.c:98
@ MQTT_SN_CLIENT_STATE_DISCONNECTING
Definition: mqtt_sn_client.h:173
void mqttSnClientCloseConnection(MqttSnClientContext *context)
Close network connection.
Definition: mqtt_sn_client_transport.c:204
Helper functions for MQTT-SN client.
error_t mqttSnClientShutdownConnection(MqttSnClientContext *context)
Shutdown network connection.
Definition: mqtt_sn_client_transport.c:178
Transport protocol abstraction layer.
error_t mqttSnClientSetGateway(MqttSnClientContext *context, const IpAddr *gwIpAddr, uint16_t gwPort)
Specify the address of the gateway.
Definition: mqtt_sn_client.c:342
uint16_t mqttSnClientFindPredefTopicName(MqttSnClientContext *context, const char_t *topicName)
Retrieve the topic ID associated with a predefined topic name.
Definition: mqtt_sn_client_misc.c:436
error_t mqttSnClientPing(MqttSnClientContext *context)
Send ping request.
Definition: mqtt_sn_client.c:1073
#define MQTT_SN_CLIENT_MAX_WILL_TOPIC_LEN
Definition: mqtt_sn_client.h:83
#define MQTT_SN_CLIENT_DEFAULT_TIMEOUT
Definition: mqtt_sn_client.h:104
error_t mqttSnClientSearchGateway(MqttSnClientContext *context, const IpAddr *destIpAddr, uint16_t destPort)
Search for a gateway.
Definition: mqtt_sn_client.c:366
error_t mqttSnClientInit(MqttSnClientContext *context)
Initialize MQTT-SN client context.
Definition: mqtt_sn_client.c:52
MQTT-SN client.
error_t mqttSnClientSendWillTopicUpd(MqttSnClientContext *context)
Send WILLTOPICUPD message.
Definition: mqtt_sn_client_message.c:1727
TCP/IP stack core.
error_t tlsInitSessionState(TlsSessionState *session)
Initialize session state.
Definition: tls.c:2610
error_t mqttSnClientRegisterDtlsInitCallback(MqttSnClientContext *context, MqttSnClientDtlsInitCallback callback)
Register DTLS initialization callback function.
Definition: mqtt_sn_client.c:122
error_t mqttSnClientConnect(MqttSnClientContext *context, bool_t cleanSession)
Establish connection with the MQTT-SN gateway.
Definition: mqtt_sn_client.c:479
void(* MqttSnClientPublishCallback)(MqttSnClientContext *context, const char_t *topic, const uint8_t *message, size_t length, MqttSnQosLevel qos, bool_t retain)
PUBLISH message received callback.
Definition: mqtt_sn_client.h:194
Debugging facilities.
error_t mqttSnClientRegisterPublishCallback(MqttSnClientContext *context, MqttSnClientPublishCallback callback)
Register publish callback function.
Definition: mqtt_sn_client.c:147
error_t mqttSnClientSendConnect(MqttSnClientContext *context, bool_t cleanSession)
Send CONNECT message.
Definition: mqtt_sn_client_message.c:959