This commit is contained in:
J. Nick Koston 2025-07-25 15:56:00 -10:00
parent b6e0188c42
commit 8a03e4c2cb
No known key found for this signature in database

View File

@ -113,6 +113,7 @@ void BluetoothConnection::send_service_for_discovery_() {
}
// Now process characteristics
if (char_count_status == ESP_GATT_OK && total_char_count > 0) {
uint16_t char_offset = 0;
esp_gattc_char_elem_t char_result;
while (true) { // characteristics
@ -153,6 +154,11 @@ void BluetoothConnection::send_service_for_discovery_() {
this->address_str().c_str(), char_result.char_handle, desc_count_status);
}
// Skip descriptor processing if there are no descriptors
if (desc_count_status != ESP_GATT_OK || total_desc_count == 0) {
continue;
}
// Now process descriptors
uint16_t desc_offset = 0;
esp_gattc_descr_elem_t desc_result;
@ -179,6 +185,7 @@ void BluetoothConnection::send_service_for_discovery_() {
desc_offset++;
}
}
} // end if (char_count_status == ESP_GATT_OK && total_char_count > 0)
// Send the message (we already checked api_conn is not null at the beginning)
api_conn->send_message(resp, api::BluetoothGATTGetServicesResponse::MESSAGE_TYPE);