Helper functions for MQTT-SN client. More...
#include "core/net.h"#include "mqtt_sn/mqtt_sn_client.h"#include "mqtt_sn/mqtt_sn_client_message.h"#include "mqtt_sn/mqtt_sn_client_transport.h"#include "mqtt_sn/mqtt_sn_client_misc.h"#include "debug.h"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_t * | mqttSnClientFindTopicId (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_t * | mqttSnClientFindPredefTopicId (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
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 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.
- Version
- 2.5.4
Definition in file mqtt_sn_client_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
| #define TRACE_LEVEL MQTT_SN_TRACE_LEVEL | 
Definition at line 32 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] context Pointer to the MQTT-SN client context [in] topicName Topic name [in] topicId Topic identifier 
- Returns
- Error code
Definition at line 244 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] context Pointer to the MQTT-SN client context [in] topicName Topic name 
- Returns
- Error code
Definition at line 294 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] context Pointer to the MQTT-SN client context [in] msgId Message identifier 
- Returns
- Error code
Definition at line 540 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] context Pointer to the MQTT-SN client context [in] topicId Predefined topic identifier 
- Returns
- Topic name
Definition at line 399 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] context Pointer to the MQTT-SN client context [in] topicName Predefined topic name 
- Returns
- Topic identifier
Definition at line 436 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] context Pointer to the MQTT-SN client context [in] topicId Topic identifier 
- Returns
- Topic name
Definition at line 325 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] context Pointer to the MQTT-SN client context [in] topicName Topic name 
- Returns
- Topic identifier
Definition at line 362 of file mqtt_sn_client_misc.c.
◆ mqttSnClientGenerateMessageId()
| uint16_t mqttSnClientGenerateMessageId | ( | MqttSnClientContext * | context | ) | 
Generate a new message identifier.
- Parameters
- 
  [in] context Pointer to the MQTT-SN client context 
- Returns
- 16-bit message identifier
Definition at line 472 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] context Pointer to the MQTT-SN client context [in] msgId Message identifier 
- Returns
- TRUE if the message ID is a duplicate, else FALSE
Definition at line 573 of file mqtt_sn_client_misc.c.
◆ mqttSnClientIsShortTopicName()
Check whether a topic name is a short topic name.
- Parameters
- 
  [in] topicName Topic name 
- Returns
- TRUE if the specified topic name is a short topic name, else FALSE
Definition at line 606 of file mqtt_sn_client_misc.c.
◆ mqttSnClientProcessEvents()
| error_t mqttSnClientProcessEvents | ( | MqttSnClientContext * | context, | 
| systime_t | timeout | ||
| ) | 
Process MQTT-SN client events.
- Parameters
- 
  [in] context Pointer to the MQTT-SN client context [in] timeout Maximum time to wait before returning 
- Returns
- Error code
Definition at line 53 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] context Pointer to the MQTT-SN client context [in] msgId Message identifier 
- Returns
- Error code
Definition at line 496 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] context Pointer to the MQTT-SN client context [in] flags Flags [in] topicId Topic identifier [in] data Message payload [in] dataLen Length of the message payload 
- Returns
- Error code
Definition at line 174 of file mqtt_sn_client_misc.c.
