mqtt_sn_client_misc.c File Reference

Helper functions for MQTT-SN client. More...

Go to the source code of this file.

Macros

#define TRACE_LEVEL   MQTT_SN_TRACE_LEVEL
 

Functions

error_t mqttSnClientProcessEvents (MqttSnClientContext *context, systime_t timeout)
 Process MQTT-SN client events. More...
 
MqttSnReturnCode mqttSnDeliverPublishMessage (MqttSnClientContext *context, MqttSnFlags flags, uint16_t topicId, const uint8_t *data, size_t dataLen)
 Deliver a PUBLISH message to the application. More...
 
error_t mqttSnClientAddTopic (MqttSnClientContext *context, const char_t *topicName, uint16_t topicId)
 Add a new entry to the topic table. More...
 
error_t mqttSnClientDeleteTopic (MqttSnClientContext *context, const char_t *topicName)
 Remove an entry in the topic table. More...
 
const char_tmqttSnClientFindTopicId (MqttSnClientContext *context, uint16_t topicId)
 Retrieve the topic name associated with a given topic ID. More...
 
uint16_t mqttSnClientFindTopicName (MqttSnClientContext *context, const char_t *topicName)
 Retrieve the topic ID associated with a given topic name. More...
 
const char_tmqttSnClientFindPredefTopicId (MqttSnClientContext *context, uint16_t topicId)
 Retrieve the topic name associated with a predefined topic ID. More...
 
uint16_t mqttSnClientFindPredefTopicName (MqttSnClientContext *context, const char_t *topicName)
 Retrieve the topic ID associated with a predefined topic name. More...
 
uint16_t mqttSnClientGenerateMessageId (MqttSnClientContext *context)
 Generate a new message identifier. More...
 
error_t mqttSnClientStoreMessageId (MqttSnClientContext *context, uint16_t msgId)
 Store message ID (QoS 2 message processing) More...
 
error_t mqttSnClientDiscardMessageId (MqttSnClientContext *context, uint16_t msgId)
 Discard message ID (QoS 2 message processing) More...
 
bool_t mqttSnClientIsDuplicateMessageId (MqttSnClientContext *context, uint16_t msgId)
 Check whether the message ID is a duplicate (QoS 2 message processing) More...
 
bool_t mqttSnClientIsShortTopicName (const char_t *topicName)
 Check whether a topic name is a short topic name. More...
 

Detailed Description

Helper functions for MQTT-SN client.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file mqtt_sn_client_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   MQTT_SN_TRACE_LEVEL

Definition at line 30 of file mqtt_sn_client_misc.c.

Function Documentation

◆ mqttSnClientAddTopic()

error_t mqttSnClientAddTopic ( MqttSnClientContext context,
const char_t topicName,
uint16_t  topicId 
)

Add a new entry to the topic table.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]topicNameTopic name
[in]topicIdTopic identifier
Returns
Error code

Definition at line 238 of file mqtt_sn_client_misc.c.

◆ mqttSnClientDeleteTopic()

error_t mqttSnClientDeleteTopic ( MqttSnClientContext context,
const char_t topicName 
)

Remove an entry in the topic table.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]topicNameTopic name
Returns
Error code

Definition at line 288 of file mqtt_sn_client_misc.c.

◆ mqttSnClientDiscardMessageId()

error_t mqttSnClientDiscardMessageId ( MqttSnClientContext context,
uint16_t  msgId 
)

Discard message ID (QoS 2 message processing)

Parameters
[in]contextPointer to the MQTT-SN client context
[in]msgIdMessage identifier
Returns
Error code

Definition at line 530 of file mqtt_sn_client_misc.c.

◆ mqttSnClientFindPredefTopicId()

const char_t* mqttSnClientFindPredefTopicId ( MqttSnClientContext context,
uint16_t  topicId 
)

Retrieve the topic name associated with a predefined topic ID.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]topicIdPredefined topic identifier
Returns
Topic name

Definition at line 393 of file mqtt_sn_client_misc.c.

◆ mqttSnClientFindPredefTopicName()

uint16_t mqttSnClientFindPredefTopicName ( MqttSnClientContext context,
const char_t topicName 
)

Retrieve the topic ID associated with a predefined topic name.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]topicNamePredefined topic name
Returns
Topic identifier

Definition at line 430 of file mqtt_sn_client_misc.c.

◆ mqttSnClientFindTopicId()

const char_t* mqttSnClientFindTopicId ( MqttSnClientContext context,
uint16_t  topicId 
)

Retrieve the topic name associated with a given topic ID.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]topicIdTopic identifier
Returns
Topic name

Definition at line 319 of file mqtt_sn_client_misc.c.

◆ mqttSnClientFindTopicName()

uint16_t mqttSnClientFindTopicName ( MqttSnClientContext context,
const char_t topicName 
)

Retrieve the topic ID associated with a given topic name.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]topicNameTopic name
Returns
Topic identifier

Definition at line 356 of file mqtt_sn_client_misc.c.

◆ mqttSnClientGenerateMessageId()

uint16_t mqttSnClientGenerateMessageId ( MqttSnClientContext context)

Generate a new message identifier.

Parameters
[in]contextPointer to the MQTT-SN client context
Returns
16-bit message identifier

Definition at line 466 of file mqtt_sn_client_misc.c.

◆ mqttSnClientIsDuplicateMessageId()

bool_t mqttSnClientIsDuplicateMessageId ( MqttSnClientContext context,
uint16_t  msgId 
)

Check whether the message ID is a duplicate (QoS 2 message processing)

Parameters
[in]contextPointer to the MQTT-SN client context
[in]msgIdMessage identifier
Returns
TRUE if the message ID is a duplicate, else FALSE

Definition at line 563 of file mqtt_sn_client_misc.c.

◆ mqttSnClientIsShortTopicName()

bool_t mqttSnClientIsShortTopicName ( const char_t topicName)

Check whether a topic name is a short topic name.

Parameters
[in]topicNameTopic name
Returns
TRUE if the specified topic name is a short topic name, else FALSE

Definition at line 596 of file mqtt_sn_client_misc.c.

◆ mqttSnClientProcessEvents()

error_t mqttSnClientProcessEvents ( MqttSnClientContext context,
systime_t  timeout 
)

Process MQTT-SN client events.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]timeoutMaximum time to wait before returning
Returns
Error code

Definition at line 51 of file mqtt_sn_client_misc.c.

◆ mqttSnClientStoreMessageId()

error_t mqttSnClientStoreMessageId ( MqttSnClientContext context,
uint16_t  msgId 
)

Store message ID (QoS 2 message processing)

Parameters
[in]contextPointer to the MQTT-SN client context
[in]msgIdMessage identifier
Returns
Error code

Definition at line 486 of file mqtt_sn_client_misc.c.

◆ mqttSnDeliverPublishMessage()

MqttSnReturnCode mqttSnDeliverPublishMessage ( MqttSnClientContext context,
MqttSnFlags  flags,
uint16_t  topicId,
const uint8_t *  data,
size_t  dataLen 
)

Deliver a PUBLISH message to the application.

Parameters
[in]contextPointer to the MQTT-SN client context
[in]flagsFlags
[in]topicIdTopic identifier
[in]dataMessage payload
[in]dataLenLength of the message payload
Returns
Error code

Definition at line 168 of file mqtt_sn_client_misc.c.