|
ESPHome 2026.1.4
|
AsyncClient API for platforms using sockets (ESP-IDF, host, etc.) NOTE: This class is NOT thread-safe. More...
#include <async_tcp_socket.h>
Public Types | |
| using | AcConnectHandler = std::function<void(void *, AsyncClient *)> |
| using | AcDataHandler = std::function<void(void *, AsyncClient *, void *data, size_t len)> |
| using | AcErrorHandler = std::function<void(void *, AsyncClient *, int8_t error)> |
Public Member Functions | |
| AsyncClient ()=default | |
| ~AsyncClient ()=default | |
| bool | connect (const char *host, uint16_t port) |
| void | close () |
| bool | connected () const |
| size_t | write (const char *data, size_t len) |
| void | onConnect (AcConnectHandler cb, void *arg=nullptr) |
| void | onDisconnect (AcConnectHandler cb, void *arg=nullptr) |
| void | onData (AcDataHandler cb, void *arg=nullptr) |
| Set data callback. NOTE: data pointer is only valid during callback execution. | |
| void | onError (AcErrorHandler cb, void *arg=nullptr) |
| void | loop () |
AsyncClient API for platforms using sockets (ESP-IDF, host, etc.) NOTE: This class is NOT thread-safe.
All methods must be called from the main loop.
Definition at line 18 of file async_tcp_socket.h.
| using esphome::async_tcp::AsyncClient::AcConnectHandler = std::function<void(void *, AsyncClient *)> |
Definition at line 20 of file async_tcp_socket.h.
| using esphome::async_tcp::AsyncClient::AcDataHandler = std::function<void(void *, AsyncClient *, void *data, size_t len)> |
Definition at line 21 of file async_tcp_socket.h.
| using esphome::async_tcp::AsyncClient::AcErrorHandler = std::function<void(void *, AsyncClient *, int8_t error)> |
Definition at line 22 of file async_tcp_socket.h.
|
default |
|
default |
| void esphome::async_tcp::AsyncClient::close | ( | ) |
Definition at line 67 of file async_tcp_socket.cpp.
|
nodiscard |
Definition at line 19 of file async_tcp_socket.cpp.
|
inlinenodiscard |
Definition at line 29 of file async_tcp_socket.h.
| void esphome::async_tcp::AsyncClient::loop | ( | ) |
Definition at line 93 of file async_tcp_socket.cpp.
|
inline |
Definition at line 32 of file async_tcp_socket.h.
|
inline |
Set data callback. NOTE: data pointer is only valid during callback execution.
Definition at line 41 of file async_tcp_socket.h.
|
inline |
Definition at line 36 of file async_tcp_socket.h.
|
inline |
Definition at line 45 of file async_tcp_socket.h.
| size_t esphome::async_tcp::AsyncClient::write | ( | const char * | data, |
| size_t | len ) |
Definition at line 76 of file async_tcp_socket.cpp.