|
ESPHome 2026.11.0-dev
|
Dials out when no dial-back target client is connected. More...
#include <api_outgoing_connection.h>
Public Member Functions | |
| void | setup () |
| void | loop (APIServer *server) |
| void | on_target_client (APIConnection *conn) |
| A key-verified client declared itself a dial-back target; last one wins. | |
| void | on_client_removed (APIConnection *conn, bool was_authenticated) |
| Clears the dialed-connection gate; dying unauthenticated escalates the backoff. | |
| void | on_shutdown () |
| void | dump_config () const |
Protected Types | |
| enum class | DialState : uint8_t { DIAL_STATE_IDLE , DIAL_STATE_WAITING , DIAL_STATE_CONNECTING } |
Protected Member Functions | |
| void | try_dial_ (APIServer *server, uint32_t now) |
| void | poll_connect_ (APIServer *server, uint32_t now) |
| void | handoff_ (APIServer *server, uint32_t now) |
| void | schedule_retry_ (uint32_t now) |
| void | schedule_wait_ (uint32_t now, uint32_t wait) |
| socklen_t | target_sockaddr_ (struct sockaddr_storage *addr) const |
| Fill addr with the target and return its length, or 0 when there is none. | |
| bool | persist_target_ () |
| void | format_target_ (std::span< char, socket::SOCKADDR_STR_LEN > buf) const |
| Format the remembered target for a log line; empty when there is none. | |
Protected Attributes | |
| std::unique_ptr< socket::Socket > | dial_socket_ |
| APIConnection * | dialed_conn_ {nullptr} |
| ESPPreferenceObject | target_pref_ |
| uint32_t | backoff_ {BACKOFF_MIN_MS} |
| uint32_t | wait_ {BOOT_WAIT_MS} |
| uint32_t | state_ts_ {0} |
| uint32_t | last_poll_ {0} |
| SavedOutgoingTarget | saved_ {} |
| bool | host_persisted_ {false} |
| DialState | state_ {DialState::DIAL_STATE_WAITING} |
Static Protected Attributes | |
| static constexpr uint32_t | BACKOFF_MIN_MS = 5000 |
| static constexpr uint32_t | BACKOFF_MAX_MS = 300000 |
| static constexpr uint32_t | CONNECT_TIMEOUT_MS = 10000 |
| static constexpr uint32_t | CONNECT_POLL_INTERVAL_MS = 250 |
| static constexpr uint32_t | NETWORK_RETRY_MS = 500 |
| static constexpr uint32_t | PRECONDITION_RETRY_MS = 5000 |
| static constexpr uint32_t | BOOT_WAIT_MS = 0 |
| static constexpr uint32_t | IDLE_WAIT_MS = BACKOFF_MIN_MS |
Dials out when no dial-back target client is connected.
Only the TCP direction flips: the device stays the Noise responder, so both sides still verify by key. Targets the YAML host or the last remembered client.
Definition at line 41 of file api_outgoing_connection.h.
|
strongprotected |
| Enumerator | |
|---|---|
| DIAL_STATE_IDLE | |
| DIAL_STATE_WAITING | |
| DIAL_STATE_CONNECTING | |
Definition at line 53 of file api_outgoing_connection.h.
| void esphome::api::OutgoingConnectionManager::dump_config | ( | ) | const |
Definition at line 299 of file api_outgoing_connection.cpp.
|
protected |
Format the remembered target for a log line; empty when there is none.
Definition at line 101 of file api_outgoing_connection.cpp.
|
protected |
Definition at line 227 of file api_outgoing_connection.cpp.
| void esphome::api::OutgoingConnectionManager::loop | ( | APIServer * | server | ) |
Definition at line 127 of file api_outgoing_connection.cpp.
| void esphome::api::OutgoingConnectionManager::on_client_removed | ( | APIConnection * | conn, |
| bool | was_authenticated ) |
Clears the dialed-connection gate; dying unauthenticated escalates the backoff.
Definition at line 253 of file api_outgoing_connection.cpp.
|
inline |
Definition at line 49 of file api_outgoing_connection.h.
| void esphome::api::OutgoingConnectionManager::on_target_client | ( | APIConnection * | conn | ) |
A key-verified client declared itself a dial-back target; last one wins.
Definition at line 267 of file api_outgoing_connection.cpp.
|
inlineprotected |
Definition at line 87 of file api_outgoing_connection.h.
|
protected |
Definition at line 203 of file api_outgoing_connection.cpp.
|
protected |
Definition at line 246 of file api_outgoing_connection.cpp.
|
protected |
Definition at line 239 of file api_outgoing_connection.cpp.
| void esphome::api::OutgoingConnectionManager::setup | ( | ) |
Definition at line 113 of file api_outgoing_connection.cpp.
|
protected |
Fill addr with the target and return its length, or 0 when there is none.
Definition at line 70 of file api_outgoing_connection.cpp.
|
protected |
Definition at line 153 of file api_outgoing_connection.cpp.
|
protected |
Definition at line 104 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 60 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 59 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 68 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 62 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 61 of file api_outgoing_connection.h.
|
protected |
Definition at line 96 of file api_outgoing_connection.h.
|
protected |
Definition at line 98 of file api_outgoing_connection.h.
|
protected |
Definition at line 114 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 69 of file api_outgoing_connection.h.
|
protected |
Definition at line 107 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 63 of file api_outgoing_connection.h.
|
staticconstexprprotected |
Definition at line 64 of file api_outgoing_connection.h.
|
protected |
Definition at line 111 of file api_outgoing_connection.h.
|
protected |
Definition at line 116 of file api_outgoing_connection.h.
|
protected |
Definition at line 106 of file api_outgoing_connection.h.
|
protected |
Definition at line 100 of file api_outgoing_connection.h.
|
protected |
Definition at line 105 of file api_outgoing_connection.h.