ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
IHTTP_Client.h
Go to the documentation of this file.
1#ifndef IHTTP_Client_h
2#define IHTTP_Client_h
3
4// Local include.
5#include "Configuration.h"
6
7// Library include.
8#if THINGSBOARD_ENABLE_STL
9#include <string>
10#else
11#include <WString.h>
12#endif // THINGSBOARD_ENABLE_STL
13
14
23 public:
25 virtual ~IHTTP_Client() {}
26
30 virtual void set_keep_alive(bool keep_alive) = 0;
31
40 virtual int connect(char const * host, uint16_t port) = 0;
41
43 virtual void stop() = 0;
44
53 virtual int post(char const * url_path, char const * content_type, char const * request_body) = 0;
54
59 virtual int get_response_status_code() = 0;
60
65 virtual int get(const char *url_path) = 0;
66
71#if THINGSBOARD_ENABLE_STL
72 virtual std::string get_response_body() = 0;
73#else
74 virtual String get_response_body() = 0;
75#endif // THINGSBOARD_ENABLE_STL
76};
77
78#endif // IHTTP_Client_h
HTTP Client interface that contains the method that a class that can be used to send and receive data...
Definition: IHTTP_Client.h:22
virtual int post(char const *url_path, char const *content_type, char const *request_body)=0
Connects to the server and sends a POST request with a body and content type.
virtual void stop()=0
Disconnects the given device from the current host and clears about any remaining bytes still in the ...
virtual int get(const char *url_path)=0
Connects to the server and sends a GET request.
virtual std::string get_response_body()=0
Returns the response body of a previously sent message as a string object, skips any response headers...
virtual void set_keep_alive(bool keep_alive)=0
Sets whether to close the HTTP connection for every single request and reconnect once a new request i...
virtual ~IHTTP_Client()
Virtual default destructor, created to ensure that if a pointer to this class is used and deleted,...
Definition: IHTTP_Client.h:25
virtual int connect(char const *host, uint16_t port)=0
Connects to the given server instance over the defined port.
virtual int get_response_status_code()=0
Gets the HTTP status code contained in the server response.