From e5b6fd849c0551aff50b92cf17d92dcb2a7351b3 Mon Sep 17 00:00:00 2001 From: jgromes Date: Fri, 24 May 2019 18:51:26 +0200 Subject: [PATCH] [TRA] Added Doxygen comments --- src/protocols/TransportLayer.h | 68 +++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/src/protocols/TransportLayer.h b/src/protocols/TransportLayer.h index 6e663d88..bf17782a 100644 --- a/src/protocols/TransportLayer.h +++ b/src/protocols/TransportLayer.h @@ -3,17 +3,83 @@ #include "TypeDef.h" +/*! + \class TransportLayer + + \brief Provides common interface for protocols that run on modules with Internet connectivity, such as HTTP or MQTT. + Because this class is used mainly as interface, all of its virtual members must be implemented in the module class. +*/ class TransportLayer { public: // constructor // this class is purely virtual and does not require explicit constructor - + // basic methods + + /*! + \brief Open transport layer connection. + + \param host Host to connect to. + + \param protocol Transport protocol to use. Usually "TCP" or "UDP". + + \param port to be used for the connection. + + \param tcpKeepAlive TCP keep alive interval. Defaults to 0. + + \returns \ref status_codes + */ virtual int16_t openTransportConnection(const char* host, const char* protocol, uint16_t port, uint16_t tcpKeepAlive = 0) = 0; + + /*! + \brief Close transport layer connection. + + \returns \ref status_codes + */ virtual int16_t closeTransportConnection() = 0; + + /*! + \brief Send string-based data. + + \param string String data to be sent. + + \returns \ref status_codes + */ virtual int16_t send(const char* data) = 0; + + /*! + \brief Send arbitrary binary data. + + \param data Data to be sent. + + \param len Number of bytes to send. + + \returns \ref status_codes + */ virtual int16_t send(uint8_t* data, uint32_t len) = 0; + + /*! + \brief Receive data. + + \param data Pointer to array to save the received data. + + \param len Number of bytes to read. + + \param timeout Reception timeout in ms. Defaults to 10000. + + \returns \ref status_codes + */ virtual size_t receive(uint8_t* data, size_t len, uint32_t timeout = 10000) = 0; + + /*! + \brief Get number of received bytes. + + \param timeout Reception timeout in ms. Defaults to 10000. + + \param minBytes Minimum required number of bytes that must be received. + + \returns Number of received bytes, or 0 on timeout. + */ virtual size_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10) = 0; };