mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 13:22:19 +01:00
preen
This commit is contained in:
@@ -129,16 +129,14 @@ void BluetoothConnection::send_service_for_discovery_() {
|
|||||||
resp.address = this->address_;
|
resp.address = this->address_;
|
||||||
|
|
||||||
// Dynamic batching based on actual size
|
// Dynamic batching based on actual size
|
||||||
static constexpr size_t MAX_PACKET_SIZE =
|
// Conservative MTU limit for API messages (accounts for WPA3 overhead)
|
||||||
1360; // Conservative MTU limit for API messages (accounts for WPA3 overhead)
|
static constexpr size_t MAX_PACKET_SIZE = 1360;
|
||||||
|
|
||||||
// Keep running total of actual message size
|
// Keep running total of actual message size
|
||||||
size_t current_size = 0;
|
size_t current_size = 0;
|
||||||
api::ProtoSize size;
|
api::ProtoSize size;
|
||||||
resp.calculate_size(size);
|
resp.calculate_size(size);
|
||||||
current_size = size.get_size();
|
current_size = size.get_size();
|
||||||
ESP_LOGV(TAG, "[%d] [%s] Starting batch with base size: %d, send_service_: %d", this->connection_index_,
|
|
||||||
this->address_str().c_str(), current_size, this->send_service_);
|
|
||||||
|
|
||||||
while (this->send_service_ < this->service_count_) {
|
while (this->send_service_ < this->service_count_) {
|
||||||
esp_gattc_service_elem_t service_result;
|
esp_gattc_service_elem_t service_result;
|
||||||
@@ -182,10 +180,6 @@ void BluetoothConnection::send_service_for_discovery_() {
|
|||||||
|
|
||||||
service_resp.handle = service_result.start_handle;
|
service_resp.handle = service_result.start_handle;
|
||||||
|
|
||||||
ESP_LOGV(TAG, "[%d] [%s] Service UUID: %llx,%llx short:%u handle:%u", this->connection_index_,
|
|
||||||
this->address_str().c_str(), service_resp.uuid[0], service_resp.uuid[1], service_resp.short_uuid,
|
|
||||||
service_resp.handle);
|
|
||||||
|
|
||||||
if (total_char_count > 0) {
|
if (total_char_count > 0) {
|
||||||
// Reserve space and process characteristics
|
// Reserve space and process characteristics
|
||||||
service_resp.characteristics.reserve(total_char_count);
|
service_resp.characteristics.reserve(total_char_count);
|
||||||
@@ -292,7 +286,6 @@ void BluetoothConnection::send_service_for_discovery_() {
|
|||||||
|
|
||||||
// Now we know we're keeping this service, add its size
|
// Now we know we're keeping this service, add its size
|
||||||
current_size += service_size;
|
current_size += service_size;
|
||||||
|
|
||||||
// Successfully added this service, increment counter
|
// Successfully added this service, increment counter
|
||||||
this->send_service_++;
|
this->send_service_++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user