Chapter 2. API Reference
Header File
• components/protocomm/include/transports/protocomm_httpd.h
Functions
esp_err_t protocomm_httpd_start(protocomm_t *pc, const protocomm_httpd_config_t *config)
Start HTTPD protocomm transport.
This API internally creates a framework to allow endpoint registration and security configuration for the pro-
tocomm.
Note This is a singleton. ie. Protocomm can have multiple instances, but only one instance can be bound to
an HTTP transport layer.
Return
• ESP_OK : Success
• ESP_ERR_INVALID_ARG : Null arguments
• ESP_ERR_NOT_SUPPORTED : Transport layer bound to another protocomm instance
• ESP_ERR_INVALID_STATE : Transport layer already bound to this protocomm instance
• ESP_ERR_NO_MEM : Memory allocation for server resource failed
• ESP_ERR_HTTPD_* : HTTP server error on start
Parameters
• [in] pc: Protocomm instance pointer obtained from protocomm_new()
• [in] config: Pointer to config structure for initializing HTTP server
esp_err_t protocomm_httpd_stop(protocomm_t *pc)
Stop HTTPD protocomm transport.
This API cleans up the HTTPD transport protocomm and frees all the handlers registered with the protocomm.
Return
• ESP_OK : Success
• ESP_ERR_INVALID_ARG : Null / incorrect protocomm instance pointer
Parameters
• [in] pc: Same protocomm instance that was passed to protocomm_httpd_start()
Unions
union protocomm_httpd_config_data_t
#include <protocomm_httpd.h> Protocomm HTTPD Configuration Data
Public Members
void *handle
HTTP Server Handle, if ext_handle_provided is set to true
protocomm_http_server_config_t config
HTTP Server Configuration, if a server is not already active
Structures
struct protocomm_http_server_config_t
Config parameters for protocomm HTTP server.
Public Members
uint16_t port
Port on which the HTTP server will listen
size_t stack_size
Stack size of server task, adjusted depending upon stack usage of endpoint handler
Espressif Systems 672
Submit Document Feedback
Release v4.4