ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ezsp_proxy_tap.h
Go to the documentation of this file.
1#pragma once
2
4#ifdef USE_EZSP_PROXY_TAP
5
8#include "ash_acknowledger.h"
9
11
12// Acknowledges the ASH frames of an EZSP NCP on behalf of a remote client, so the NCP's
13// ack timeout is measured against this device rather than against the network round trip
14// to the client. The client suppresses its own acknowledgements, making these the only
15// ones the NCP sees.
16//
17// It never carries client traffic: the serial proxy owns the port and the bytes, and this
18// component only observes them. The sole exception is the acknowledgement itself, sent
19// only while a client has put the port in PROTOCOL mode, which only an EZSP client does.
21 public:
22 explicit EzspProxyTap(serial_proxy::SerialProxy *parent) : parent_(parent) {}
23
24 void setup() override;
25 void dump_config() override;
26
27 // SerialProxyTap
28 void on_device_rx(const uint8_t *data, size_t len) override;
29 // ACKs depend only on what the NCP sends
30 void on_client_tx(const uint8_t *data, size_t len) override {}
31 // Acknowledging is only ever useful on a client's behalf, so with nobody subscribed
32 // there is nothing to do and the port need not be read.
33 bool tap_needs_port() const override { return false; }
34 void on_protocol_enabled() override;
35 // Nothing is acknowledged outside PROTOCOL mode, and entering it starts afresh
36 void on_protocol_disabled() override {}
37 void on_device_disconnected() override;
38
39 protected:
40 // The port this component observes. Owns the UART and the bytes; every write we make
41 // goes through it.
43
45};
46
47} // namespace esphome::ezsp_proxy_tap
48
49#endif // USE_EZSP_PROXY_TAP
EzspProxyTap(serial_proxy::SerialProxy *parent)
void on_device_rx(const uint8_t *data, size_t len) override
serial_proxy::SerialProxy * parent_
void on_client_tx(const uint8_t *data, size_t len) override
Observes a port's traffic without owning it, and may inject bytes of its own.
const void size_t len
Definition hal.h:68