AWS IoT for ESP32 v1.0.0
An ESP-IDF based solution
lib_http.h
Go to the documentation of this file.
1
5#ifndef _LIB_HTTP_H_
6#define _LIB_HTTP_H_
7
8#include "stdutils.h"
9#include "lib_json.h"
10
11#define HTTP_TIMEOUT 10000
12#define MAX_HTTP_HEADERS 3
13
18typedef enum
19{
30 HTTP_REQUEST_MAX,
32
37typedef enum
38{
59
63typedef struct
64{
66 tagStructure_st as_headers[MAX_HTTP_HEADERS];
67 char *pUrlStr;
69 bool header_b8;
71
79bool HTTP_start(httpConfig_st *ps_config);
80
87
95bool HTTP_read(packet_st *ps_packet);
96
103
111
112#endif
bool HTTP_start(httpConfig_st *ps_config)
Initialize HTTP configuration request and send the request.
const char * HTTP_getStateString(httpStates_et state_e)
Get HTTP state as string.
httpStates_et
Definition: lib_http.h:38
@ STATE_HTTP_WAIT_FOR_POST_RESPONSE
Definition: lib_http.h:48
@ STATE_HTTP_CLOSE
Definition: lib_http.h:56
@ STATE_HTTP_WAIT_FOR_FILE_HEADER
Definition: lib_http.h:50
@ STATE_HTTP_POST_REQUEST
Definition: lib_http.h:46
@ STATE_HTTP_MAX
Definition: lib_http.h:57
@ STATE_HTTP_DOWNLOAD_COMPLETE
Definition: lib_http.h:52
@ STATE_HTTP_GET_REQUEST
Definition: lib_http.h:45
@ STATE_HTTP_RETRY
Definition: lib_http.h:53
@ STATE_HTTP_CONNECT
Definition: lib_http.h:43
@ STATE_HTTP_READ
Definition: lib_http.h:49
@ STATE_HTTP_POST_DATA
Definition: lib_http.h:47
@ STATE_HTTP_SET_URL
Definition: lib_http.h:44
@ STATE_HTTP_SET_RESPONSE_HEADER
Definition: lib_http.h:42
@ STATE_HTTP_TIMEOUT
Definition: lib_http.h:54
@ STATE_HTTP_IDLE
Definition: lib_http.h:39
@ STATE_HTTP_SET_REQUEST_HEADER
Definition: lib_http.h:41
@ STATE_HTTP_DOWNLOAD_FILE
Definition: lib_http.h:51
@ STATE_HTTP_FAILED
Definition: lib_http.h:55
@ STATE_HTTP_START
Definition: lib_http.h:40
bool HTTP_read(packet_st *ps_packet)
Read HTTP response.
httpReq_et
Definition: lib_http.h:19
@ HTTP_REQUEST_UNSUBSCRIBE
Definition: lib_http.h:28
@ HTTP_REQUEST_POST
Definition: lib_http.h:21
@ HTTP_REQUEST_HEAD
Definition: lib_http.h:25
@ HTTP_REQUEST_SUBSCRIBE
Definition: lib_http.h:27
@ HTTP_REQUEST_GET
Definition: lib_http.h:20
@ HTTP_REQUEST_NOTIFY
Definition: lib_http.h:26
@ HTTP_REQUEST_PUT
Definition: lib_http.h:22
@ HTTP_REQUEST_OPTIONS
Definition: lib_http.h:29
@ HTTP_REQUEST_PATCH
Definition: lib_http.h:23
@ HTTP_REQUEST_DELETE
Definition: lib_http.h:24
void HTTP_close()
Close HTTP connection.
uint16_t HTTP_availableToRead()
Check if HTTP data is available for read.
JSON library header file.
An HTTP Configuration structure.
Definition: lib_http.h:64
char * pUrlStr
Definition: lib_http.h:67
httpReq_et reqType_e
Definition: lib_http.h:65
char * pPayloadStr
Definition: lib_http.h:68
Packeting structure to handle fragmentation and re-assembly of file download.
Definition: lib_msg.h:62
A structure to represent key-value pairs in a JSON string.
Definition: lib_json.h:18