esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
connection_state.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace esphome::api {
7
11enum class ConnectionState {
14 HelloSent,
15 Connected,
16 Closing,
17 Closed,
18 Failed,
19};
20
22inline const char* to_string(const ConnectionState state) {
23 switch (state) {
25 return "Disconnected";
27 return "Connecting";
29 return "HelloSent";
31 return "Connected";
33 return "Closing";
35 return "Closed";
37 return "Failed";
38 }
39 return "Unknown";
40}
41
42} // namespace esphome::api
Definition bytes.hpp:10
ConnectionState
Lifecycle of a Connection.
Definition connection_state.hpp:11
@ HelloSent
HelloRequest sent; awaiting HelloResponse.
@ Connected
Handshake complete; messages flow freely.
@ Closing
Graceful DisconnectRequest in flight.
@ Failed
Terminated by an error.
@ Connecting
TCP connect (and, for Noise, handshake) in progress.
@ Disconnected
Idle, never connected or fully torn down.
const char * to_string(const ConnectionState state)
Human-readable name of a connection state.
Definition connection_state.hpp:22