|
ESPHome 2026.4.0
|
#include <api_frame_helper_plaintext.h>
Public Member Functions | |
| APIPlaintextFrameHelper (std::unique_ptr< socket::Socket > socket) | |
| ~APIPlaintextFrameHelper () override=default | |
| APIError | init () override |
| Initialize the frame helper, returns OK if successful. | |
| APIError | loop () override |
| APIError | read_packet (ReadPacketBuffer *buffer) override |
| APIError | write_protobuf_packet (uint8_t type, ProtoWriteBuffer buffer) override |
| APIError | write_protobuf_messages (ProtoWriteBuffer buffer, std::span< const MessageInfo > messages) override |
Public Member Functions inherited from esphome::api::APIFrameHelper | |
| APIFrameHelper ()=default | |
| APIFrameHelper (std::unique_ptr< socket::Socket > socket) | |
| const char * | get_client_name () const |
| const char * | get_peername_to (std::span< char, socket::SOCKADDR_STR_LEN > buf) const |
| void | set_client_name (const char *name, size_t len) |
| virtual | ~APIFrameHelper ()=default |
| bool | can_write_without_blocking () |
| int | getpeername (struct sockaddr *addr, socklen_t *addrlen) |
| APIError | close () |
| APIError | shutdown (int how) |
| void | set_nodelay_for_message (bool is_log_message) |
| uint8_t | frame_header_padding () const |
| uint8_t | frame_header_size (uint16_t payload_size, uint8_t message_type) const |
| uint8_t | frame_footer_size () const |
| bool | is_socket_ready () const |
| void | release_buffers () |
Static Public Attributes | |
| static constexpr uint8_t | HEADER_PADDING = 1 + 3 + 2 |
Protected Member Functions | |
| APIError | try_read_frame_ () |
| Read a packet into the rx_buf_. | |
Protected Member Functions inherited from esphome::api::APIFrameHelper | |
| APIError | drain_overflow_and_handle_errors_ () |
| ssize_t ESPHOME_ALWAYS_INLINE | write_iov_to_socket_ (const struct iovec *iov, int iovcnt) |
| APIError ESPHOME_ALWAYS_INLINE | write_raw_fast_buf_ (const void *data, uint16_t len) |
| APIError | write_raw_buf_ (const void *data, uint16_t len, ssize_t sent=WRITE_NOT_ATTEMPTED) |
| APIError | write_raw_iov_ (const struct iovec *iov, int iovcnt, uint16_t total_write_len, ssize_t sent=WRITE_NOT_ATTEMPTED) |
| void | log_packet_sending_ (const void *data, uint16_t len) |
| APIError ESPHOME_ALWAYS_INLINE | check_data_state_ () const |
| void | set_nodelay_raw_ (bool enable) |
| APIError | init_common_ () |
| APIError | handle_socket_read_result_ (ssize_t received) |
Protected Attributes | |
| uint16_t | rx_header_parsed_type_ = 0 |
| uint16_t | rx_header_parsed_len_ = 0 |
| uint8_t | rx_header_buf_ [6] |
| uint8_t | rx_header_buf_pos_ = 0 |
| bool | rx_header_parsed_ = false |
Protected Attributes inherited from esphome::api::APIFrameHelper | |
| std::unique_ptr< socket::Socket > | socket_ |
| APIOverflowBuffer | overflow_buf_ |
| APIBuffer | rx_buf_ |
| char | client_name_ [CLIENT_INFO_NAME_MAX_LEN] {} |
| uint16_t | rx_buf_len_ = 0 |
| State | state_ {State::INITIALIZE} |
| uint8_t | frame_header_padding_ {0} |
| uint8_t | frame_footer_size_ {0} |
| uint8_t | nodelay_counter_ {0} |
Additional Inherited Members | |
Protected Types inherited from esphome::api::APIFrameHelper | |
| enum class | State : uint8_t { INITIALIZE = 1 , CLIENT_HELLO = 2 , SERVER_HELLO = 3 , HANDSHAKE = 4 , DATA = 5 , CLOSED = 6 , FAILED = 7 , EXPLICIT_REJECT = 8 } |
Static Protected Attributes inherited from esphome::api::APIFrameHelper | |
| static constexpr ssize_t | WRITE_FAILED = -1 |
| static constexpr ssize_t | WRITE_NOT_ATTEMPTED = -2 |
| static constexpr uint8_t | LOG_NAGLE_COUNT = 2 |
Definition at line 8 of file api_frame_helper_plaintext.h.
|
inlineexplicit |
Definition at line 17 of file api_frame_helper_plaintext.h.
|
overridedefault |
|
overridevirtual |
Initialize the frame helper, returns OK if successful.
Implements esphome::api::APIFrameHelper.
Definition at line 47 of file api_frame_helper_plaintext.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 56 of file api_frame_helper_plaintext.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 190 of file api_frame_helper_plaintext.cpp.
|
protected |
Read a packet into the rx_buf_.
error API_ERROR_BAD_INDICATOR: Bad indicator byte at start of frame.
Definition at line 72 of file api_frame_helper_plaintext.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 301 of file api_frame_helper_plaintext.cpp.
|
overridevirtual |
Implements esphome::api::APIFrameHelper.
Definition at line 289 of file api_frame_helper_plaintext.cpp.
|
staticconstexpr |
Definition at line 15 of file api_frame_helper_plaintext.h.
|
protected |
Definition at line 43 of file api_frame_helper_plaintext.h.
|
protected |
Definition at line 44 of file api_frame_helper_plaintext.h.
|
protected |
Definition at line 45 of file api_frame_helper_plaintext.h.
|
protected |
Definition at line 32 of file api_frame_helper_plaintext.h.
|
protected |
Definition at line 31 of file api_frame_helper_plaintext.h.