Structures and enumerations

group ESP_TYPEDEFS

List of core structures and enumerations.

Typedefs

typedef uint16_t esp_port_t

Port variable.

typedef void (*esp_api_cmd_evt_fn)(espr_t res, void *arg)

Function declaration for API function command event callback function.

Parameters
  • [in] res: Operation result, member of espr_t enumeration

  • [in] arg: Custom user argument

Enums

enum esp_cmd_t

List of possible messages.

Values:

ESP_CMD_IDLE = 0

IDLE mode

ESP_CMD_RESET

Reset device

ESP_CMD_ATE0

Disable ECHO mode on AT commands

ESP_CMD_ATE1

Enable ECHO mode on AT commands

ESP_CMD_GMR

Get AT commands version

ESP_CMD_GSLP

Set ESP to sleep mode

ESP_CMD_RESTORE

Restore ESP internal settings to default values

ESP_CMD_UART
ESP_CMD_SLEEP
ESP_CMD_WAKEUPGPIO
ESP_CMD_RFPOWER
ESP_CMD_RFVDD
ESP_CMD_RFAUTOTRACE
ESP_CMD_SYSRAM
ESP_CMD_SYSADC
ESP_CMD_SYSMSG
ESP_CMD_SYSLOG
ESP_CMD_WIFI_CWMODE

Set wifi mode

ESP_CMD_WIFI_CWMODE_GET

Get wifi mode

ESP_CMD_WIFI_CWLAPOPT

Configure what is visible on CWLAP response

ESP_CMD_WIFI_CWJAP

Connect to access point

ESP_CMD_WIFI_CWJAP_GET

Info of the connected access point

ESP_CMD_WIFI_CWQAP

Disconnect from access point

ESP_CMD_WIFI_CWLAP

List available access points

ESP_CMD_WIFI_CIPSTAMAC_GET

Get MAC address of ESP station

ESP_CMD_WIFI_CIPSTAMAC_SET

Set MAC address of ESP station

ESP_CMD_WIFI_CIPSTA_GET

Get IP address of ESP station

ESP_CMD_WIFI_CIPSTA_SET

Set IP address of ESP station

ESP_CMD_WIFI_CWAUTOCONN

Configure auto connection to access point

ESP_CMD_WIFI_CWDHCP_SET

Set DHCP config

ESP_CMD_WIFI_CWDHCP_GET

Get DHCP config

ESP_CMD_WIFI_CWDHCPS_SET

Set DHCP SoftAP IP config

ESP_CMD_WIFI_CWDHCPS_GET

Get DHCP SoftAP IP config

ESP_CMD_WIFI_CWSAP_GET

Get software access point configuration

ESP_CMD_WIFI_CWSAP_SET

Set software access point configuration

ESP_CMD_WIFI_CIPAPMAC_GET

Get MAC address of ESP access point

ESP_CMD_WIFI_CIPAPMAC_SET

Set MAC address of ESP access point

ESP_CMD_WIFI_CIPAP_GET

Get IP address of ESP access point

ESP_CMD_WIFI_CIPAP_SET

Set IP address of ESP access point

ESP_CMD_WIFI_CWLIF

Get connected stations on access point

ESP_CMD_WIFI_CWQIF

Discnnect station from SoftAP

ESP_CMD_WIFI_WPS

Set WPS option

ESP_CMD_WIFI_MDNS

Configure MDNS function

ESP_CMD_WIFI_CWHOSTNAME_SET

Set device hostname

ESP_CMD_WIFI_CWHOSTNAME_GET

Get device hostname

ESP_CMD_TCPIP_CIPDOMAIN

Get IP address from domain name = DNS function

ESP_CMD_TCPIP_CIPDNS_SET

Configure user specific DNS servers

ESP_CMD_TCPIP_CIPDNS_GET

Get DNS configuration

ESP_CMD_TCPIP_CIPSTATUS

Get status of connections

ESP_CMD_TCPIP_CIPSTART

Start client connection

ESP_CMD_TCPIP_CIPSEND

Send network data

ESP_CMD_TCPIP_CIPCLOSE

Close active connection

ESP_CMD_TCPIP_CIPSSLSIZE

Set SSL buffer size for SSL connection

ESP_CMD_TCPIP_CIPSSLCCONF

Set the SSL configuration

ESP_CMD_TCPIP_CIFSR

Get local IP

ESP_CMD_TCPIP_CIPMUX

Set single or multiple connections

ESP_CMD_TCPIP_CIPSERVER

Enables/Disables server mode

ESP_CMD_TCPIP_CIPSERVERMAXCONN

Sets maximal number of connections allowed for server population

ESP_CMD_TCPIP_CIPMODE

Transmission mode, either transparent or normal one

ESP_CMD_TCPIP_CIPSTO

Sets connection timeout

ESP_CMD_TCPIP_CIPRECVMODE

Sets mode for TCP data receive (manual or automatic)

ESP_CMD_TCPIP_CIPRECVDATA

Manually reads TCP data from device

ESP_CMD_TCPIP_CIPRECVLEN

Gets number of available bytes in connection to be read

ESP_CMD_TCPIP_CIUPDATE

Perform self-update

ESP_CMD_TCPIP_CIPSNTPCFG

Configure SNTP servers

ESP_CMD_TCPIP_CIPSNTPTIME

Get current time using SNTP

ESP_CMD_TCPIP_CIPDINFO

Configure what data are received on +IPD statement

ESP_CMD_TCPIP_PING

Ping domain

ESP_CMD_WIFI_SMART_START

Start smart config

ESP_CMD_WIFI_SMART_STOP

Stop smart config

ESP_CMD_BLEINIT_GET

Get BLE status

enum espr_t

Result enumeration used across application functions.

Values:

espOK = 0

Function succeeded

espOKIGNOREMORE

Function succedded, should continue as espOK but ignore sending more data. This result is possible on connection data receive callback

espERR
espPARERR

Wrong parameters on function call

espERRMEM

Memory error occurred

espTIMEOUT

Timeout occurred on command

espCONT

There is still some command to be processed in current command

espCLOSED

Connection just closed

espINPROG

Operation is in progress

espERRNOIP

Station does not have IP address

espERRNOFREECONN

There is no free connection available to start

espERRCONNTIMEOUT

Timeout received when connection to access point

espERRPASS

Invalid password for access point

espERRNOAP

No access point found with specific SSID and MAC address

espERRCONNFAIL

Connection failed to access point

espERRWIFINOTCONNECTED

Wifi not connected to access point

espERRNODEVICE

Device is not present

espERRBLOCKING

Blocking mode command is not allowed

enum esp_device_t

List of support ESP devices by firmware.

Values:

ESP_DEVICE_ESP8266

Device is ESP8266

ESP_DEVICE_ESP32

Device is ESP32

ESP_DEVICE_UNKNOWN

Unknown device

enum esp_ecn_t

List of encryptions of access point.

Values:

ESP_ECN_OPEN = 0x00

No encryption on access point

ESP_ECN_WEP

WEP (Wired Equivalent Privacy) encryption

ESP_ECN_WPA_PSK

WPA (Wifi Protected Access) encryption

ESP_ECN_WPA2_PSK

WPA2 (Wifi Protected Access 2) encryption

ESP_ECN_WPA_WPA2_PSK

WPA/2 (Wifi Protected Access 1/2) encryption

ESP_ECN_WPA2_Enterprise

Enterprise encryption.

Note

ESP is currently not able to connect to access point of this encryption type

enum esp_mode_t

List of possible WiFi modes.

Values:

ESP_MODE_STA = 1

Set WiFi mode to station only

ESP_MODE_AP = 2

Set WiFi mode to access point only

ESP_MODE_STA_AP = 3

Set WiFi mode to station and access point

enum esp_http_method_t

List of possible HTTP methods.

Values:

ESP_HTTP_METHOD_GET

HTTP method GET

ESP_HTTP_METHOD_HEAD

HTTP method HEAD

ESP_HTTP_METHOD_POST

HTTP method POST

ESP_HTTP_METHOD_PUT

HTTP method PUT

ESP_HTTP_METHOD_DELETE

HTTP method DELETE

ESP_HTTP_METHOD_CONNECT

HTTP method CONNECT

ESP_HTTP_METHOD_OPTIONS

HTTP method OPTIONS

ESP_HTTP_METHOD_TRACE

HTTP method TRACE

ESP_HTTP_METHOD_PATCH

HTTP method PATCH

struct esp_conn_t
#include <esp_private.h>

Connection structure.

Public Members

esp_conn_type_t type

Connection type

uint8_t num

Connection number

esp_ip_t remote_ip

Remote IP address

esp_port_t remote_port

Remote port number

esp_port_t local_port

Local IP address

esp_evt_fn evt_func

Callback function for connection

void *arg

User custom argument

uint8_t val_id

Validation ID number. It is increased each time a new connection is established. It protects sending data to wrong connection in case we have data in send queue, and connection was closed and active again in between.

esp_linbuff_t buff

Linear buffer structure

size_t total_recved

Total number of bytes received

size_t tcp_available_bytes

Number of bytes in ESP ready to be read on connection. This variable always holds last known info from ESP device and is not decremented (or incremented) by application

size_t tcp_not_ack_bytes

Number of bytes not acknowledge by application done with processing This variable is increased everytime new packet is read to be sent to application and decreased when application acknowledges it

uint8_t active : 1

Status whether connection is active

uint8_t client : 1

Status whether connection is in client mode

uint8_t data_received : 1

Status whether first data were received on connection

uint8_t in_closing : 1

Status if connection is in closing mode. When in closing mode, ignore any possible received data from function

uint8_t receive_blocked : 1

Status whether we should block manual receive for some time

uint8_t receive_is_command_queued : 1

Status whether manual read command is in the queue already

struct esp_conn_t::[anonymous]::[anonymous] f

Connection flags

union esp_conn_t::[anonymous] status

Connection status union with flag bits

struct esp_pbuf_t
#include <esp_private.h>

Packet buffer structure.

Public Members

struct esp_pbuf *next

Next pbuf in chain list

size_t tot_len

Total length of pbuf chain

size_t len

Length of payload

size_t ref

Number of references to this structure

uint8_t *payload

Pointer to payload memory

esp_ip_t ip

Remote address for received IPD data

esp_port_t port

Remote port for received IPD data

struct esp_ipd_t
#include <esp_private.h>

Incoming network data read structure.

Public Members

uint8_t read

Set to 1 when we should process input data as connection data

size_t tot_len

Total length of packet

size_t rem_len

Remaining bytes to read in current +IPD statement

esp_conn_p conn

Pointer to connection for network data

esp_ip_t ip

Remote IP address on from IPD data

esp_port_t port

Remote port on IPD data

size_t buff_ptr

Buffer pointer to save data to. When set to NULL while read = 1, reading should ignore incoming data

esp_pbuf_p buff

Pointer to data buffer used for receiving data

struct esp_msg_t
#include <esp_private.h>

Message queue structure to share between threads.

Public Members

esp_cmd_t cmd_def

Default message type received from queue

esp_cmd_t cmd

Since some commands can have different subcommands, sub command is used here

uint8_t i

Variable to indicate order number of subcommands

esp_sys_sem_t sem

Semaphore for the message

uint8_t is_blocking

Status if command is blocking

uint32_t block_time

Maximal blocking time in units of milliseconds. Use 0 to for non-blocking call

espr_t res

Result of message operation

espr_t (*fn)(struct esp_msg*)

Processing callback function to process packet

uint32_t delay

Delay in units of milliseconds before executing first RESET command

struct esp_msg_t::[anonymous]::[anonymous] reset

Reset device

uint32_t baudrate

Baudrate for AT port

struct esp_msg_t::[anonymous]::[anonymous] uart

UART configuration

esp_mode_t mode

Mode of operation

esp_mode_t *mode_get

Get mode

struct esp_msg_t::[anonymous]::[anonymous] wifi_mode

When message type ESP_CMD_WIFI_CWMODE is used

const char *name

AP name

const char *pass

AP password

const esp_mac_t *mac

Specific MAC address to use when connecting to AP

uint8_t error_num

Error number on connecting

struct esp_msg_t::[anonymous]::[anonymous] sta_join

Message for joining to access point

uint8_t en

Status to enable/disable auto join feature

Enable/disable DHCP settings

Enable/Disable server status

Status if SNTP is enabled or not

Status if WPS is enabled or not

Set to 1 to enable or 0 to disable

struct esp_msg_t::[anonymous]::[anonymous] sta_autojoin

Message for auto join procedure

esp_sta_info_ap_t *info

Information structure

struct esp_msg_t::[anonymous]::[anonymous] sta_info_ap

Message for reading the AP information

const char *ssid

Pointer to optional filter SSID name to search

Name of access point

esp_ap_t *aps

Pointer to array to save access points

size_t apsl

Length of input array of access points

size_t apsi

Current access point array

size_t *apf

Pointer to output variable holding number of access points found

struct esp_msg_t::[anonymous]::[anonymous] ap_list

List for available access points to connect to

const char *pwd

Password of access point

esp_ecn_t ecn

Ecryption used

uint8_t ch

RF Channel used

uint8_t max_sta

Max allowed connected stations

uint8_t hid

Configuration if network is hidden or visible

struct esp_msg_t::[anonymous]::[anonymous] ap_conf

Parameters to configure access point

esp_ap_conf_t *ap_conf

AP configuration

struct esp_msg_t::[anonymous]::[anonymous] ap_conf_get

Get the soft AP configuration

esp_sta_t *stas

Pointer to array to save access points

size_t stal

Length of input array of access points

size_t stai

Current access point array

size_t *staf

Pointer to output variable holding number of access points found

struct esp_msg_t::[anonymous]::[anonymous] sta_list

List for stations connected to SoftAP

esp_mac_t mac

MAC address to disconnect from access point

Pointer to MAC variable

struct esp_msg_t::[anonymous]::[anonymous] ap_disconn_sta

Disconnect station from access point

esp_ip_t *ip

Pointer to IP variable

esp_ip_t *gw

Pointer to gateway variable

esp_ip_t *nm

Pointer to netmask variable

struct esp_msg_t::[anonymous]::[anonymous] sta_ap_getip

Message for reading station or access point IP

esp_mac_t *mac

Pointer to MAC variable

struct esp_msg_t::[anonymous]::[anonymous] sta_ap_getmac

Message for reading station or access point MAC address

esp_ip_t ip

Pointer to IP variable

esp_ip_t gw

Pointer to gateway variable

esp_ip_t nm

Pointer to netmask variable

struct esp_msg_t::[anonymous]::[anonymous] sta_ap_setip

Message for setting station or access point IP

struct esp_msg_t::[anonymous]::[anonymous] sta_ap_setmac

Message for setting station or access point MAC address

uint8_t sta

Set station DHCP settings

uint8_t ap

Set access point DHCP settings

struct esp_msg_t::[anonymous]::[anonymous] wifi_cwdhcp

Set DHCP settings

const char *hostname_set

Hostname set value

char *hostname_get

Hostname get value

size_t length

Length of buffer when reading hostname

struct esp_msg_t::[anonymous]::[anonymous] wifi_hostname

Set or get hostname structure

esp_conn_t **conn

Pointer to pointer to save connection used

const char *remote_host

Host to use for connection

esp_port_t remote_port

Remote port used for connection

Remote port address for UDP connection

esp_conn_type_t type

Connection type

const char *local_ip

Local IP address. Normally set to NULL

uint16_t tcp_ssl_keep_alive

Keep alive parameter for TCP

uint8_t udp_mode

UDP mode

esp_port_t udp_local_port

UDP local port

void *arg

Connection custom argument

esp_evt_fn evt_func

Callback function to use on connection

uint8_t num

Connection number used for start

uint8_t success

Status if connection AT+CIPSTART succedded

struct esp_msg_t::[anonymous]::[anonymous] conn_start

Structure for starting new connection

esp_conn_t *conn

Pointer to connection to close

Pointer to connection to send data

uint8_t val_id

Connection current validation ID when command was sent to queue

struct esp_msg_t::[anonymous]::[anonymous] conn_close

Close connection

size_t btw

Number of remaining bytes to write

size_t ptr

Current write pointer for data

const uint8_t *data

Data to send

size_t sent

Number of bytes sent in last packet

size_t sent_all

Number of bytes sent all together

uint8_t tries

Number of tries used for last packet

uint8_t wait_send_ok_err

Set to 1 when we wait for SEND OK or SEND ERROR

const esp_ip_t *remote_ip

Remote IP address for UDP connection

uint8_t fau

Free after use flag to free memory after data are sent (or not)

size_t *bw

Number of bytes written so far

struct esp_msg_t::[anonymous]::[anonymous] conn_send

Structure to send data on connection

esp_port_t port

Server port number

mDNS server port

uint16_t max_conn

Maximal number of connections available for server

uint16_t timeout

Connection timeout

esp_evt_fn cb

Server default callback function

struct esp_msg_t::[anonymous]::[anonymous] tcpip_server

Server configuration

size_t size

Size for SSL in uints of bytes

struct esp_msg_t::[anonymous]::[anonymous] tcpip_sslsize

TCP SSL size for SSL connections

const char *host

Hostname to ping

mDNS host name

uint32_t time

Time used for ping

uint32_t *time_out

Pointer to time output variable

struct esp_msg_t::[anonymous]::[anonymous] tcpip_ping

Pinging structure

int8_t tz

Timezone setup

const char *h1

Optional server 1

const char *h2

Optional server 2

const char *h3

Optional server 3

struct esp_msg_t::[anonymous]::[anonymous] tcpip_sntp_cfg

SNTP configuration

esp_datetime_t *dt

Pointer to datetime structure

struct esp_msg_t::[anonymous]::[anonymous] tcpip_sntp_time

SNTP get time

struct esp_msg_t::[anonymous]::[anonymous] wps_cfg

WPS configuration

const char *server

mDNS server

struct esp_msg_t::[anonymous]::[anonymous] mdns

mDNS configuration

Link ID of connection to set SSL configuration for

uint8_t auth_mode

Timezone setup

uint8_t pki_number

The index of cert and private key, if only one cert and private key, the value should be 0.

uint8_t ca_number

The index of CA, if only one CA, the value should be 0.

struct esp_msg_t::[anonymous]::[anonymous] tcpip_ssl_cfg

SSl configuration for connection

union esp_msg_t::[anonymous] msg

Group of different message contents

struct esp_ip_mac_t
#include <esp_private.h>

IP and MAC structure with netmask and gateway addresses.

Public Members

esp_ip_t ip

IP address

esp_ip_t gw

Gateway address

esp_ip_t nm

Netmask address

esp_mac_t mac

MAC address

uint8_t dhcp

Flag indicating DHCP is enabled

uint8_t has_ip

Flag indicating ESP has IP

uint8_t is_connected

Flag indicating ESP is connected to wifi

#include <esp_private.h>

Link connection active info.

Public Members

uint8_t failed

Status if connection successful

uint8_t num

Connection number

uint8_t is_server

Status if connection is client or server

esp_conn_type_t type

Connection type

esp_ip_t remote_ip

Remote IP address

esp_port_t remote_port

Remote port

esp_port_t local_port

Local port number

struct esp_evt_func_t
#include <esp_private.h>

Callback function linked list prototype.

Public Members

struct esp_evt_func *next

Next function in the list

esp_evt_fn fn

Function pointer itself

struct esp_modules_t
#include <esp_private.h>

ESP modules structure.

Public Members

esp_device_t device

ESP device type

esp_sw_version_t version_at

Version of AT command software on ESP device

esp_sw_version_t version_sdk

Version of SDK used to build AT software

uint32_t active_conns

Bit field of currently active connections,

uint32_t active_conns_last

The same as previous but status before last check

Link connection handle

esp_ipd_t ipd

Connection incoming data structure

esp_conn_t conns[ESP_CFG_MAX_CONNS]

Array of all connection structures

esp_ip_mac_t sta

Station IP and MAC addressed

esp_ip_mac_t ap

Access point IP and MAC addressed

struct esp_t
#include <esp_private.h>

ESP global structure.

Public Members

size_t locked_cnt

Counter how many times (recursive) stack is currently locked

esp_sys_sem_t sem_sync

Synchronization semaphore between threads

esp_sys_mbox_t mbox_producer

Producer message queue handle

esp_sys_mbox_t mbox_process

Consumer message queue handle

esp_sys_thread_t thread_produce

Producer thread handle

esp_sys_thread_t thread_process

Processing thread handle

esp_buff_t buff

Input processing buffer

esp_ll_t ll

Low level functions

esp_msg_t *msg

Pointer to current user message being executed

esp_evt_t evt

Callback processing structure

esp_evt_func_t *evt_func

Callback function linked list

esp_evt_fn evt_server

Default callback function for server connections

esp_modules_t m

All modules. When resetting, reset structure

uint8_t initialized : 1

Flag indicating ESP library is initialized

uint8_t dev_present : 1

Flag indicating if physical device is connected to host device

struct esp_t::[anonymous]::[anonymous] f

Flags structure

union esp_t::[anonymous] status

Status structure

uint8_t conn_val_id

Validation ID increased each time device connects to wifi network or on reset. It is used for connections

struct esp_unicode_t
#include <esp_private.h>

Unicode support structure.

Public Members

uint8_t ch[4]

UTF-8 max characters

uint8_t t

Total expected length in UTF-8 sequence

uint8_t r

Remaining bytes in UTF-8 sequence

espr_t res

Current result of processing

struct esp_ip_t
#include <esp_typedefs.h>

IP structure.

Public Members

uint8_t ip[4]

IPv4 address

struct esp_mac_t
#include <esp_typedefs.h>

MAC address.

Public Members

uint8_t mac[6]

MAC address

struct esp_sw_version_t
#include <esp_typedefs.h>

SW version in semantic versioning format.

Public Members

uint8_t major

Major version

uint8_t minor

Minor version

uint8_t patch

Patch version

struct esp_datetime_t
#include <esp_typedefs.h>

Date and time structure.

Public Members

uint8_t date

Day in a month, from 1 to up to 31

uint8_t month

Month in a year, from 1 to 12

uint16_t year

Year

uint8_t day

Day in a week, from 1 to 7

uint8_t hours

Hours in a day, from 0 to 23

uint8_t minutes

Minutes in a hour, from 0 to 59

uint8_t seconds

Seconds in a minute, from 0 to 59

struct esp_linbuff_t
#include <esp_typedefs.h>

Linear buffer structure.

Public Members

uint8_t *buff

Pointer to buffer data array

size_t len

Length of buffer array

size_t ptr

Current buffer pointer