mqtt_sn_client_misc.h File Reference

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

#include "core/net.h"
#include "mqtt_sn/mqtt_sn_client.h"

Go to the source code of this file.

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

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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
2.4.0

Definition in file mqtt_sn_client_misc.h.

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 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]contextPointer to the MQTT-SN client context
[in]topicNameTopic 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]contextPointer to the MQTT-SN client context
[in]msgIdMessage 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]contextPointer to the MQTT-SN client context
[in]topicIdPredefined 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]contextPointer to the MQTT-SN client context
[in]topicNamePredefined 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]contextPointer to the MQTT-SN client context
[in]topicIdTopic 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]contextPointer to the MQTT-SN client context
[in]topicNameTopic 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]contextPointer 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]contextPointer to the MQTT-SN client context
[in]msgIdMessage identifier
Returns
TRUE if the message ID is a duplicate, else FALSE

Definition at line 573 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 606 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 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]contextPointer to the MQTT-SN client context
[in]msgIdMessage 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]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 174 of file mqtt_sn_client_misc.c.