mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
merge
This commit is contained in:
@@ -183,10 +183,7 @@ void BluetoothConnection::send_service_for_discovery_() {
|
||||
static constexpr size_t MAX_PACKET_SIZE = 1360;
|
||||
|
||||
// Keep running total of actual message size
|
||||
size_t current_size = 0;
|
||||
api::ProtoSize size;
|
||||
resp.calculate_size(size);
|
||||
current_size = size.get_size();
|
||||
size_t current_size = resp.calculate_size();
|
||||
|
||||
while (this->send_service_ < this->service_count_) {
|
||||
esp_gattc_service_elem_t service_result;
|
||||
@@ -302,9 +299,7 @@ void BluetoothConnection::send_service_for_discovery_() {
|
||||
} // end if (total_char_count > 0)
|
||||
|
||||
// Calculate the actual size of just this service
|
||||
api::ProtoSize service_sizer;
|
||||
service_resp.calculate_size(service_sizer);
|
||||
size_t service_size = service_sizer.get_size() + 1; // +1 for field tag
|
||||
size_t service_size = service_resp.calculate_size() + 1; // +1 for field tag
|
||||
|
||||
// Check if adding this service would exceed the limit
|
||||
if (current_size + service_size > MAX_PACKET_SIZE) {
|
||||
@@ -333,7 +328,7 @@ void BluetoothConnection::send_service_for_discovery_() {
|
||||
}
|
||||
|
||||
// Send the message with dynamically batched services
|
||||
api_conn->send_message(resp, api::BluetoothGATTGetServicesResponse::MESSAGE_TYPE);
|
||||
api_conn->send_message(resp);
|
||||
}
|
||||
|
||||
void BluetoothConnection::log_connection_error_(const char *operation, esp_gatt_status_t status) {
|
||||
|
||||
Reference in New Issue
Block a user