Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5942c2d9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "GD Advertising: Trigger callback when advertising terminated" am: 50e6c05d am: 6656f2a0

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1945141

Change-Id: I8aefa0fc1c026fe3cb75eb614dcd6741e1c3dd69
parents 283d95d1 6656f2a0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -825,7 +825,9 @@ enum ErrorCode: 8 {
  ENCRYPTION_MODE_NOT_ACCEPTABLE = 0x25,
  ROLE_SWITCH_FAILED = 0x35,
  CONTROLLER_BUSY = 0x3A,
  ADVERTISING_TIMEOUT = 0x3C,
  CONNECTION_FAILED_ESTABLISHMENT = 0x3E,
  LIMIT_REACHED = 0x43,
}

// Events that are defined with their respective commands
+6 −2
Original line number Diff line number Diff line
@@ -183,8 +183,12 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb

    AddressWithType advertiser_address = advertising_sets_[event_view.GetAdvertisingHandle()].current_address;

    acl_manager_->OnAdvertisingSetTerminated(
        event_view.GetStatus(), event_view.GetConnectionHandle(), advertiser_address);
    auto status = event_view.GetStatus();
    acl_manager_->OnAdvertisingSetTerminated(status, event_view.GetConnectionHandle(), advertiser_address);
    if (status == ErrorCode::LIMIT_REACHED || status == ErrorCode::ADVERTISING_TIMEOUT) {
      advertising_callbacks_->OnAdvertisingEnabled(advertiser_id, false, (uint8_t)status);
      return;
    }

    if (!advertising_sets_[advertiser_id].directed) {
      // TODO calculate remaining duration and advertising events