Skip to content

Commit

Permalink
fix: do not assert if GattCompleteEvent fails (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsantosphilips authored Jul 24, 2023
1 parent 530b3bc commit 063daa4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hal_st/middlewares/ble_middleware/GapCentralSt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ namespace hal

auto gattCompleteEvent = *reinterpret_cast<aci_gatt_proc_complete_event_rp0*>(vendorEvent->data);

really_assert(gattCompleteEvent.Connection_Handle == connectionContext.connectionHandle);
really_assert(gattCompleteEvent.Error_Code == BLE_STATUS_SUCCESS);
auto localOnConnection = std::exchange(onConnection, nullptr);

if (onConnection)
infra::Subject<services::GapCentralObserver>::NotifyObservers(std::exchange(onConnection, nullptr));
if (localOnConnection && gattCompleteEvent.Error_Code == BLE_STATUS_SUCCESS)
{
really_assert(gattCompleteEvent.Connection_Handle == connectionContext.connectionHandle);
infra::Subject<services::GapCentralObserver>::NotifyObservers(localOnConnection);
}
}

void GapCentralSt::HandleL2capConnectionUpdateRequestEvent(evt_blecore_aci* vendorEvent)
Expand Down

0 comments on commit 063daa4

Please sign in to comment.