1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-11 22:33:49 +01:00

[api] Optimize APIFrameHelper virtual methods and mark implementations as final (#10278)

This commit is contained in:
J. Nick Koston
2025-08-18 16:55:11 -04:00
committed by GitHub
parent 6818439109
commit 1f55486896
3 changed files with 4 additions and 11 deletions

View File

@@ -104,9 +104,9 @@ class APIFrameHelper {
// The buffer contains all messages with appropriate padding before each
virtual APIError write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) = 0;
// Get the frame header padding required by this protocol
virtual uint8_t frame_header_padding() = 0;
uint8_t frame_header_padding() const { return frame_header_padding_; }
// Get the frame footer size required by this protocol
virtual uint8_t frame_footer_size() = 0;
uint8_t frame_footer_size() const { return frame_footer_size_; }
// Check if socket has data ready to read
bool is_socket_ready() const { return socket_ != nullptr && socket_->ready(); }