18 if (data.size() > this->max_packet_size_) {
19 ESP_LOGV(TAG,
"%s: Packet of %zu bytes is larger than %zu, dropped", this->
name_, data.size(),
20 this->max_packet_size_);
27 size_t size = data.size();
29 ESP_LOGW(TAG,
"%s: Packet of %zu bytes is larger than %zu", this->
name_, size, this->
max_packet_size_);
35 auto span = data.as_span();
A buffer class that efficiently represents a composite buffer with three sections:
bool is_contiguous() const
Check if all the data is held in the pre-buffer, so it can be read as one span.
const size_t max_packet_size_
void on_receive_from_interface_(const PacketBuffer &data, const PacketMetaData &meta_data)
This function should be called by implementing classes with received data to be passed to any listene...
void add_listener(F &&listener)
bool send_packet(const uint8_t *data, size_t size)
Returns false if the packet could not be sent to every destination.
void receive_(std::span< const uint8_t > data)
const std::span< uint8_t > tx_buffer_
bool send_to_interface(const packet_interface::PacketBuffer &data, const packet_interface::PacketMetaData &meta_data) override
ESPHOME_ALWAYS_INLINE bool is_connected()
Return whether the node is connected to the network (through wifi, eth, ...)
ESPHOME_LOG_TAG(TAG, "udp.packet_interface")