Merge branch 'esp32-gatt-backend' into neutral-ble-client

This commit is contained in:
J. Nick Koston
2026-08-09 16:32:41 -05:00
3 changed files with 8 additions and 1 deletions
@@ -54,7 +54,10 @@ void BluedroidGattClient::loop() {
// frees its slot, then re-register the app on the next enable.
auto down_st = this->state();
if (down_st != ClientState::IDLE && down_st != ClientState::INIT) {
this->release_services();
// The dying stack invalidates its own cache; a cache_clean would just
// warn against a disabled stack. Reset the stream latches directly.
this->service_total_ = 0;
this->services_released_ = true;
this->set_idle_();
this->listener_->on_connection_state(false, 0, ble_device_base::GATT_ERR_NOT_CONNECTED);
}
@@ -153,6 +153,7 @@ class BluedroidGattClient final : public esp32_ble_tracker::ESPBTClient, public
bool mtu_failed_ : 1 {false};
// Search issued at OPEN_EVT overlaps the MTU exchange; discover_services()
// completes from it. Reset by set_idle_().
static_assert(static_cast<uint8_t>(SearchState::REPORT_PENDING) < (1 << 4), "search_state_ bitfield too narrow");
SearchState search_state_ : 4 {SearchState::NONE};
// esp_gatt_status_t of the completed search, held until claimed.
uint8_t search_status_{0};
@@ -148,6 +148,9 @@ class BluetoothConnection final : public ble_device_base::GattClientListener {
char address_str_[MAC_ADDRESS_PRETTY_BUFFER_SIZE]{};
// Group 5: bit-packed tail; within 2 bytes the 8-aligned object stays 48.
static_assert(static_cast<uint8_t>(ClientState::ESTABLISHED) < (1 << 3), "state_ bitfield too narrow");
static_assert(static_cast<uint8_t>(ConnectionType::V3_WITHOUT_CACHE) < (1 << 2),
"connection_type_ bitfield too narrow");
ClientState state_ : 3 {ClientState::IDLE};
bool paired_ : 1 {false};
ConnectionType connection_type_ : 2 {ConnectionType::V1};