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

Commit e13db26b authored by Chienyuan's avatar Chienyuan
Browse files

GD Advertising: Trigger callback when advertising terminated

Tag: #gd-refactor
Bug: 213134740
Test: gd/cert/run
Change-Id: Ic516a898cbd4b89073137e5f785690d8bae1c6e4
parent 891400c2
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