IOT-ESP32
network.h File Reference

Interfaces for WiFi network communication. More...

Functions

esp_err_t http_client_close (http_client_t *)
 close all network resources associated with client More...
 
void http_client_connect (http_client_t *, char *, int)
 set http_client connection info (host/port) More...
 
void http_client_enable_ssl (http_client_t *, char *)
 set http_client to use ssl More...
 
http_response_t http_client_get (http_client_t *, char *)
 execute an HTTP GET to path using client settings More...
 
http_response_t http_client_get_response (http_client *)
 read http_client response after executing request More...
 
http_client_t * http_client_init (http_client_t *)
 Allocate new http client handles to a struct. More...
 
http_response_t http_client_post (http_client_t *, char *)
 execute an HTTP POST to path using client settings More...
 
size_t http_client_read (http_client_t *, char *, size_t)
 read the body of the http_client response More...
 
void http_client_set_agent (http_client_t *, char *)
 set http_client user-agent More...
 
void http_client_set_auth (http_client_t *, char *, char *)
 set basic auth credentials for http client More...
 
void http_client_set_header (http_client_t *, char *, char *)
 set custom headers, such as auth token More...
 
void http_client_set_post_data (http_client_t *, char *, size_t)
 set http_client pointer to buffer for request body More...
 
void http_client_set_query (http_client_t *, char *)
 set http_client query params as string More...
 
void mdns_start (mdns_config_t)
 start mDNS services using config More...
 
void mdns_stop ()
 stop mDNS service More...
 
void network_queue_init ()
 start tasks associated with the network queues More...
 
uint8_t network_queue_payload (device_data_t *)
 Schedule a payload to the network delivery queue. More...
 
void wifi_connect ()
 connect wi-fi using stored creds or start wifi-provisioning More...
 
void wifi_err_check (uint8_t)
 track errors for wifi clients to compare against threshold More...
 

Detailed Description

Interfaces for WiFi network communication.

Function Documentation

◆ wifi_connect()

void wifi_connect ( )

connect wi-fi using stored creds or start wifi-provisioning

◆ wifi_err_check()

void wifi_err_check ( uint8_t  )

track errors for wifi clients to compare against threshold

Excessive errors will trigger a reset with powerdown of all domains

Parameters
N_of_Err

◆ http_client_init()

http_client_t * http_client_init ( http_client_t *  )

Allocate new http client handles to a struct.

Parameters
clientptr to an http_client_t
Returns
http_client_t* ptr on succes or null

◆ http_client_enable_ssl()

void http_client_enable_ssl ( http_client_t *  ,
char *   
)

set http_client to use ssl

Parameters
http_client
ca_pemPEM ASCII of the trusted CA

◆ http_client_set_auth()

void http_client_set_auth ( http_client_t *  ,
char *  ,
char *   
)

set basic auth credentials for http client

Parameters
http_client
username
password

◆ http_client_set_header()

void http_client_set_header ( http_client_t *  ,
char *  ,
char *   
)

set custom headers, such as auth token

Parameters
http_client
key
value

◆ http_client_connect()

void http_client_connect ( http_client_t *  ,
char *  ,
int   
)

set http_client connection info (host/port)

Parameters
http_client
host
port

◆ http_client_set_post_data()

void http_client_set_post_data ( http_client_t *  ,
char *  ,
size_t   
)

set http_client pointer to buffer for request body

Parameters
http_client
bodyptr to body buffer
lenlength of buffer

◆ http_client_set_agent()

void http_client_set_agent ( http_client_t *  ,
char *   
)

set http_client user-agent

Parameters
http_client
useragent

◆ http_client_set_query()

void http_client_set_query ( http_client_t *  ,
char *   
)

set http_client query params as string

Parameters
http_client
params

◆ http_client_get_response()

http_response_t http_client_get_response ( http_client *  )

read http_client response after executing request

Parameters
http_client
Returns
http_response_t

◆ http_client_get()

http_response_t http_client_get ( http_client_t *  ,
char *   
)

execute an HTTP GET to path using client settings

Parameters
http_client
uri_path
Returns
http_response_t

◆ http_client_post()

http_response_t http_client_post ( http_client_t *  ,
char *   
)

execute an HTTP POST to path using client settings

Parameters
http_client
uri_path
Returns
http_response_t

◆ http_client_read()

size_t http_client_read ( http_client_t *  ,
char *  ,
size_t   
)

read the body of the http_client response

Parameters
bufbuf to write response
lenlength of buf
Returns
size_t lenth returned to buffer

◆ http_client_close()

esp_err_t http_client_close ( http_client_t *  )

close all network resources associated with client

Parameters
http_client
Returns
esp_err_t ESP_OK on succes or applicable ESP error code

◆ network_queue_init()

void network_queue_init ( )

start tasks associated with the network queues

Tasks associated with the network services, such as sending updates using transport protocols. This is not related to the lower level wifi services start by wifi_connect() which handles PHY and IP layers.

◆ network_queue_payload()

uint8_t network_queue_payload ( device_data_t *  )

Schedule a payload to the network delivery queue.

Parameters
payload
Returns
uint8_t boolean eval

◆ mdns_start()

void mdns_start ( mdns_config_t  )

start mDNS services using config

Used by smartthings edge, see smartthings.h

Parameters
config

◆ mdns_stop()

void mdns_stop ( )

stop mDNS service