20#include <system_error>
29class HomeAssistantServices;
44 using ErrorHandler = std::function<void(std::error_code,
const std::string&)>;
78 std::size_t
run_for(std::chrono::milliseconds duration)
const;
88 void post(std::function<
void()> fn)
const;
131 std::unique_ptr<Impl> impl_;
Byte buffer / view aliases and protobuf base-128 varint codec.
Scans for, connects to, and talks GATT to BLE devices through the device's Bluetooth proxy.
Definition bluetooth_proxy.hpp:175
Non-owning view over a contiguous run of bytes (a C++17 stand-in for std::span<const std::uint8_t>).
Definition bytes.hpp:17
Async client for a single device.
Definition client.hpp:38
Connection & connection() const
Access the underlying Connection (advanced/raw use).
const EntityStore & store() const
std::function< void(std::error_code)> ConnectHandler
Definition client.hpp:40
void request_entity_list() const
Ask the device to enumerate its entities (ListEntitiesRequest).
void send(const ProtoMessage &msg) const
void on_error(ErrorHandler handler) const
void stop() const
Stop the loop (causes run to return).
std::size_t run_one() const
Run a single handler, blocking until one is available; returns count.
void on(std::uint32_t msg_type, MessageHandler handler) const
void post(std::function< void()> fn) const
Post fn to run on the client's executor.
SerialPort serial_proxy(std::uint32_t instance)
An instance-bound serial-proxy handle: client.serial_proxy(0).write(...).
std::function< void(std::error_code, const std::string &)> ErrorHandler
Definition client.hpp:44
void on_any(MessageHandler handler) const
ConnectionState state() const
Client & operator=(const Client &)=delete
std::function< void(ConnectionState)> StateHandler
Definition client.hpp:43
void async_connect(ConnectHandler on_done) const
Begin connecting + handshaking; on_done fires once when the session is ready (or with an error).
void send_raw(std::uint32_t msg_type, ByteView payload) const
void on_raw(RawHandler handler) const
bool is_connected() const
EntityRegistry entities()
Typed, object-oriented view over the entity store: entities().switches(), entities()....
HomeAssistantServices & home_assistant()
SerialPort serial_proxy(const std::string &name)
Look up a serial-proxy handle by its advertised name.
const DeviceInfo & device_info() const
void subscribe_to_states() const
Ask the device to stream state updates (SubscribeStatesRequest).
void restart() const
Reset a stopped loop so it can run again.
Client(ClientOptions options)
const ServerHello & server_hello() const
BluetoothProxy & bluetooth()
void run() const
Run the loop until stopped (blocking). Typically used on a worker thread.
std::function< void(const ProtoMessage &)> MessageHandler
Definition client.hpp:41
EntityStore & store()
The store of discovered entities and their latest states (auto-populated from every inbound message).
std::size_t run_for(std::chrono::milliseconds duration) const
Run ready handlers for up to duration; returns handlers executed.
bool has_device_info() const
The most recently received DeviceInfo (populated when a DeviceInfoResponse is seen).
void disconnect() const
Begin a graceful disconnect.
Client(const Client &)=delete
void on_state(StateHandler handler) const
std::size_t poll() const
Execute any ready handlers without blocking; returns handlers executed.
std::function< void(std::uint32_t msg_type, ByteView payload)> RawHandler
Definition client.hpp:42
Drives one logical session with an ESPHome device: TCP connect, optional Noise handshake (via the inj...
Definition connection.hpp:40
Object-oriented façade over the entity store.
Definition entity_registry.hpp:60
Collects a device's entity descriptions and live states.
Definition entity_store.hpp:60
Discovers user-defined services and invokes them.
Definition home_assistant_services.hpp:43
Subscribes to and surfaces the device's log stream.
Definition log_stream.hpp:21
Base class every generated message derives from.
Definition proto_message.hpp:23
A single serial-proxy instance bound to its index — the instance-aware, ergonomic front end to Serial...
Definition serial_proxy.hpp:129
Proxies a UART on the device, forwarding data and control to clients.
Definition serial_proxy.hpp:68
Drives the device's voice-assistant pipeline: subscribing to start/stop requests, relaying events and...
Definition voice_assistant.hpp:79
Bridges raw Z-Wave frames between a client and the device's Z-Wave radio.
Definition zwave_proxy.hpp:20
Top-level connection parameters for Client / SyncClient.
Connection: the ESPHome native-API protocol state machine.
Connection state-machine states.
std::string name
Definition emit_registry.cpp:14
ConnectionState
Lifecycle of a Connection.
Definition connection_state.hpp:11
Lightweight base class for every generated ESPHome API message.
Everything needed to reach and authenticate with one ESPHome device.
Definition client_options.hpp:16
Ergonomic, copyable snapshot of a device's identity and capabilities, converted from the raw DeviceIn...
Definition device_info.hpp:27
Information returned by the device in its HelloResponse.
Definition connection.hpp:27