Helper functions for MQTT client. More...
Go to the source code of this file.
Functions | |
void | mqttClientChangeState (MqttClientContext *context, MqttClientState newState) |
Update MQTT client state. More... | |
error_t | mqttClientProcessEvents (MqttClientContext *context, systime_t timeout) |
Process MQTT client events. More... | |
error_t | mqttClientCheckKeepAlive (MqttClientContext *context) |
Check keep-alive time interval. More... | |
error_t | mqttSerializeHeader (uint8_t *buffer, size_t *pos, MqttPacketType type, bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen) |
Serialize fixed header. More... | |
error_t | mqttSerializeByte (uint8_t *buffer, size_t bufferLen, size_t *pos, uint8_t value) |
Write a 8-bit integer to the output buffer. More... | |
error_t | mqttSerializeShort (uint8_t *buffer, size_t bufferLen, size_t *pos, uint16_t value) |
Write a 16-bit integer to the output buffer. More... | |
error_t | mqttSerializeString (uint8_t *buffer, size_t bufferLen, size_t *pos, const void *string, size_t stringLen) |
Serialize string. More... | |
error_t | mqttSerializeData (uint8_t *buffer, size_t bufferLen, size_t *pos, const void *data, size_t dataLen) |
Serialize raw data. More... | |
error_t | mqttDeserializeHeader (uint8_t *buffer, size_t bufferLen, size_t *pos, MqttPacketType *type, bool_t *dup, MqttQosLevel *qos, bool_t *retain, size_t *remainingLen) |
Deserialize fixed header. More... | |
error_t | mqttDeserializeByte (uint8_t *buffer, size_t bufferLen, size_t *pos, uint8_t *value) |
Read a 8-bit integer from the input buffer. More... | |
error_t | mqttDeserializeShort (uint8_t *buffer, size_t bufferLen, size_t *pos, uint16_t *value) |
Read a 16-bit integer from the input buffer. More... | |
error_t | mqttDeserializeString (uint8_t *buffer, size_t bufferLen, size_t *pos, char_t **string, size_t *stringLen) |
Deserialize string. More... | |
error_t | mqttClientCheckTimeout (MqttClientContext *context) |
Determine whether a timeout error has occurred. More... | |
Detailed Description
Helper functions for MQTT 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.
- Version
- 2.4.4
Definition in file mqtt_client_misc.h.
Function Documentation
◆ mqttClientChangeState()
void mqttClientChangeState | ( | MqttClientContext * | context, |
MqttClientState | newState | ||
) |
Update MQTT client state.
- Parameters
-
[in] context Pointer to the MQTT client context [in] newState New state to switch to
Definition at line 52 of file mqtt_client_misc.c.
◆ mqttClientCheckKeepAlive()
error_t mqttClientCheckKeepAlive | ( | MqttClientContext * | context | ) |
Check keep-alive time interval.
- Parameters
-
[in] context Pointer to the MQTT client context
- Returns
- Error code
Definition at line 165 of file mqtt_client_misc.c.
◆ mqttClientCheckTimeout()
error_t mqttClientCheckTimeout | ( | MqttClientContext * | context | ) |
Determine whether a timeout error has occurred.
- Parameters
-
[in] context Pointer to the MQTT client context
- Returns
- Error code
Definition at line 627 of file mqtt_client_misc.c.
◆ mqttClientProcessEvents()
error_t mqttClientProcessEvents | ( | MqttClientContext * | context, |
systime_t | timeout | ||
) |
Process MQTT client events.
- Parameters
-
[in] context Pointer to the MQTT client context [in] timeout Maximum time to wait before returning
- Returns
- Error code
Definition at line 67 of file mqtt_client_misc.c.
◆ mqttDeserializeByte()
error_t mqttDeserializeByte | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
uint8_t * | value | ||
) |
Read a 8-bit integer from the input buffer.
- Parameters
-
[in] buffer Pointer to the input buffer [in] bufferLen Length of the input buffer [in,out] pos Current position [out] value Value of the 8-bit integer
- Returns
- Error code
Definition at line 526 of file mqtt_client_misc.c.
◆ mqttDeserializeHeader()
error_t mqttDeserializeHeader | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
MqttPacketType * | type, | ||
bool_t * | dup, | ||
MqttQosLevel * | qos, | ||
bool_t * | retain, | ||
size_t * | remainingLen | ||
) |
Deserialize fixed header.
- Parameters
-
[in] buffer Pointer to the input buffer [in] bufferLen Length of the input buffer [in,out] pos Current position [out] type MQTT control packet type [out] dup DUP flag from the fixed header [out] qos QoS field from the fixed header [out] retain RETAIN flag from the fixed header [out] remainingLen Length of the variable header and the payload
- Returns
- Error code
Definition at line 448 of file mqtt_client_misc.c.
◆ mqttDeserializeShort()
error_t mqttDeserializeShort | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
uint16_t * | value | ||
) |
Read a 16-bit integer from the input buffer.
- Parameters
-
[in] buffer Pointer to the input buffer [in] bufferLen Length of the input buffer [in,out] pos Current position [out] value Value of the 16-bit integer
- Returns
- Error code
Definition at line 558 of file mqtt_client_misc.c.
◆ mqttDeserializeString()
error_t mqttDeserializeString | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
char_t ** | string, | ||
size_t * | stringLen | ||
) |
Deserialize string.
- Parameters
-
[in] buffer Pointer to the input buffer [in] bufferLen Length of the input buffer [in,out] pos Current position [out] string Pointer to the string [out] stringLen Length of the string, in bytes
- Returns
- Error code
Definition at line 591 of file mqtt_client_misc.c.
◆ mqttSerializeByte()
error_t mqttSerializeByte | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
uint8_t | value | ||
) |
Write a 8-bit integer to the output buffer.
- Parameters
-
[in] buffer Pointer to the output buffer [in] bufferLen Maximum number of bytes the output buffer can hold [in,out] pos Current position [in] value 8-bit integer to be serialized
- Returns
- Error code
Definition at line 309 of file mqtt_client_misc.c.
◆ mqttSerializeData()
error_t mqttSerializeData | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
const void * | data, | ||
size_t | dataLen | ||
) |
Serialize raw data.
- Parameters
-
[in] buffer Pointer to the output buffer [in] bufferLen Maximum number of bytes the output buffer can hold [in,out] pos Current position [in] data Pointer to the raw data to be serialized [in] dataLen Length of the raw data, in bytes
- Returns
- Error code
Definition at line 412 of file mqtt_client_misc.c.
◆ mqttSerializeHeader()
error_t mqttSerializeHeader | ( | uint8_t * | buffer, |
size_t * | pos, | ||
MqttPacketType | type, | ||
bool_t | dup, | ||
MqttQosLevel | qos, | ||
bool_t | retain, | ||
size_t | remainingLen | ||
) |
Serialize fixed header.
- Parameters
-
[in] buffer Pointer to the output buffer [in,out] pos Current position [in] type MQTT control packet type [in] dup DUP flag [in] qos QoS field [in] retain RETAIN flag [in] remainingLen Length of the variable header and the payload
- Returns
- Error code
Definition at line 230 of file mqtt_client_misc.c.
◆ mqttSerializeShort()
error_t mqttSerializeShort | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
uint16_t | value | ||
) |
Write a 16-bit integer to the output buffer.
- Parameters
-
[in] buffer Pointer to the output buffer [in] bufferLen Maximum number of bytes the output buffer can hold [in,out] pos Current position [in] value 16-bit integer to be serialized
- Returns
- Error code
Definition at line 341 of file mqtt_client_misc.c.
◆ mqttSerializeString()
error_t mqttSerializeString | ( | uint8_t * | buffer, |
size_t | bufferLen, | ||
size_t * | pos, | ||
const void * | string, | ||
size_t | stringLen | ||
) |
Serialize string.
- Parameters
-
[in] buffer Pointer to the output buffer [in] bufferLen Maximum number of bytes the output buffer can hold [in,out] pos Current position [in] string Pointer to the string to be serialized [in] stringLen Length of the string, in bytes
- Returns
- Error code
Definition at line 375 of file mqtt_client_misc.c.