Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mqtt_client_misc.h Source File

mqtt_client_misc.h

Go to the documentation of this file.
00001 /**
00002  * @file mqtt_client_misc.h
00003  * @brief Helper functions for MQTT client
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This file is part of CycloneTCP Open.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software Foundation,
00023  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024  *
00025  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00026  * @version 1.7.6
00027  **/
00028 
00029 #ifndef _MQTT_CLIENT_MISC_H
00030 #define _MQTT_CLIENT_MISC_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "mqtt/mqtt_client.h"
00035 
00036 //MQTT client related functions
00037 void mqttClientChangeState(MqttClientContext *context, MqttClientState newState);
00038 
00039 error_t mqttClientCheckKeepAlive(MqttClientContext *context);
00040 
00041 error_t mqttSerializeHeader(uint8_t *buffer, size_t *pos, MqttPacketType type,
00042    bool_t dup, MqttQosLevel qos, bool_t retain, size_t remainingLen);
00043 
00044 error_t mqttSerializeByte(uint8_t *buffer, size_t bufferLen,
00045    size_t *pos, uint8_t value);
00046 
00047 error_t mqttSerializeShort(uint8_t *buffer, size_t bufferLen,
00048    size_t *pos, uint16_t value);
00049 
00050 error_t mqttSerializeString(uint8_t *buffer, size_t bufferLen,
00051    size_t *pos, const void *string, size_t stringLen);
00052 
00053 error_t mqttSerializeData(uint8_t *buffer, size_t bufferLen,
00054    size_t *pos, const void *data, size_t dataLen);
00055 
00056 error_t mqttDeserializeHeader(uint8_t *buffer, size_t bufferLen, size_t *pos,
00057    MqttPacketType *type, bool_t *dup, MqttQosLevel *qos, bool_t *retain, size_t *remainingLen);
00058 
00059 error_t mqttDeserializeByte(uint8_t *buffer, size_t bufferLen,
00060    size_t *pos, uint8_t *value);
00061 
00062 error_t mqttDeserializeShort(uint8_t *buffer, size_t bufferLen,
00063    size_t *pos, uint16_t *value);
00064 
00065 error_t mqttDeserializeString(uint8_t *buffer, size_t bufferLen,
00066    size_t *pos, char_t **string, size_t *stringLen);
00067 
00068 #endif
00069