Pass ProtoWriteBuffer by reference instead of by value in virtual
encode() methods. This avoids copying both buffer_ and pos_ pointers
for every encode call - only a single pointer is passed.
Also simplifies encode_message since child writes directly advance
the shared pos_. Adds debug_check_size_ to verify calculate_size
matches actual encode output.
ProtoSize::calculate_size() already computes the exact encoded size
before encode() runs and is the boundary validation. The buffer is
pre-sized to match. Since the buffer size is always correct,
push_back() capacity checks on every byte are redundant overhead.
Rename ProtoWriteBuffer to ProtoWritePreSizedBuffer to document the
contract. Write through a raw uint8_t* pointer instead of push_back().
Pre-resize the buffer to include payload space before encoding.
Add ESPHOME_DEBUG_API bounds checks to validate writes stay within the
pre-sized region during development and integration testing.
If all messages required auth (both no_conn_ids and conn_only_ids
empty), the auth check block would be skipped entirely. Now generates
a simple check_authenticated_() call as fallback when there are no
exceptions to the default auth requirement.
Move the authentication/connection check switch into
APIServerConnectionBase::read_message before the dispatch switch,
eliminating the APIServerConnection class entirely. APIConnection
now inherits directly from APIServerConnectionBase.
Remove the 48 on_xxx overrides and 48 pure virtual methods from
the generated APIServerConnection class. APIConnection now overrides
on_xxx() directly from APIServerConnectionBase, eliminating one
virtual call per message dispatch and ~96 vtable entries.
Remove the 48 on_xxx overrides and 48 pure virtual methods from
the generated APIServerConnection class. APIConnection now overrides
on_xxx() directly from APIServerConnectionBase, eliminating one
virtual call per message dispatch and ~96 vtable entries.
- Update RECEIVE_CASES type hint from 2-tuple to 3-tuple to match
the actual stored shape (case, ifdef, message_name)
- Use consistent log format "%s: {}" for empty message overload
to match the "%s: %s" pattern of non-empty messages
- Fix regex to actually match std::to_string() by using alternation
(the : in the lookbehind was preventing matches)
- Update error message to mention both std::to_string() and
unqualified to_string() forms
- Correct buffer sizes for signed integer types:
- int8_t: 5 chars (not 4) for "-128\0"
- int16_t: 7 chars (not 6) for "-32768\0"
- int32_t: 12 chars (not 11) for "-2147483648\0"